@Override public void setConf(Configuration configuration) { conf = configuration; txnHandler = TxnUtils.getTxnStore(conf); }
/** * Should produce the same result as * {@link org.apache.hadoop.hive.ql.io.AcidUtils#isAcidTable(org.apache.hadoop.hive.ql.metadata.Table)}. */ public static boolean isAcidTable(Table table) { return TxnUtils.isTransactionalTable(table) && TransactionalValidationListener.DEFAULT_TRANSACTIONAL_PROPERTY.equals(table.getParameters() .get(hive_metastoreConstants.TABLE_TRANSACTIONAL_PROPERTIES)); }
/** * Checks if all the txns in the list are in open state. * @param txnIds list of txns to be evaluated for open state * @param stmt db statement * @return If all txns in open state, then return true else false */ private boolean isTxnsInOpenState(List<Long> txnIds, Statement stmt) throws SQLException { List<String> queries = new ArrayList<>(); StringBuilder prefix = new StringBuilder(); StringBuilder suffix = new StringBuilder(); // Get the count of txns from the given list are in open state. If the returned count is same as // the input number of txns, then it means, all are in open state. prefix.append("select count(*) from TXNS where txn_state = '" + TXN_OPEN + "' and "); suffix.append(""); TxnUtils.buildQueryWithINClause(conf, queries, prefix, suffix, txnIds, "txn_id", false, false); long count = 0; for (String query : queries) { LOG.debug("Going to execute query <" + query + ">"); ResultSet rs = stmt.executeQuery(query); if (rs.next()) { count += rs.getLong(1); } } return count == txnIds.size(); }
TxnStore txnHandler = TxnUtils.getTxnStore(conf); txns = TxnUtils.createValidCompactTxnList(txnHandler.getOpenTxnsInfo());
if(TxnUtils.isAcidTable(newTable) && !TxnUtils.isAcidTable(oldTable)) { TxnStore t = TxnUtils.getTxnStore(getConf());
inListStrings.add(aLong.toString()); return buildQueryWithINClauseStrings(conf, queries, prefix, suffix, inListStrings, inColumn, addParens, notIn);
TxnUtils.createValidCompactTxnList(txnHandler.getOpenTxnsInfo()); Set<CompactionInfo> potentials = txnHandler.findPotentialCompactions(abortedThreshold); LOG.debug("Found " + potentials.size() + " potential compactions, " +
int querySize = querySizeExpected(buf.length(), nextValue.length(), suffix.length(), addParens);
TxnStore txnHandler = TxnUtils.getTxnStore(conf); txns = TxnUtils.createValidCompactTxnList(txnHandler.getOpenTxnsInfo());
.buildQueryWithINClauseStrings(conf, queries, prefix, suffix, questions, "tc_txnid", true, false); int totalCount = 0;
TxnUtils.createValidCompactTxnList(txnHandler.getOpenTxnsInfo()); LOG.debug("ValidCompactTxnList: " + txns.writeToString()); txnHandler.setCompactionHighestTxnId(ci, txns.getHighWatermark());
int querySize = querySizeExpected(buf.length(), nextValue.length(), suffix.length(), addParens);
@Override public void setConf(Configuration configuration) { this.conf = configuration; txnHandler = TxnUtils.getTxnStore(conf); }
private Map<String, String> adjustStatsParamsForGet(Map<String, String> tableParams, Map<String, String> params, long statsWriteId, String validWriteIds) throws MetaException { if (!TxnUtils.isTransactionalTable(tableParams)) return params; // Not a txn table. if (areTxnStatsSupported && ((validWriteIds == null) || ObjectStore.isCurrentStatsValidForTheQuery( conf, params, statsWriteId, validWriteIds, false))) { // Valid stats are supported for txn tables, and either no verification was requested by the // caller, or the verification has succeeded. return params; } // Clone the map to avoid affecting the cached value. params = new HashMap<>(params); StatsSetupConst.setBasicStatsState(params, StatsSetupConst.FALSE); return params; }
TxnUtils.buildQueryWithINClause(conf, queries, prefix, suffix, txnIds, "ctc_txnid", false, false); Long txnId;
questions.add("?"); List<Integer> counts = TxnUtils.buildQueryWithINClauseStrings(conf, queries, prefix, suffix, questions, "cc_id", false, false); int totalCount = 0; for (int i = 0; i < queries.size(); i++) {
@Override public void setConf(Configuration configuration) { this.conf = configuration; txnHandler = TxnUtils.getTxnStore(conf); }
void updateTableLocation(Table table, Path newLocation) throws HiveException { String msg = String.format("ALTER TABLE %s SET LOCATION '%s'", getQualifiedName(table), newLocation); LOG.info(msg); boolean isTxn = TxnUtils.isTransactionalTable(table); org.apache.hadoop.hive.ql.metadata.Table modifiedTable = new org.apache.hadoop.hive.ql.metadata.Table(table); modifiedTable.setDataLocation(newLocation); alterTableInternal(isTxn, table, modifiedTable); }
TxnUtils.buildQueryWithINClause(conf, queries, prefix, suffix, txnIds, "txn_id", false, false); Long txnId;
List<Integer> counts = TxnUtils.buildQueryWithINClauseStrings(conf, queries, prefix, suffix, questions, "\"PART_NAME\"", true, false); int totalCount = 0;