-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Index DB enable multiple party additions [DPP-546] (#10623)
Preparation, small fixes * Remove unnecessary TODO * Fix FieldStrategy.idempotentInsert type parameters Changing the DB-Schema This change adapts the DB schema for all supported backends. After this change we only populate the party_entries table, and on the query side we reconstruct the state from this. * Drop the party table * Add indexing to party_entries Adapting StorageBackend: ingestion Since we only ingest party_entries, the party population needs to be removed. * Drop the party table in ingestion code * Fixes test Adapting StorageBackend: queries Queries needs to be adapted to construct the state from the read side. * Rewrite queries. * Fixes reset implementations. Adapting JdbcLedgerDao Since underlying storage changed, JdbcLedgerDao can be simplified: no special treatment needed with duplicate errors, since these errors are impossible to happen. Removing JdbcLedgerDao tests, and adding a new test, testing the behavior of the new event-source party model. Please note: this database refactoring only applies to the append-only schema, so for the mutating schema the test is disabled. During implementation a bug surfaced: it was not possible anymore to store the is_local information via JdbcLedgerDao.storePartyEntry. Although this bug is a minor issue, since that method is only used from single participant environment, still a fix was also implemented for this, by passing a magic participantId upon non-local party storage. * Simplify storePartyEntry. * Fixes bug introduced by append-only. * adds/adapts tests Refactoring: remove not used duplicateKeyError from StorageBackend Changes to JdbcLedgerDao rendered this duplicateKeyError unused. * Removes unused duplicateKeyError Adapting sandbox-classic In sandbox-classic it is not allowed to have updates for parties. Essentially the updates concerning already existent parties were dropped silently with logging without effect. Here I started by pinning down this behaviour in the SqlLedgerSpec and SqlLedgerSpecAppendOnly. These tests were implemented with the original code in mind. Then adapted the SqlLedger method: making sure of uniqueness by first trying to lookup the to-be-persisted party. * Added tests grabbing a hold on original behavior * Adapted implementation to ensure same behavior Switching to correct is_local derivation for party queries as per review * Adapting implementation: switching to aggregated table and a query on that * Introducing QueryStrategy.booleanOrAggregationFunction to support Oracle * Moving party related queries to PartyStorageBackendTemplate * Fixes JdbcLedgerDaoPartiesSpec tests, and add another test case Also: * Align Update interface documentation * Switching to explicit optionality in party query implementation asa per review Co-authored-by: Simon Meier <[email protected]> CHANGELOG_BEGIN CHANGELOG_END
- Loading branch information
1 parent
b22de68
commit 640fb68
Showing
34 changed files
with
547 additions
and
342 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...n-api/src/main/resources/db/migration/h2database-appendonly/V1__Append_only_schema.sha256
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
aae0b43e4735b3ffbdb782a61bad75f741c58a282327f3d3e18b0e41da5c69f6 | ||
219563772b2b7a88b3e70f27a35c94ff7d379380a20276c654fdd3279e7a6e5e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ation-api/src/main/resources/db/migration/oracle-appendonly/V1__Append_only_schema.sha256
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
c9148396eec01471c1135ff384d0b83442442ada1d6ca12d731f8e84b6f4869f | ||
bd2c4bfb724003409c5eafdb9d62df264b7d659f6b3ae9ff5122e57366201f02 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...gration-api/src/main/resources/db/migration/postgres-appendonly/V108__drop_parties.sha256
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
726147a3db60eaf4e65a8a761e20caee0b6e89d49b2b08e1c0dfca50da11cd1f |
5 changes: 5 additions & 0 deletions
5
...ntegration-api/src/main/resources/db/migration/postgres-appendonly/V108__drop_parties.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
|
||
DROP TABLE parties; | ||
CREATE INDEX idx_party_entries_party_and_ledger_offset ON party_entries(party, ledger_offset); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.