github-actions[bot] commented on code in PR #69585:
URL: https://github.com/apache/doris/pull/69585#discussion_r4385809456
##########
fe/fe-core/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java:
##########
@@ -193,6 +204,26 @@ public long beginTransaction(long dbId, List<Long>
tableIdList, String label, TU
}
}
+ @Override
+ public long beginTransactionForValues(long dbId, long tableId, String
label, TUniqueId requestId,
+ TxnCoordinator coordinator, LoadJobSourceType sourceType, long
timeoutSecond,
+ Map<Long, Integer> schemaVersions) throws UserException {
+ Database db =
Env.getCurrentInternalCatalog().getDbOrMetaException(dbId);
+ OlapTable table = (OlapTable) db.getTableOrMetaException(tableId,
Table.TableType.OLAP);
+ ChangelogColumnIdPreparer.ensureReady(db, table);
Review Comment:
[P1] Keep VALUES preparation waits outside the table read lock
`BatchInsertIntoTableCommand.run` retains the table read lock while
`InsertUtils.beginBatchInsertTransaction` calls this method, so this second
`ensureReady` can wait for another caller while still holding that lock. For a
changelog table with already-valid UIDs: A starts transactional VALUES and
holds the read lock; C queues `ALTER TABLE ... MODIFY COMMENT`'s unbounded
write lock; B starts another load, installs `IN_FLIGHT`, then queues its read
lock behind C because the table lock is fair; A reaches `existing.get()` for B.
A waits for B, B waits behind C, and C waits for A to release its read lock.
All three waits are unbounded, so subsequent table operations remain stuck. The
initial preparation before batch planning does not prevent this because even
no-op preparations install a future before checking the IDs. Ensure this
preparation/wait occurs before the enclosing batch read lock, and add
deterministic coverage for this interleaving.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]