Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep last parameters when updating Glue in Delta #23138

Merged

Conversation

ebyhr
Copy link
Member

@ebyhr ebyhr commented Aug 27, 2024

Description

Otherwise, DeltaLakeTableMetadataScheduler fails internally.
I manually tested and didn't add a test because this issue is specific to V1 (legacy).

Release notes

(x) This is not user-visible or is docs only, and no release notes are required.

@cla-bot cla-bot bot added the cla-signed label Aug 27, 2024
@github-actions github-actions bot added the delta-lake Delta Lake connector label Aug 27, 2024
Copy link
Member

@raunaqmorarka raunaqmorarka left a comment

Choose a reason for hiding this comment

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

Could you add some more detail about the failure scenario like the error stacktrace or steps to get to the error ?

@ebyhr
Copy link
Member Author

ebyhr commented Aug 27, 2024

@raunaqmorarka This is the sample stacktrace when executed COMMENT ON TABLE delta.ebyhr.test_scheduler IS 'test comment'. This issue always happened in all write operations.

java.lang.IllegalArgumentException: Multiple entries with same key: trino_last_transaction_version=6 and trino_last_transaction_version=5
	at com.google.common.collect.ImmutableMap.conflictException(ImmutableMap.java:382)
	at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:376)
	at com.google.common.collect.RegularImmutableMap.checkNoConflictInKeyBucket(RegularImmutableMap.java:249)
	at com.google.common.collect.RegularImmutableMap.fromEntryArrayCheckingBucketOverflow(RegularImmutableMap.java:136)
	at com.google.common.collect.RegularImmutableMap.fromEntryArray(RegularImmutableMap.java:98)
	at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:579)
	at com.google.common.collect.ImmutableMap$Builder.buildOrThrow(ImmutableMap.java:607)
	at io.trino.plugin.deltalake.metastore.glue.v1.DeltaLakeGlueV1MetastoreTableOperations.commitToExistingTable(DeltaLakeGlueV1MetastoreTableOperations.java:66)
	at io.trino.plugin.deltalake.metastore.DeltaLakeTableMetadataScheduler.updateTable(DeltaLakeTableMetadataScheduler.java:174)
	at io.trino.plugin.deltalake.metastore.DeltaLakeTableMetadataScheduler.lambda$process$1(DeltaLakeTableMetadataScheduler.java:152)
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:317)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1570)

@@ -63,7 +63,7 @@ public void commitToExistingTable(SchemaTableName schemaTableName, long version,
ImmutableMap.Builder<String, String> parameters = ImmutableMap.builder();
parameters.putAll(getTableParameters(currentTable));
parameters.putAll(tableMetadataParameters(version, schemaString, tableComment));
tableInput.withParameters(parameters.buildOrThrow());
tableInput.withParameters(parameters.buildKeepingLast());
Copy link
Member

Choose a reason for hiding this comment

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

May be we can handle it by filtering out old TRINO_LAST_TRANSACTION_VERSION from a previous step instead ?
Using buildKeepingLast relies on keys being inserted in certain order which somebody might change without knowing we relied on it to keep only latest TRINO_LAST_TRANSACTION_VERSION

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me handle in a follow-up because buildKeepingLast() is consistent with other metatore logic at this time.

@ebyhr ebyhr merged commit e13da73 into trinodb:master Aug 27, 2024
23 checks passed
@ebyhr ebyhr deleted the ebi/detla-metadata-scheduler-deprecate-key branch August 27, 2024 09:57
@github-actions github-actions bot added this to the 455 milestone Aug 27, 2024
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