forked from digital-asset/daml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DPP-142] Explicitly deflate/inflate data outside of the index (digit…
…al-asset#8646) * [DPP-142] Explicitly deflate/inflate data outside of the index * [DPP-142] Explicitly deflate/inflate data outside of the index - review fixes - exposing prepare update parallelism as param changelog_begin [Integration Kit] Compression and decompression of stored DAML-LF values is now executed outside of the index database, allowing to make more efficient use of the participant resources when indexing. changelog_end
- Loading branch information
1 parent
5bb3a6c
commit 77f4279
Showing
29 changed files
with
612 additions
and
127 deletions.
There are no files selected for viewing
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
1 change: 1 addition & 0 deletions
1
...tegration-api/src/main/resources/db/migration/h2database/V29__explicit_compression.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 @@ | ||
6d6c21e239c496a64e88da9ef3397219107f0aaa4ef0fc7782bdf5a18ea18f4d |
9 changes: 9 additions & 0 deletions
9
...-integration-api/src/main/resources/db/migration/h2database/V29__explicit_compression.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,9 @@ | ||
-- Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
|
||
ALTER TABLE participant_events ADD COLUMN create_argument_compression SMALLINT; | ||
ALTER TABLE participant_events ADD COLUMN create_key_value_compression SMALLINT; | ||
ALTER TABLE participant_events ADD COLUMN exercise_argument_compression SMALLINT; | ||
ALTER TABLE participant_events ADD COLUMN exercise_result_compression SMALLINT; | ||
|
||
ALTER TABLE participant_contracts ADD COLUMN create_argument_compression SMALLINT; |
1 change: 1 addition & 0 deletions
1
...integration-api/src/main/resources/db/migration/postgres/V43__explicit_compression.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 @@ | ||
ba2ec4d90b2862abcc718d7a1ce470f05ea2c55200d5d4245606e66a349fd949 |
24 changes: 24 additions & 0 deletions
24
...nt-integration-api/src/main/resources/db/migration/postgres/V43__explicit_compression.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,24 @@ | ||
-- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
|
||
-- SET STORAGE EXTERNAL is for external (from the standpoint of TOAST), uncompressed data. | ||
-- | ||
-- Note that SET STORAGE doesn't itself change anything in the table, | ||
-- it just sets the strategy to be pursued during future table updates. | ||
-- | ||
-- `SET STORAGE EXTERNAL` https://www.postgresql.org/docs/13/sql-altertable.html | ||
-- TOAST https://www.postgresql.org/docs/13/storage-toast.html | ||
|
||
ALTER TABLE participant_events | ||
ADD COLUMN create_argument_compression SMALLINT, | ||
ALTER COLUMN create_argument SET STORAGE EXTERNAL, | ||
ADD COLUMN create_key_value_compression SMALLINT, | ||
ALTER COLUMN create_key_value SET STORAGE EXTERNAL, | ||
ADD COLUMN exercise_argument_compression SMALLINT, | ||
ALTER COLUMN exercise_argument SET STORAGE EXTERNAL, | ||
ADD COLUMN exercise_result_compression SMALLINT, | ||
ALTER COLUMN exercise_result SET STORAGE EXTERNAL; | ||
|
||
ALTER TABLE participant_contracts | ||
ADD COLUMN create_argument_compression SMALLINT, | ||
ALTER COLUMN create_argument SET STORAGE EXTERNAL; |
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
41 changes: 41 additions & 0 deletions
41
...icipant-integration-api/src/main/scala/platform/store/dao/events/CompressionMetrics.scala
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,41 @@ | ||
// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.daml.platform.store.dao.events | ||
|
||
import com.codahale.metrics.Histogram | ||
import com.daml.metrics.Metrics | ||
|
||
final class CompressionMetrics( | ||
val createArgument: CompressionMetrics.Field, | ||
val createKeyValue: CompressionMetrics.Field, | ||
val exerciseArgument: CompressionMetrics.Field, | ||
val exerciseResult: CompressionMetrics.Field, | ||
) | ||
|
||
object CompressionMetrics { | ||
|
||
final class Field(val compressed: Histogram, val uncompressed: Histogram) | ||
|
||
def apply(metrics: Metrics): CompressionMetrics = { | ||
new CompressionMetrics( | ||
createArgument = new Field( | ||
compressed = metrics.daml.index.db.compression.createArgumentCompressed, | ||
uncompressed = metrics.daml.index.db.compression.createArgumentUncompressed, | ||
), | ||
createKeyValue = new Field( | ||
compressed = metrics.daml.index.db.compression.createKeyValueCompressed, | ||
uncompressed = metrics.daml.index.db.compression.createKeyValueUncompressed, | ||
), | ||
exerciseArgument = new Field( | ||
compressed = metrics.daml.index.db.compression.exerciseArgumentCompressed, | ||
uncompressed = metrics.daml.index.db.compression.exerciseArgumentUncompressed, | ||
), | ||
exerciseResult = new Field( | ||
compressed = metrics.daml.index.db.compression.exerciseResultCompressed, | ||
uncompressed = metrics.daml.index.db.compression.exerciseResultUncompressed, | ||
), | ||
) | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...cipant-integration-api/src/main/scala/platform/store/dao/events/CompressionStrategy.scala
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,30 @@ | ||
// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.daml.platform.store.dao.events | ||
|
||
import com.daml.platform.store.serialization.Compression | ||
|
||
final case class CompressionStrategy( | ||
createArgumentCompression: Compression.Algorithm, | ||
createKeyValueCompression: Compression.Algorithm, | ||
exerciseArgumentCompression: Compression.Algorithm, | ||
exerciseResultCompression: Compression.Algorithm, | ||
) | ||
|
||
object CompressionStrategy { | ||
|
||
val None: CompressionStrategy = CompressionStrategy( | ||
createArgumentCompression = Compression.Algorithm.None, | ||
createKeyValueCompression = Compression.Algorithm.None, | ||
exerciseArgumentCompression = Compression.Algorithm.None, | ||
exerciseResultCompression = Compression.Algorithm.None, | ||
) | ||
|
||
val AllGZIP: CompressionStrategy = CompressionStrategy( | ||
createArgumentCompression = Compression.Algorithm.GZIP, | ||
createKeyValueCompression = Compression.Algorithm.GZIP, | ||
exerciseArgumentCompression = Compression.Algorithm.GZIP, | ||
exerciseResultCompression = Compression.Algorithm.GZIP, | ||
) | ||
} |
Oops, something went wrong.