pkumarsinha commented on a change in pull request #2101:
URL: https://github.com/apache/hive/pull/2101#discussion_r608042947
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/Compiler.java
##########
@@ -265,7 +266,15 @@ private void openTransaction(TxnType txnType) throws
LockException, CommandProce
if (DriverUtils.checkConcurrency(driverContext) &&
startImplicitTxn(driverContext.getTxnManager()) &&
!driverContext.getTxnManager().isTxnOpen() && txnType !=
TxnType.COMPACTION) {
String userFromUGI = DriverUtils.getUserFromUGI(driverContext);
- driverContext.getTxnManager().openTxn(context, userFromUGI, txnType);
+ boolean isHiveReplTxn =
(driverContext.getQueryState().getHiveOperation() != null)
Review comment:
(driverContext.getQueryState().getHiveOperation() != null) check is not
needed
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -958,6 +960,10 @@ private void deleteReplTxnMapEntry(Connection dbConn, long
sourceTxnId, String r
public void abortTxn(AbortTxnRequest rqst) throws NoSuchTxnException,
MetaException, TxnAbortedException {
long txnid = rqst.getTxnid();
long sourceTxnId = -1;
+ boolean isReplayedReplTxn = rqst.isSetReplPolicy() && rqst.isSetTxn_type()
Review comment:
rqst.isSetTxn_type() check isn't required
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -8349,8 +8353,12 @@ public long get_latest_txnid_in_conflict(long txnId)
throws MetaException {
@Override
public void commit_txn(CommitTxnRequest rqst) throws TException {
+ boolean isReplayedReplTxn = rqst.isSetReplPolicy() && rqst.isSetTxn_type()
&&
+ rqst.getTxn_type() == TxnType.REPL_CREATED;
+ boolean isHiveReplTxn = rqst.isSetReplPolicy()
+ && (!rqst.isSetTxn_type() || (rqst.isSetTxn_type() &&
rqst.getTxn_type() != TxnType.REPL_CREATED));
Review comment:
Could you please explain what are you trying to check?
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -958,6 +960,10 @@ private void deleteReplTxnMapEntry(Connection dbConn, long
sourceTxnId, String r
public void abortTxn(AbortTxnRequest rqst) throws NoSuchTxnException,
MetaException, TxnAbortedException {
long txnid = rqst.getTxnid();
long sourceTxnId = -1;
+ boolean isReplayedReplTxn = rqst.isSetReplPolicy() && rqst.isSetTxn_type()
+ && rqst.getTxn_type() == TxnType.REPL_CREATED;
+ boolean isHiveReplTxn = rqst.isSetReplPolicy()
+ && (!rqst.isSetTxn_type() || (rqst.isSetTxn_type() &&
rqst.getTxn_type() != TxnType.REPL_CREATED));
Review comment:
could you pls explain this
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -8400,8 +8408,10 @@ public void commit_txn(CommitTxnRequest rqst) throws
TException {
}
getTxnHandler().commitTxn(rqst);
if (listeners != null && !listeners.isEmpty()) {
- MetaStoreListenerNotifier.notifyEvent(listeners, EventType.COMMIT_TXN,
- new CommitTxnEvent(rqst.getTxnid(), this));
+ if (!isHiveReplTxn) {
+ MetaStoreListenerNotifier.notifyEvent(listeners, EventType.COMMIT_TXN,
+ new CommitTxnEvent(rqst.getTxnid(), this));
+ }
Review comment:
If you are skipping this event, should you go with next line:
Optional<CompactionInfo> compactionInfo =
getTxnHandler().getCompactionByTxnId(rqst.getTxnid());
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/Compiler.java
##########
@@ -265,7 +266,15 @@ private void openTransaction(TxnType txnType) throws
LockException, CommandProce
if (DriverUtils.checkConcurrency(driverContext) &&
startImplicitTxn(driverContext.getTxnManager()) &&
!driverContext.getTxnManager().isTxnOpen() && txnType !=
TxnType.COMPACTION) {
String userFromUGI = DriverUtils.getUserFromUGI(driverContext);
- driverContext.getTxnManager().openTxn(context, userFromUGI, txnType);
+ boolean isHiveReplTxn =
(driverContext.getQueryState().getHiveOperation() != null)
+ &&
(driverContext.getQueryState().getHiveOperation().equals(HiveOperation.REPLDUMP)
+ ||
driverContext.getQueryState().getHiveOperation().equals(HiveOperation.REPLLOAD));
+ String dbUnderReplication = (isHiveReplTxn) ?
PlanUtils.stripQuotes(tree.getChild(0).getText()) : null;
+ if (dbUnderReplication != null) {
Review comment:
Can isHiveReplTxn be true and dbUnderReplication be null ever? if not,
this should be based on check isHiveReplTxn
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java
##########
@@ -170,6 +170,7 @@ Licensed to the Apache Software Foundation (ASF) under one
private ScheduledFuture<?> heartbeatTask = null;
private static final int SHUTDOWN_HOOK_PRIORITY = 0;
private final ReentrantLock heartbeatTaskLock = new ReentrantLock();
+ private String dbUnderReplication = null;
Review comment:
Why do you need to store it?
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -8349,8 +8353,12 @@ public long get_latest_txnid_in_conflict(long txnId)
throws MetaException {
@Override
public void commit_txn(CommitTxnRequest rqst) throws TException {
+ boolean isReplayedReplTxn = rqst.isSetReplPolicy() && rqst.isSetTxn_type()
&&
Review comment:
Why do you need this check - rqst.isSetTxn_type()?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]