commit 6c6ce33e3528a78fe21604456f4e1546502e4857 Author: Owen O'Malley Date: Sat Apr 5 15:30:48 2014 -0700 HIVE-6850. Fix for fetch operator using the valid transaction list from the previous query. diff --git ql/src/java/org/apache/hadoop/hive/ql/Driver.java ql/src/java/org/apache/hadoop/hive/ql/Driver.java index d42895a..370f6e4 100644 --- ql/src/java/org/apache/hadoop/hive/ql/Driver.java +++ ql/src/java/org/apache/hadoop/hive/ql/Driver.java @@ -119,10 +119,6 @@ private void createTxnManager() throws SemanticException { throw new SemanticException(e.getMessage(), e); } } - // the reason that we set the txn manager for the cxt here is because each - // query has its own ctx object. The txn mgr is shared across the - // same instance of Driver, which can run multiple queries. - ctx.setHiveTxnManager(txnMgr); } private boolean checkConcurrency() throws SemanticException { @@ -814,7 +810,7 @@ public QueryPlan getPlan() { private int recordValidTxns() { try { ValidTxnList txns = txnMgr.getValidTxns(); - ctx.getConf().set(ValidTxnList.VALID_TXNS_KEY, txns.toString()); + conf.set(ValidTxnList.VALID_TXNS_KEY, txns.toString()); return 0; } catch (LockException e) { errorMessage = "FAILED: Error in determing valid transactions: " + e.getMessage(); @@ -993,13 +989,6 @@ private CommandProcessorResponse runInternal(String command, boolean alreadyComp perfLogger.PerfLogBegin(CLASS_NAME, PerfLogger.TIME_TO_SUBMIT); int ret; - if (!alreadyCompiled) { - ret = compileInternal(command); - if (ret != 0) { - return new CommandProcessorResponse(ret, errorMessage, SQLState); - } - } - boolean requireLock = false; boolean ckLock = false; try { @@ -1014,6 +1003,20 @@ private CommandProcessorResponse runInternal(String command, boolean alreadyComp ret = 10; return new CommandProcessorResponse(ret, errorMessage, SQLState); } + ret = recordValidTxns(); + if (ret != 0) return new CommandProcessorResponse(ret, errorMessage, SQLState); + + if (!alreadyCompiled) { + ret = compileInternal(command); + if (ret != 0) { + return new CommandProcessorResponse(ret, errorMessage, SQLState); + } + } + + // the reason that we set the txn manager for the cxt here is because each + // query has its own ctx object. The txn mgr is shared across the + // same instance of Driver, which can run multiple queries. + ctx.setHiveTxnManager(txnMgr); if (ckLock) { boolean lockOnlyMapred = HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_LOCK_MAPRED_ONLY); @@ -1040,9 +1043,6 @@ private CommandProcessorResponse runInternal(String command, boolean alreadyComp } } - ret = recordValidTxns(); - if (ret != 0) return new CommandProcessorResponse(ret, errorMessage, SQLState); - if (requireLock) { ret = acquireReadWriteLocks(); if (ret != 0) {