Skip to content

Conversation

@chenjian2664
Copy link
Contributor

Description

The Delta Lake connector does not guarantee that queries are executed in a strict order. Queries may start concurrently, which makes count-based assertions in tests non-deterministic.

Additional context and related issues

Release notes

(x) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

## Section
* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Jan 13, 2026
@github-actions github-actions bot added the delta-lake Delta Lake connector label Jan 13, 2026
@findinpath
Copy link
Contributor

findinpath commented Jan 13, 2026

@chenjian2664 note that this PR relates to #27484

Queries may start concurrently, which makes count-based assertions in tests non-deterministic.

This is not true.
There seems to be indeed an issue when testing against the local filesystem which has not been reproduced against object storage providers.

@findinpath
Copy link
Contributor

@chenjian2664 could you please add reference in the description to recorded CI failures against object storage providers?

Copy link
Contributor

@findinpath findinpath left a comment

Choose a reason for hiding this comment

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

The flakiness is generated by testing against the local file system.

See #27484 (comment)

If the same issue would occur against an object storage, we would have a bug in the implementation.

@chenjian2664
Copy link
Contributor Author

@findinpath just considering the reading phrase, when the queries arrive at the connector, it is possible it reads the same version of the table right?

@findinpath
Copy link
Contributor

@findinpath just considering the reading phrase, when the queries arrive at the connector, it is possible it reads the same version of the table right?

yes, sure.

INSERT INTO " + tableName + " SELECT COUNT(*), 10 AS part FROM " + tableName

This is an operation which reads from the same table it inserts into.
This operation is therefore not a "blind append".

In case of dealing with a non-blind append, we will be checking whether other concurrent operations that are also non-blind inserts have inserted data and if so, fail the operation:

boolean readWholeTable = enforcedSourcePartitionConstraints.isAll();
if (readWholeTable) {
throw new TransactionFailedException("Conflicting concurrent writes found. Data files added in the modified table by concurrent write operation.");
}

So, even if two operations are reading the same version of the table, only one of these operations will actually succeed in performing the commit successfully.

@chenjian2664
Copy link
Contributor Author

chenjian2664 commented Jan 13, 2026

@findinpath Thanks for guiding me to the place that committing the insert.
I think the problem is here

long currentVersion = getMandatoryCurrentVersion(fileSystem, handle.location(), readVersion.get());
, concurrent reads are possibly here and still reads the same readVersion - if it is, we won't step into checkForConcurrentTransactionConflicts at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed delta-lake Delta Lake connector

Development

Successfully merging this pull request may close these issues.

3 participants