Skip to content

Conversation

@deniskuzZ
Copy link
Member

@deniskuzZ deniskuzZ commented Oct 25, 2025

What changes were proposed in this pull request?

Use minHistoryWriteId by default

Why are the changes needed?

Overcomes scalability constraints imposed by global min open txn concept

Does this PR introduce any user-facing change?

No

How was this patch tested?

Jenkins

@deniskuzZ deniskuzZ changed the title HIVE-26704: Addendum: Use minHistoryWriteId by default HIVE-29291: Use minHistoryWriteId by default Oct 27, 2025
@deniskuzZ deniskuzZ closed this Oct 27, 2025
@deniskuzZ deniskuzZ reopened this Oct 27, 2025
@deniskuzZ deniskuzZ requested a review from kuczoram October 27, 2025 11:24
@sonarqubecloud
Copy link

}
});

Long minTxnId = jdbcResource.execute(new MinUncommittedTxnIdHandler());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

existing MinUncommittedTxnIdHandler wasn't used for unknown reason

if (txnType == TxnType.SOFT_DELETE || txnType == TxnType.COMPACTION) {
new AcquireTxnLockFunction(false).execute(jdbcResource);
if (!ConfVars.useMinHistoryWriteId()) {
new AcquireTxnLockFunction(false).execute(jdbcResource);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nextTxnId hwm is not used with MinHistoryWriteId, so no need to lock in oder to get accurate value

"FROM \"TXN_COMPONENTS\" WHERE \"TC_TXNID\"= :txnId AND \"TC_OPERATION_TYPE\" <> :type"),
writeSetInsertSql + (ConfVars.useMinHistoryLevel() ? conflictSQLSuffix :
"FROM \"TXN_COMPONENTS\" WHERE \"TC_TXNID\"= :txnId" + (
(txnType != TxnType.REBALANCE_COMPACTION) ? "" : " AND \"TC_OPERATION_TYPE\" <> :type")),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REBALANCE_COMPACTION uses UPDATE operation semantic with EXCL_WRITE

queryBatch.add("DELETE FROM \"MATERIALIZATION_REBUILD_LOCKS\" WHERE \"MRL_TXN_ID\" = " + txnid);
}
if (txnType == TxnType.SOFT_DELETE || txnType == TxnType.COMPACTION) {
if (txnType == TxnType.SOFT_DELETE || MetaStoreServerUtils.isCompactionTxn(txnType)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no idea why REBALANCE_COMPACTION was excluded, looks like a bug

" \"CUR\".\"TC_PARTITION\" IS NULL) " +
// txns overlap
" WHERE \"CUR\".\"TC_TXNID\" <= \"COMMITTED\".\"WS_COMMIT_ID\"";
" WHERE \"CUR\".\"TC_TXNID\" <= \"COMMITTED\".\"WS_COMMIT_ID\"" +
Copy link
Member Author

@deniskuzZ deniskuzZ Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just moved the predicate under the WHERE clause

@deniskuzZ deniskuzZ requested a review from difin October 29, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants