-
Notifications
You must be signed in to change notification settings - Fork 204
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
Hash submitters in the deduplication key [DPP-347] #9417
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any change in com.daml.platform.store.dao
needs to be mirrored in com.daml.platform.store.appendonlydao
, can you please edit JdbcLedgerDao
there accordingly?
.update( | ||
_.commands.deduplicationTime := deduplicationTime.asProtobuf | ||
) | ||
_ <- ledger.submit(request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this test assert that the dummy contract was successfully created?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 👍
/** Postgres has a limit on the index row size of 2712. | ||
* We test that a large submitters number doesn't cause deduplication failure because of that limit. | ||
* THIS TEST CASE DOES NOT TEST ANY OTHER FAILURES THAT MAY BE CAUSED BY A LARGE SUBMITTERS NUMBER | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description is not accurate:
- The test uses the ledger API and not the internals of the indexer, so you don't really know what kind of failures it tests for.
- The description mentions a limit of Postgres, but you don't know whether the test runs against a Postgres index database.
- You are not checking any property of command deduplication, you are just submitting a request with a large number of parties. I would name the test
"Submit commands with a large number of submitters"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rautenrieth-da Thank you for the review!
I've modified the test suite according to your suggestions. I've also added a change to a database index that was blocking submissions due to index row size limits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some minor comments. You still need to do the change in com.daml.platform.store.appendonlydao
though.
_ <- ledger.submit(request) | ||
_ <- Delayed.by(1.second)(()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_ <- ledger.submit(request) | |
_ <- Delayed.by(1.second)(()) | |
_ <- ledger.submitAndWait(request) |
commands = DummyWithAnnotation(parties.head, "First submission").create.command, | ||
) | ||
.update( | ||
_.commands.deduplicationTime := deduplicationTime.asProtobuf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to set a custom deduplication time?
CHANGELOG_BEGIN - [Integration Kit] - deduplication key will contain hashed submitters instead of concatenated submitters CHANGELOG_END
Do not include submitters in the index to avoid issues with index row size limit
The suite will be restored when database index fixes for large submitters sets are implemented
f79025e
to
368b6d6
Compare
@rautenrieth-da I've adapted the PR according to your review and the discussion during the meeting.
For this PR I've replaced API-level testing with simple unit testing because it's currently impossible to make API-level tests pass without making changes to database indexes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for deduplicating the deduplication logic 🙂
|
||
"make a deduplication key with a limited length for a large number of submitters" in { | ||
val submitters = (1 to 50).map(_ => aParty()).toList | ||
val MaxKeyLength = 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This constant seems arbitrary, but the value is fine. It's smaller than the maximum length for indexed string columns in both Postgres and Oracle (which was the reason for this change). Maybe add a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point - I'll comment on motivation for this limit.
This PR has been created by a script, which is not very smart and does not have all the context. Please do double-check that the version prefix is correct before merging. @remyhaemmerle-da is in charge of this release. Commit log: ``` cf2be78 Support rollback nodes in BlindingInfo (#9445) adde90b KV: do not use "Effects" part of InputsAndEffects (#9433) 75fa86a Additional metrics for mutable contract state cache (#9444) d8c34a4 Rename normalization-related params in the integrity checker config (#9455) e335244 Hash submitters in the deduplication key [DPP-347] (#9417) 43ffa42 Test for duplicate contracts when querying on behalf of multiple parties (#9443) 7644844 Document daml ledger export script (#9446) 3193027 DPP-334 Manually partition the event table (#9394) 14661a8 Clearer variable name for subtype evidence (#9442) 40c85d8 Release v1.13.0-snapshot.20210419.6730.0.8c3a8c04 (#9439) 1cb907c KV: do not use "Inputs" part of InputsAndEffects (#9429) ``` Changelog: ``` - [Integration Kit] - deduplication key will contain hashed submitters instead of concatenated submitters * [Daml export] Refer to the "Ledger Export" chapter under the "Early Access Features" for a description of the new Daml ledger export command. This is an early access feature. ``` CHANGELOG_BEGIN CHANGELOG_END
Motivation
Submitting a command with a large number of submitters results in:
due to how we construct deduplication keys. Concatenating a large number of submitters causes exceeding Postgres limits.
Main changes
Made the deduplication key containing a hash of submitters instead of a concatenated string of submitters.
Pull Request Checklist
CHANGELOG_BEGIN
andCHANGELOG_END
tagsNOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with
/AzurePipelines run
totrigger the build.