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
}
});

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
Copy link
Contributor

@kuczoram kuczoram left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this fix and sorry for the late response. I didn't get any notification about the review request.
Anyway I went trough the patch and it looks good to me, I have only one question.

Copy link
Contributor

@difin difin left a comment

Choose a reason for hiding this comment

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

+1 LGTM

@deniskuzZ deniskuzZ force-pushed the HIVE-26704 branch 2 times, most recently from 64ab2ad to 3aad9d0 Compare November 5, 2025 22:50
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 6, 2025

@deniskuzZ deniskuzZ merged commit 2e1af9b into apache:master Nov 6, 2025
2 checks passed
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.

4 participants