Commit Graph

948 Commits

Author SHA1 Message Date
Remy
bffc289868
DAML-LF: deprecate Transaction.TContractId (#6223)
CHANGELOG_BEGIN
CHANGELOG_END
2020-06-04 19:13:41 +02:00
Martin Huschenbett
4a176c4f46
Sandbox: Fix build instructions in README (#6227)
CHANGELOG_BEGIN
CHANGELOG_END
2020-06-04 15:52:51 +00:00
Miklos
60b46bbe57
Expose configuration of interceptors via LedgerFactory (#6224) 2020-06-04 17:13:04 +02:00
Stephen Compall
8e3e296572
factor common structure in RawBatch.Event (#6216)
CHANGELOG_BEGIN
CHANGELOG_END
2020-06-04 09:55:28 -04:00
Stefano Baghino
003549ecbf
Introduce CLI option for input buffer size (#6211)
* Introduce CLI option for input buffer size

Also improves CLI help text for other back-pressure related options.

changelog_begin
[Sandbox] Allow to configure --input-buffer-size, which allows to tune the number of commands waiting to be submitted before the Sandbox applies back-pressure, run daml sandbox --help for more info.
changelog_end

* Update ledger/sandbox/src/main/scala/com/digitalasset/platform/sandbox/cli/Cli.scala

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-06-04 06:50:50 +00:00
Miklos
b0c1b5a2b3
Improve batched submission validation related docs (#6186) 2020-06-03 15:20:09 +02:00
Moritz Kiefer
8fa28023e2
Fix --help output for sandbox time modes (#6206)
changelog_begin
changelog_end
2020-06-03 12:30:29 +02:00
Leonid Shlyapnikov
1386abc05a
move event witnesses directly into the participant_events table (#6172)
* events denormalization, WIP

* too soon to drop

* migration script

* add generated sha256 digest

* fixing the migration script naming

has to be double undescore after the version number

* flat event table queries

* write witnesses to events table during insert; disable inserts to witnesses tables

* use varchar[] for new witness columns instead of text[]

* ::varchar[] cast

* remove event witnesses table support code

* lookupFlatTransactionById works for postgres

* lookupTransactionTreeById works with postgres

* fixing the queries, replacing @> with &&

* cleanup

* multi-party postgres queries, WIP

* fixing multi-party queries, thanks @stefano.baghino

* fixing wildcardParties query

* minor cleanup

* h2 schema changes, h2 queries is WIP

* inlining some constants

* SqlFunctions introduced

* reformat

* Adding `SqlFunctions.arrayIntersectionValues`

* Adding `SqlFunctions.arrayIntersectionValues`

* Removing truncates for deleted tables

* Removing truncates for deleted tables

* filtering tree_event_witnesses

Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2020-06-03 10:38:13 +02:00
Robert Autenrieth
dde5af0804
Add collectd metrics (#6189)
* Add collectd metrics

CHANGELOG_BEGIN
CHANGELOG_END

* Remove useless file

* Fix typo
2020-06-03 09:01:09 +02:00
Stephen Compall
39dc5aa88b
replace NodeExercises#controllers with controllersDifferFromActors boolean (#6073)
* replace NodeExercises#controllers with controllersDifferFromActors

* remove controllers from ActorMismatch and scenario service exercise

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* remove reserved ID #s in scenario-service grpc

As discussed, we don't need to worry about
version mismatches.

Co-authored-by: Remy <remy.haemmerle@daml.com>
2020-06-02 13:43:47 -04:00
Miklos
5be061c2ef
Enable caching of immutable state values only (#6187)
* Moved caching related classes to under validator.caching package.

* Introduced CacheUpdatePolicy for controlling what type of state keys should be updated in the cache and when.

* Consistently use 'cache update policy'.
CHANGELOG_BEGIN
CHANGELOG_END

* Made it explicit what policy we are testing against.
2020-06-02 16:50:39 +00:00
Miklos
cb4917c812
Do not write output key whose value is identical to input (#6166)
CHANGELOG_BEGIN
* [kvutils] Do not commit output keys whose value is identical to input
CHANGELOG_END
2020-06-02 14:58:30 +02:00
Leonid Shlyapnikov
e097cf410b
Making PaginatingAsyncStream.streamFrom more generic (#6170)
* Making `PaginatingAsyncStream.streamFrom` more generic

so it does not specify what exactly `Offset` is.

changelog_begin
changelog_end

* Addressing code review comments + cleanup
2020-05-29 19:57:04 +00:00
Gerolf Seitz
e71e8e862d
Add LF value translation cache to Sandbox Classic (#6164)
* Add LF value translation cache to Sandbox Classic

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-29 19:00:58 +02:00
Gerolf Seitz
070bd18951
More detailed store transaction metrics (#6163)
* Add additional metrics when storing transactions

Since event witnesses will soon be denormalized into the participant_events
table, I did not include metrics right now.

CHANGELOG_BEGIN
[DAML Ledger Integration Kit] Add additional metrics for storing transactions. The overall time is measured by ``daml.index.db.store_ledger_entry``.
- Timer ``daml.index.db.store_ledger_entry.prepare_batches``: measures the time for preparing batch insert/delete statements
- Timer ``daml.index.db.store_ledger_entry.events_batch``: measures the time for inserting events
- Timer ``daml.index.db.store_ledger_entry.delete_contract_witnesses_batch``:  measures the time for deleting contract witnesses
- Timer ``daml.index.db.store_ledger_entry.delete_contracts_batch``: measures the time for deleting contracts
- Timer ``daml.index.db.store_ledger_entry.insert_contracts_batch``: measures the time for inserting contracts
- Timer ``daml.index.db.store_ledger_entry.insert_contract_witnesses_batch``: measures the time for inserting contract witnesses
- Timer ``daml.index.db.store_ledger_entry.insert_completion``: measures the time for inserting the completion
- Timer ``daml.index.db.store_ledger_entry.update_ledger_end``: measures the time for updating the ledger end
[Sandbox Classic] Added Timer ``daml.index.db.store_ledger_entry.commit_validation``: measure the time for commit validation in Sandbox Classic

CHANGELOG_END

* Refactoring: rename metrics *dao to *DbMetrics
2020-05-29 18:19:54 +02:00
Leonid Shlyapnikov
12c05c408a
Experiment: replacing row OFFSET with ledger offset (#6083)
* Experiment: replacing row OFFSET with ledger offset in the flat transactions query for one party.

if this improves the perf numbers, the rest of the queries can be updated.

* Flat transaction query optimization:

replacing row offset with ledger offset

* Flat transaction query optimization:

replacing row offset with ledger offset

* transaction tree query optimization

changelog_begin

[Sandbox-next/Postgres]
Flat Transaction Stream, Transaction Tree Stream SQL query optimizations.
Pagination based on Ledger Offset instead of SQL Row Offset.

changelog_end

* Addressing code review comments
2020-05-29 11:49:46 -04:00
Miklos
655c0a5425
Fix flaky tests for ledger-on-memory (#6160) 2020-05-29 15:33:10 +02:00
Martin Huschenbett
9d955d7039
Expose the DAML profiler in Sandbox Classic (#6151)
* Expose the DAML profiler in Sandbox Classic

This PR adds an option `--profile-dir` to Sandbox Classic which takes
a directory as its argument. When this option is used, all command
submissions to the Sandbox are run in profiling more and the resulting
profiling information is written to the directory specified via
`--profile-dir`. See `/ledger/sandbox/README.md#Profiling` for further
details on this.

CHANGELOG_BEGIN
CHANGELOG_END

* Adapt DAML-LF REPL

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-29 15:00:40 +02:00
Gerolf Seitz
c423f58f39
Collect active contract lookup time per execution (#6161)
CHANGELOG_BEGIN
[DAML Ledger Integration Kit]: Added 4 new metrics for more detailed execution time statistics:
- Timer ``daml.execution.lookup_active_contract_per_execution``: measures the accumulated time spent for looking up active contracts per execution
- Histogram ``daml.execution.lookup_active_contract_count_per_execution``: measures the number of active contract lookups per execution
- Timer ``daml.execution.lookup_contract_key_per_execution``: measures the accumulated time spent for looking up contract keys per execution
- Histogram ``daml.execution.lookup_contract_key_count_per_execution``: measures the number of contract key lookups per execution
CHANGELOG_END
2020-05-29 14:34:07 +02:00
Miklos
404d043b22
Fix metrics for parallel validator (#6145) 2020-05-29 12:29:52 +02:00
Stephen Compall
15350a7bc2
disable warts.Any and remove most suppressions (#6132)
* disable Any wart

* first pass removal of Any suppressions for false positives

* second pass removal of Any suppressions for false positives

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* third pass removal of Any suppressions for false positives

* fourth pass removal of Any suppressions for false positives

* reformat newly single-suppressions into single lines

- suggested by @SamirTalwar-DA; thanks
2020-05-28 16:53:41 +00:00
Robert Autenrieth
28251ba296
Don't store archived divulged contracts (#6139)
* Don't store archived divulged contracts

Specifically, don't keep contracts that
have been divulged AND archived
in the same transaction.

Even if the archival of a divulged contract
might not be visible to all locally hosted
parties, the ledger would reject all
commands that try to use archived
contracts anyway.

CHANGELOG_BEGIN
CHANGELOG_END

* Add test

* Fix compile error
2020-05-28 15:10:08 +02:00
Miklos
39daca8b82
Dropped 'Batched' infix from all ledger-on-memory class names. (#6141) 2020-05-28 13:51:46 +02:00
Miklos
6108c922c6
Support parallel validation for ledger-on-memory (#6111) 2020-05-28 11:11:47 +02:00
Remy
3f29ac84f0
DAML-LF: cleanup last refs to Absolute Contract IDs (#6126)
follow up of #5991

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-27 18:05:48 +02:00
Miklos
895a709498
Standardize command-line parameter for max inbound message size (#6093) 2020-05-27 11:55:49 +02:00
Stefano Baghino
acc5a21c59
Fix issues cause by migration V25 and V26 (#6107)
* Fix issues cause by migration V25 and V26

Fixes #6017

Please note that migrating sandbox-classic from version 1.0.0 to 1.1.1 will cause
undefined behavior if the result is used to back a running ledger setup.

No migration should end at 1.1.1 and they should move past that until the version
that applies this fix to make sure the index database is in a consistent state.

Full write-up on the issue here: https://github.com/digital-asset/daml/issues/6017#issuecomment-634040972

changelog_begin
[Sandbox Classic] Fix issue in migrating to version 1.1.1. If you did migrate to
version 1.1.1, do not use the resulting setup but make sure to migrate until this
version, which fixes the issue
See https://github.com/digital-asset/daml/issues/6017
changelog_end

* Add trailing newline

* Fix wrong hash for migration

* Address https://github.com/digital-asset/daml/pull/6107#discussion_r430469918
2020-05-27 08:37:58 +02:00
Leonid Shlyapnikov
937aa88ce7
transaction stream dashboard (#6059)
changelog_begin
changelog_end
2020-05-26 21:07:49 -04:00
Simon Maxen
cfec886e71
Ensure that on first call to ReadService.stateUpdates beginOffset is … (#6103)
* Ensure that on first call to ReadService.stateUpdates beginOffset is None

Fixes #6023

CHANGELOG_BEGIN
CHANGELOG_END

Also restores correct advice in CONTRIBUTING.md

* Update with review comments
2020-05-26 17:36:02 +01:00
Stefano Baghino
9af85e56e9
Introduce DAML-LF value caching for transaction service (#6052)
* Introduce DAML-LF value caching for transaction service

Allows to keep the DAML-LF values in the most recently indexed events in memory,
so that they don't have to be deserialized on the client from their Protobuf encoding.

Closes #6044

CHANGELOG_BEGIN
[Sandbox] The --max-lf-value-translation-cache-entries option allows to set a
number of events for which DAML-LF values are cached. Could reduce latency in
serving transactions for consumers that are reasonably fast.
CHANGELOG_END

* Add missing dependency

* Address https://github.com/digital-asset/daml/pull/6052#discussion_r428076003

* Update ledger/sandbox/src/main/scala/com/digitalasset/platform/sandboxnext/Runner.scala

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>

* Address https://github.com/digital-asset/daml/pull/6052#discussion_r428071324

* Address https://github.com/digital-asset/daml/pull/6052#discussion_r428076905

* Address https://github.com/digital-asset/daml/pull/6052#discussion_r428081294

* Fix fatal warnings

* //ledger/caching has to be used whenever sandbox is run

Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-05-26 08:33:53 +00:00
Remy
9e456a1016
DAML-LF: Kill RelativeContractId (#5991)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-25 22:30:45 +02:00
Miklos
9a0cce155e
Introduce batched submission validator (#6004) 2020-05-25 18:25:10 +02:00
Miklos
32625da92f
Pass on command ID as correlation ID for transaction submissions (#6051)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-20 17:51:03 +02:00
Stefano Baghino
6f1e051648
Integrate metrics for cache (#6043)
* Integrate metrics for cache

Centralizes the creation of instrumented caches in a single point and adds
metrics coming from Caffeine into the mix.

changelog_begin
[Ledger API Server] if --max-state-value-cache-size is greater than zero, the
following additional metrics will be recorded under the daml.kvutils.submission.validator.state_value_cache namespace:
hits, misses, load_successes, load_failures, load_total_time, evictions and evicted_weight
changelog_end

* Fix Bazel build file formatting

* Address https://github.com/digital-asset/daml/pull/6043#discussion_r427902339

* Address https://github.com/digital-asset/daml/pull/6043#discussion_r427904794

* Review DropwizardStatsCounter

- address https://github.com/digital-asset/daml/pull/6043#discussion_r427905074
- address https://github.com/digital-asset/daml/pull/6043#discussion_r427905184
- address https://github.com/digital-asset/daml/pull/6043#discussion_r427905307
- address https://github.com/digital-asset/daml/pull/6043#discussion_r427905387
- address https://github.com/digital-asset/daml/pull/6043#discussion_r427905650

* Address https://github.com/digital-asset/daml/pull/6043#discussion_r427906243

* Fix implicit numeric widening fatal warning

* Address https://github.com/digital-asset/daml/pull/6043#discussion_r427960762

* Fix infinite loop in metrics
2020-05-20 15:51:45 +02:00
Stephen Compall
d7cc5e07c3
fix ACS race condition in sandbox-classic; enable random Websocket testing (#5969)
* Revert "disable test pending tracking down duplicates"

This reverts commit 8b5f9dfa04.

* activeContracts tells caller the ledgerEnd, rather than accepting activeAt argument

* naive port of http-json tests to sandbox-next

* Revert "naive port of http-json tests to sandbox-next"

This reverts commit 91d4590c90.

* lock before grabbing acs and ledgerEnd offset in InMemoryLedger

- as suggested by @gerolf-da; thanks
2020-05-19 13:26:37 -04:00
Stefano Baghino
53a7e28126
Document CommandConfiguration (#6031)
changelog_begin
changelog_end
2020-05-19 15:33:38 +00:00
Samir Talwar
5915dc158d
Create a Docker image for Sandbox Next. (#6019)
This image can be built with:

```
bazel run //ledger/sandbox:sandbox-next-image
```

This will, unfortunately, also run a container, which you will need to
kill with _Ctrl+C_. You can use `bazel build`, but this will only build
the image tarballs, which you need to import into your Docker image
repository yourself.

CHANGELOG_BEGIN
CHANGELOG_END
2020-05-19 13:11:45 +00:00
Samir Talwar
d76c4ec949
ledger-api-client: Make it Closeable. (#6014)
CHANGELOG_BEGIN
- Add `LedgerClient#close`, which will shut down the channel and await
  termination. This is optional; the channel will still be shut down on
  JVM exit if this method is not called.
CHANGELOG_END

This is offered as a compromise for those who would like to ensure
resources are shut down cleanly, while not making the API more
complicated. I originally wanted to make `LedgerClient.fromBuilder`
return a `Resource[LedgerClient]`, but the `Resource` API would lead to
an increased learning curve for users.
2020-05-19 08:09:01 +00:00
Oliver Seeliger
c0af52950c
Fix ledger api test tool multi-node CommandService test flake (#5998)
by adding synchronize call between an alpha-participant-create and the
corresponding beta-participant-exercise.

changelog_begin
changelog_end

We occasionally run into this in Canton
2020-05-15 13:41:57 +02:00
Samir Talwar
8cd3cc414e
ledger/metrics: Display graphs with counts alongside mean timings. (#5994)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-15 08:44:34 +00:00
Stefano Baghino
be914d3b26
Measure translation time for full result from DB (#5983)
Furthermore, uses a work stealing thread pool for work JdbcLedgerDao has
to perform outside of the database thread pool. This solves some
flakiness observed in conformance tests against PostgreSQL-backed
ledgers.

changelog_begin
changelog_end
2020-05-15 09:02:02 +02:00
Remy
3eed4d1a22
Ledger: remove all reference to RelativeContractId (#5985)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-14 19:12:32 +02:00
Gerolf Seitz
a4f75c3cef
Fix quadratic runtime when reading events (#5981)
Fixes #5980.

CHANGELOG_BEGIN
[Sandbox] Improved performance when loading transactions with many
events. See `issue #5980
<https://github.com/digital-asset/daml/issues/5980>`__.
CHANGELOG_END
2020-05-14 13:31:15 +00:00
Samir Talwar
57a8d0b37e
CI: Run PostgreSQL once for all Scala tests. (#5919) 2020-05-14 09:06:34 +02:00
Remy
deedec9b9f
Engine: Remove optionality of contract ID Seeding. (#5966)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-13 20:29:14 +02:00
Remy
9019b3a33c
Ledger: Remove optionality of contract ID seeding. (#5965)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-13 17:39:07 +02:00
Stefano Baghino
b0ad8d7a60
Centralize and time serialization (#5946)
changelog_begin
OVERRIDES CHANGELOG ENTRY FROM 2a8c93a614
[Ledger Integration Kit] Added new metrics for
``daml.index.db.*.translation`` to measure the time spent
translating to and from the serialized DAML-LF values when
fetched from the participant index.
changelog_end
2020-05-13 17:06:46 +02:00
Stefano Baghino
e39adbe69e
Cleanup: move unused translation helpers to migrations (#5963)
* Cleanup: move unused translation helpers to migrations

These helpers are no longer used in the main source tree.

changelog_begin
changelog_end

* Address https://github.com/digital-asset/daml/pull/5963#discussion_r424415151
2020-05-13 16:35:05 +02:00
Oliver Seeliger
cc880e290b
Port PerformanceEnvelope.TransactionSize perf test from Canton (#5955)
* Port PerformanceEnvelope.TransactionSize perf test from Canton

to LedgerApiTestTool --perf-tests

changelog_begin
[Ledger Api Test Tool] Added the TransactionSize performance benchmark test.
changelog_end

* Review feedback from Samir

* Formatting
2020-05-13 12:03:46 +00:00
Remy
021f4af394
Sandbox classic: Emulate legacy contract ID scheme (#5929)
CHANGELOG_BEGIN
CHANGELOG_END
2020-05-13 12:56:41 +02:00