@Override public ValidTxnList getValidTxns(long currentTxn) throws TException { return TxnCommonUtils.createValidReadTxnList(client.get_open_txns(), currentTxn); }
@Override public ValidTxnList getValidTxns() throws TException { return TxnCommonUtils.createValidReadTxnList(client.get_open_txns(), 0); }
@Override public ValidTxnList getValidTxns() throws TException { return TxnCommonUtils.createValidReadTxnList(client.get_open_txns(), 0); }
@Override public ValidTxnList getValidTxns(long currentTxn) throws TException { return TxnCommonUtils.createValidReadTxnList(client.get_open_txns(), currentTxn); }
@Override public void run() { if (LOG.isDebugEnabled()) { LOG.debug("Cleaning up materialization rebuild locks"); } TxnStore.MutexAPI.LockHandle handle = null; try { handle = txnHandler.getMutexAPI().acquireLock(TxnStore.MUTEX_KEY.MaterializationRebuild.name()); ValidTxnList validTxnList = TxnCommonUtils.createValidReadTxnList(txnHandler.getOpenTxns(), 0); long removedCnt = txnHandler.cleanupMaterializationRebuildLocks(validTxnList, MetastoreConf.getTimeVar(conf, MetastoreConf.ConfVars.TXN_TIMEOUT, TimeUnit.MILLISECONDS)); if (removedCnt > 0) { if (LOG.isDebugEnabled()) { LOG.debug("Number of materialization locks deleted: " + removedCnt); } } } catch(Throwable t) { LOG.error("Serious error in {}", Thread.currentThread().getName(), ": {}" + t.getMessage(), t); } finally { if(handle != null) { handle.releaseLocks(); } } } }
private ValidTxnList getValidTxnList(Connection dbConn, String fullTableName, Long writeId) throws MetaException, SQLException { PreparedStatement pst = null; ResultSet rs = null; try { String[] names = TxnUtils.getDbTableName(fullTableName); assert names.length == 2; List<String> params = Arrays.asList(names[0], names[1]); String s = "select t2w_txnid from TXN_TO_WRITE_ID where t2w_database = ? and t2w_table = ? and t2w_writeid = " + writeId; pst = sqlGenerator.prepareStmtWithParameters(dbConn, s, params); LOG.debug("Going to execute query <" + s.replaceAll("\\?", "{}") + ">", quoteString(names[0]), quoteString(names[1])); rs = pst.executeQuery(); if (rs.next()) { return TxnCommonUtils.createValidReadTxnList(getOpenTxns(), rs.getLong(1)); } throw new MetaException("invalid write id " + writeId + " for table " + fullTableName); } finally { close(rs, pst, null); } }
} else { validTxnList = TxnCommonUtils.createValidReadTxnList(getOpenTxns(), 0);
.createValidReadTxnList(txnHandler.getOpenTxns(), 0); conf.set(ValidTxnList.VALID_TXNS_KEY, validTxnList.writeToString());