daml/ledger/ledger-on-sql/BUILD.bazel

304 lines
11 KiB
Python
Raw Normal View History

# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_binary",
"da_scala_library",
"da_scala_test_suite",
)
load("//ledger/ledger-api-test-tool:conformance.bzl", "conformance_test")
supported_databases = [
{
ledger-on-sql: Get H2 working in the conformance tests. (#4155) * kvutils: Make logback.xml a base file, rather than the only option. * kvutils/app: Simplify logback.base.xml. Mostly by getting rid of unnecessary appenders. * ledger-on-sql: Add trace logging for all database work. * Upgrade H2; there's a few useful bug fixes. * kvutils/app: Let the user override the server JDBC URL. * kvutils/app: Provide a way to specify the ledger ID. * ledger-on-sql: If there are missing entries in the log, fail on read. This can happen right now because we insert in parallel. Next step: stop doing that. * ledger-on-sql: Stop writing in parallel; it causes race conditions. This unfortunately means we also stop _reading_ in parallel, which is less fun. * Revert "ledger-on-sql: Use a sequential log entry ID." This reverts commit c58265bf43b96d16bfa62ed30a795f365b1e83f2. * ledger-on-sql: Create tables with columns that are not nullable. * ledger-on-sql: The H2 conformance tests now work, just slowly. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Run tests against H2 and SQLite on memory and disk. * ledger-on-sql: Allow H2 to read from the log in parallel with writes. * ledger-on-sql: Use UUIDs for entry IDs, not 8 random bytes. * ledger-on-sql: Make sure to log the correlation ID. * ledger-on-sql: Do less while holding a database connection. * ledger-on-sql: Log the connection. * ledger-on-sql: We don't need to tell H2 not to drop the connection. The connection pool takes care of that. * ledger-on-sql: Disable H2 conformance tests on CI; they're too slow. * ledger-on-sql: Rename `loggingContext` to `logCtx`. * ledger-on-sql: Don't abuse log contexts; put the data in the message. * ledger-on-sql: Make the connection log line easier to read. And pull out the logger, even if it's only used once. * ledger-on-sql: Run the unit tests against (H2, SQLite) * (memory, file).
2020-01-22 18:54:51 +03:00
"name": "h2-memory",
"runtime_deps": [
"@maven//:com_h2database_h2",
],
"conformance_test_tags": [
"manual",
],
"conformance_test_server_args": [
ledger-on-sql: Get H2 working in the conformance tests. (#4155) * kvutils: Make logback.xml a base file, rather than the only option. * kvutils/app: Simplify logback.base.xml. Mostly by getting rid of unnecessary appenders. * ledger-on-sql: Add trace logging for all database work. * Upgrade H2; there's a few useful bug fixes. * kvutils/app: Let the user override the server JDBC URL. * kvutils/app: Provide a way to specify the ledger ID. * ledger-on-sql: If there are missing entries in the log, fail on read. This can happen right now because we insert in parallel. Next step: stop doing that. * ledger-on-sql: Stop writing in parallel; it causes race conditions. This unfortunately means we also stop _reading_ in parallel, which is less fun. * Revert "ledger-on-sql: Use a sequential log entry ID." This reverts commit c58265bf43b96d16bfa62ed30a795f365b1e83f2. * ledger-on-sql: Create tables with columns that are not nullable. * ledger-on-sql: The H2 conformance tests now work, just slowly. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Run tests against H2 and SQLite on memory and disk. * ledger-on-sql: Allow H2 to read from the log in parallel with writes. * ledger-on-sql: Use UUIDs for entry IDs, not 8 random bytes. * ledger-on-sql: Make sure to log the correlation ID. * ledger-on-sql: Do less while holding a database connection. * ledger-on-sql: Log the connection. * ledger-on-sql: We don't need to tell H2 not to drop the connection. The connection pool takes care of that. * ledger-on-sql: Disable H2 conformance tests on CI; they're too slow. * ledger-on-sql: Rename `loggingContext` to `logCtx`. * ledger-on-sql: Don't abuse log contexts; put the data in the message. * ledger-on-sql: Make the connection log line easier to read. And pull out the logger, even if it's only used once. * ledger-on-sql: Run the unit tests against (H2, SQLite) * (memory, file).
2020-01-22 18:54:51 +03:00
"--jdbc-url=jdbc:h2:mem:daml-on-sql-conformance-test",
],
"conformance_test_tool_args": [
"--concurrent-test-runs=2",
"--timeout-scale-factor=4",
],
},
{
ledger-on-sql: Get H2 working in the conformance tests. (#4155) * kvutils: Make logback.xml a base file, rather than the only option. * kvutils/app: Simplify logback.base.xml. Mostly by getting rid of unnecessary appenders. * ledger-on-sql: Add trace logging for all database work. * Upgrade H2; there's a few useful bug fixes. * kvutils/app: Let the user override the server JDBC URL. * kvutils/app: Provide a way to specify the ledger ID. * ledger-on-sql: If there are missing entries in the log, fail on read. This can happen right now because we insert in parallel. Next step: stop doing that. * ledger-on-sql: Stop writing in parallel; it causes race conditions. This unfortunately means we also stop _reading_ in parallel, which is less fun. * Revert "ledger-on-sql: Use a sequential log entry ID." This reverts commit c58265bf43b96d16bfa62ed30a795f365b1e83f2. * ledger-on-sql: Create tables with columns that are not nullable. * ledger-on-sql: The H2 conformance tests now work, just slowly. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Run tests against H2 and SQLite on memory and disk. * ledger-on-sql: Allow H2 to read from the log in parallel with writes. * ledger-on-sql: Use UUIDs for entry IDs, not 8 random bytes. * ledger-on-sql: Make sure to log the correlation ID. * ledger-on-sql: Do less while holding a database connection. * ledger-on-sql: Log the connection. * ledger-on-sql: We don't need to tell H2 not to drop the connection. The connection pool takes care of that. * ledger-on-sql: Disable H2 conformance tests on CI; they're too slow. * ledger-on-sql: Rename `loggingContext` to `logCtx`. * ledger-on-sql: Don't abuse log contexts; put the data in the message. * ledger-on-sql: Make the connection log line easier to read. And pull out the logger, even if it's only used once. * ledger-on-sql: Run the unit tests against (H2, SQLite) * (memory, file).
2020-01-22 18:54:51 +03:00
"name": "h2-file",
"runtime_deps": [
"@maven//:com_h2database_h2",
],
ledger-on-sql: Get H2 working in the conformance tests. (#4155) * kvutils: Make logback.xml a base file, rather than the only option. * kvutils/app: Simplify logback.base.xml. Mostly by getting rid of unnecessary appenders. * ledger-on-sql: Add trace logging for all database work. * Upgrade H2; there's a few useful bug fixes. * kvutils/app: Let the user override the server JDBC URL. * kvutils/app: Provide a way to specify the ledger ID. * ledger-on-sql: If there are missing entries in the log, fail on read. This can happen right now because we insert in parallel. Next step: stop doing that. * ledger-on-sql: Stop writing in parallel; it causes race conditions. This unfortunately means we also stop _reading_ in parallel, which is less fun. * Revert "ledger-on-sql: Use a sequential log entry ID." This reverts commit c58265bf43b96d16bfa62ed30a795f365b1e83f2. * ledger-on-sql: Create tables with columns that are not nullable. * ledger-on-sql: The H2 conformance tests now work, just slowly. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Run tests against H2 and SQLite on memory and disk. * ledger-on-sql: Allow H2 to read from the log in parallel with writes. * ledger-on-sql: Use UUIDs for entry IDs, not 8 random bytes. * ledger-on-sql: Make sure to log the correlation ID. * ledger-on-sql: Do less while holding a database connection. * ledger-on-sql: Log the connection. * ledger-on-sql: We don't need to tell H2 not to drop the connection. The connection pool takes care of that. * ledger-on-sql: Disable H2 conformance tests on CI; they're too slow. * ledger-on-sql: Rename `loggingContext` to `logCtx`. * ledger-on-sql: Don't abuse log contexts; put the data in the message. * ledger-on-sql: Make the connection log line easier to read. And pull out the logger, even if it's only used once. * ledger-on-sql: Run the unit tests against (H2, SQLite) * (memory, file).
2020-01-22 18:54:51 +03:00
"conformance_test_tags": [
"manual",
],
"conformance_test_server_main": "com.daml.ledger.on.sql.MainWithEphemeralDirectory",
"conformance_test_server_args": [
"--jdbc-url=jdbc:h2:%DIR/test",
],
"conformance_test_tool_args": [
"--concurrent-test-runs=2",
"--timeout-scale-factor=4",
],
},
{
"name": "postgresql",
ledger-on-sql: Get H2 working in the conformance tests. (#4155) * kvutils: Make logback.xml a base file, rather than the only option. * kvutils/app: Simplify logback.base.xml. Mostly by getting rid of unnecessary appenders. * ledger-on-sql: Add trace logging for all database work. * Upgrade H2; there's a few useful bug fixes. * kvutils/app: Let the user override the server JDBC URL. * kvutils/app: Provide a way to specify the ledger ID. * ledger-on-sql: If there are missing entries in the log, fail on read. This can happen right now because we insert in parallel. Next step: stop doing that. * ledger-on-sql: Stop writing in parallel; it causes race conditions. This unfortunately means we also stop _reading_ in parallel, which is less fun. * Revert "ledger-on-sql: Use a sequential log entry ID." This reverts commit c58265bf43b96d16bfa62ed30a795f365b1e83f2. * ledger-on-sql: Create tables with columns that are not nullable. * ledger-on-sql: The H2 conformance tests now work, just slowly. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Run tests against H2 and SQLite on memory and disk. * ledger-on-sql: Allow H2 to read from the log in parallel with writes. * ledger-on-sql: Use UUIDs for entry IDs, not 8 random bytes. * ledger-on-sql: Make sure to log the correlation ID. * ledger-on-sql: Do less while holding a database connection. * ledger-on-sql: Log the connection. * ledger-on-sql: We don't need to tell H2 not to drop the connection. The connection pool takes care of that. * ledger-on-sql: Disable H2 conformance tests on CI; they're too slow. * ledger-on-sql: Rename `loggingContext` to `logCtx`. * ledger-on-sql: Don't abuse log contexts; put the data in the message. * ledger-on-sql: Make the connection log line easier to read. And pull out the logger, even if it's only used once. * ledger-on-sql: Run the unit tests against (H2, SQLite) * (memory, file).
2020-01-22 18:54:51 +03:00
"runtime_deps": [
"@maven//:org_postgresql_postgresql",
ledger-on-sql: Get H2 working in the conformance tests. (#4155) * kvutils: Make logback.xml a base file, rather than the only option. * kvutils/app: Simplify logback.base.xml. Mostly by getting rid of unnecessary appenders. * ledger-on-sql: Add trace logging for all database work. * Upgrade H2; there's a few useful bug fixes. * kvutils/app: Let the user override the server JDBC URL. * kvutils/app: Provide a way to specify the ledger ID. * ledger-on-sql: If there are missing entries in the log, fail on read. This can happen right now because we insert in parallel. Next step: stop doing that. * ledger-on-sql: Stop writing in parallel; it causes race conditions. This unfortunately means we also stop _reading_ in parallel, which is less fun. * Revert "ledger-on-sql: Use a sequential log entry ID." This reverts commit c58265bf43b96d16bfa62ed30a795f365b1e83f2. * ledger-on-sql: Create tables with columns that are not nullable. * ledger-on-sql: The H2 conformance tests now work, just slowly. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Run tests against H2 and SQLite on memory and disk. * ledger-on-sql: Allow H2 to read from the log in parallel with writes. * ledger-on-sql: Use UUIDs for entry IDs, not 8 random bytes. * ledger-on-sql: Make sure to log the correlation ID. * ledger-on-sql: Do less while holding a database connection. * ledger-on-sql: Log the connection. * ledger-on-sql: We don't need to tell H2 not to drop the connection. The connection pool takes care of that. * ledger-on-sql: Disable H2 conformance tests on CI; they're too slow. * ledger-on-sql: Rename `loggingContext` to `logCtx`. * ledger-on-sql: Don't abuse log contexts; put the data in the message. * ledger-on-sql: Make the connection log line easier to read. And pull out the logger, even if it's only used once. * ledger-on-sql: Run the unit tests against (H2, SQLite) * (memory, file).
2020-01-22 18:54:51 +03:00
],
"conformance_test_server_main": "com.daml.ledger.on.sql.MainWithEphemeralPostgresql",
ledger-on-sql: Get H2 working in the conformance tests. (#4155) * kvutils: Make logback.xml a base file, rather than the only option. * kvutils/app: Simplify logback.base.xml. Mostly by getting rid of unnecessary appenders. * ledger-on-sql: Add trace logging for all database work. * Upgrade H2; there's a few useful bug fixes. * kvutils/app: Let the user override the server JDBC URL. * kvutils/app: Provide a way to specify the ledger ID. * ledger-on-sql: If there are missing entries in the log, fail on read. This can happen right now because we insert in parallel. Next step: stop doing that. * ledger-on-sql: Stop writing in parallel; it causes race conditions. This unfortunately means we also stop _reading_ in parallel, which is less fun. * Revert "ledger-on-sql: Use a sequential log entry ID." This reverts commit c58265bf43b96d16bfa62ed30a795f365b1e83f2. * ledger-on-sql: Create tables with columns that are not nullable. * ledger-on-sql: The H2 conformance tests now work, just slowly. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Run tests against H2 and SQLite on memory and disk. * ledger-on-sql: Allow H2 to read from the log in parallel with writes. * ledger-on-sql: Use UUIDs for entry IDs, not 8 random bytes. * ledger-on-sql: Make sure to log the correlation ID. * ledger-on-sql: Do less while holding a database connection. * ledger-on-sql: Log the connection. * ledger-on-sql: We don't need to tell H2 not to drop the connection. The connection pool takes care of that. * ledger-on-sql: Disable H2 conformance tests on CI; they're too slow. * ledger-on-sql: Rename `loggingContext` to `logCtx`. * ledger-on-sql: Don't abuse log contexts; put the data in the message. * ledger-on-sql: Make the connection log line easier to read. And pull out the logger, even if it's only used once. * ledger-on-sql: Run the unit tests against (H2, SQLite) * (memory, file).
2020-01-22 18:54:51 +03:00
},
{
"name": "sqlite-memory",
"runtime_deps": [
"@maven//:org_xerial_sqlite_jdbc",
],
"conformance_test_server_args": [
"--jdbc-url=jdbc:sqlite:file:daml-on-sql-conformance-test?mode=memory&cache=shared",
],
ledger-on-sql: Get H2 working in the conformance tests. (#4155) * kvutils: Make logback.xml a base file, rather than the only option. * kvutils/app: Simplify logback.base.xml. Mostly by getting rid of unnecessary appenders. * ledger-on-sql: Add trace logging for all database work. * Upgrade H2; there's a few useful bug fixes. * kvutils/app: Let the user override the server JDBC URL. * kvutils/app: Provide a way to specify the ledger ID. * ledger-on-sql: If there are missing entries in the log, fail on read. This can happen right now because we insert in parallel. Next step: stop doing that. * ledger-on-sql: Stop writing in parallel; it causes race conditions. This unfortunately means we also stop _reading_ in parallel, which is less fun. * Revert "ledger-on-sql: Use a sequential log entry ID." This reverts commit c58265bf43b96d16bfa62ed30a795f365b1e83f2. * ledger-on-sql: Create tables with columns that are not nullable. * ledger-on-sql: The H2 conformance tests now work, just slowly. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Run tests against H2 and SQLite on memory and disk. * ledger-on-sql: Allow H2 to read from the log in parallel with writes. * ledger-on-sql: Use UUIDs for entry IDs, not 8 random bytes. * ledger-on-sql: Make sure to log the correlation ID. * ledger-on-sql: Do less while holding a database connection. * ledger-on-sql: Log the connection. * ledger-on-sql: We don't need to tell H2 not to drop the connection. The connection pool takes care of that. * ledger-on-sql: Disable H2 conformance tests on CI; they're too slow. * ledger-on-sql: Rename `loggingContext` to `logCtx`. * ledger-on-sql: Don't abuse log contexts; put the data in the message. * ledger-on-sql: Make the connection log line easier to read. And pull out the logger, even if it's only used once. * ledger-on-sql: Run the unit tests against (H2, SQLite) * (memory, file).
2020-01-22 18:54:51 +03:00
},
{
"name": "sqlite-file",
"runtime_deps": [
"@maven//:org_xerial_sqlite_jdbc",
],
ledger-on-sql: Get H2 working in the conformance tests. (#4155) * kvutils: Make logback.xml a base file, rather than the only option. * kvutils/app: Simplify logback.base.xml. Mostly by getting rid of unnecessary appenders. * ledger-on-sql: Add trace logging for all database work. * Upgrade H2; there's a few useful bug fixes. * kvutils/app: Let the user override the server JDBC URL. * kvutils/app: Provide a way to specify the ledger ID. * ledger-on-sql: If there are missing entries in the log, fail on read. This can happen right now because we insert in parallel. Next step: stop doing that. * ledger-on-sql: Stop writing in parallel; it causes race conditions. This unfortunately means we also stop _reading_ in parallel, which is less fun. * Revert "ledger-on-sql: Use a sequential log entry ID." This reverts commit c58265bf43b96d16bfa62ed30a795f365b1e83f2. * ledger-on-sql: Create tables with columns that are not nullable. * ledger-on-sql: The H2 conformance tests now work, just slowly. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Run tests against H2 and SQLite on memory and disk. * ledger-on-sql: Allow H2 to read from the log in parallel with writes. * ledger-on-sql: Use UUIDs for entry IDs, not 8 random bytes. * ledger-on-sql: Make sure to log the correlation ID. * ledger-on-sql: Do less while holding a database connection. * ledger-on-sql: Log the connection. * ledger-on-sql: We don't need to tell H2 not to drop the connection. The connection pool takes care of that. * ledger-on-sql: Disable H2 conformance tests on CI; they're too slow. * ledger-on-sql: Rename `loggingContext` to `logCtx`. * ledger-on-sql: Don't abuse log contexts; put the data in the message. * ledger-on-sql: Make the connection log line easier to read. And pull out the logger, even if it's only used once. * ledger-on-sql: Run the unit tests against (H2, SQLite) * (memory, file).
2020-01-22 18:54:51 +03:00
"conformance_test_server_main": "com.daml.ledger.on.sql.MainWithEphemeralDirectory",
"conformance_test_server_args": [
"--jdbc-url=jdbc:sqlite:%DIR/test.sqlite",
],
},
]
ledger-on-sql: Migrate tables using Flyway. (#4232) * ledger-on-sql: Pull out a superclass for the various integration tests. * ledger-on-sql: Use Flyway to migrate tables in an idempotent manner. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Make it easy to run it with Bazel for experimentation. * ledger-on-sql: Test that migrations will never change in the future. * ledger-on-sql: Add a prefix of "ledger_" to the tables. This is so we don't accidentally conflict with the index when the schemas are shared. I am letting myself modify the migrations because the existing migrations haven't been merged into `master` yet. * ledger-on-sql: Explain why we change the pool size after migration. * ledger-api-test-tool: Tests now specify a timeout scale, not a timeout. Makes it easier to change the default timeout in one place. * ledger-api-test-tool: Increase timeouts on slow tests. These tests produce a lot of volume and can make CI flaky. * ledger-on-sql: Only tear down PostgreSQL in tests. For other databases, we just create a new file for each test case. * ledger-on-sql: Reduce the log output in tests. * ledger-on-sql: Use a separate connection pool for Flyway when possible. Apparently `setMaximumPoolSize` doesn't really have the desired effect after the connection pool has already been used. The new test case will be flaky if we process more than one commit in parallel. For SQLite, it seems to be OK. * ledger-on-sql: Use a separate connection pool for Flyway with SQLite. Except in memory. * ledger-on-sql: Use a separate PostgreSQL database for each test. Because performance, innit. Don't have to tear them down. * ledger-on-sql: Move the `Queries` values inside the `RDBMS` objects. * ledger-on-sql: Go into even more detail about pool size hijinks. Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-28 19:16:23 +03:00
all_database_runtime_deps = {dep: None for db in supported_databases for dep in db["runtime_deps"]}.keys()
da_scala_library(
name = "ledger-on-sql",
srcs = glob(["src/main/scala/**/*.scala"]),
resources = glob(["src/main/resources/**/*"]),
tags = ["maven_coordinates=com.daml:ledger-on-sql:__VERSION__"],
visibility = [
"//visibility:public",
],
deps = [
"//daml-lf/data",
"//daml-lf/engine",
"//daml-lf/transaction",
"//language-support/scala/bindings",
"//ledger/caching",
"//ledger/ledger-api-common",
Sandbox & kvutils: Use the existing ledger ID if no ledger ID is specified. (#4607) * sandbox: If the ledger ID isn't provided, use the one in the database. Previously, we would fail if working against an existing ledger, and not explicitly providing the ledger ID. This was the case even if the ledger ID was randomly generated initially. CHANGELOG_BEGIN - [Sandbox] If no ledger ID is provided when running against an existing ledger, use the existing ID. Previously, Sandbox would fail to start. CHANGELOG_END * sandbox: The ReadOnlySqlLedger should always receive a ledger ID. It's read-only; it can't create one. * sandbox: Stop using `equal` in SqlLedgerSpec. * sandbox: Test that the ledger ID is as specified in SqlLedgerSpec. * sandbox: Let the top-level runner handle a ledger ID mismatch. And clean up the log text. * sandbox: Initialize the ledger properly when the ID is dynamic. * sandbox: Use `Vector`, not `List`, for SqlLedger initialization. Append with Vector, good. List, bad. * ledger-api-common: Make `LedgerApiMode.Dynamic` an object. And add Java-style static factory methods. * kvutils/app | ledger-on-{memory,sql}: Make `ledgerId` optional. It should be generated or retrieved from the persistence layer by the ledger itself. * kvutils: Make the ledger ID optional in the tests. * ledger-on-sql: Store the ledger ID, and reject conflicting IDs. * ledger-on-sql: Make more things final. * ledger-on-sql: Document the `ledger_meta.table_key` column better. * sandbox: Don't hardcode the number of packages in the test DAR. It changes. * ledger-on-sql: Merge the `head` resource owner with the `dispatcher`. * sandbox: Use backticks to simplify pattern match in ReadOnlySqlLedger. * ledger-on-sql: Extract methods in `owner`.
2020-02-20 13:35:16 +03:00
"//ledger/ledger-api-domain",
"//ledger/ledger-api-health",
resources: Customizable contexts. (#7678) * resources: Move builders into //ledger/ledger-resources. Keep the actual constructors in a trait, but instantiate it when working with ledger code. This allows us to later introduce an extra "context" type parameter to ResourceOwner. * resources-akka: Move the builders in to //ledger/ledger-resources. * resources: Introduce an abstract `Context` parameter for owners. This replaces the concrete `ExecutionContext`. While it _can_ be an execution context, it really doesn't matter as long as we can get at one somehow. This is being introduced so we can wrap the context in a container, either for type tagging or to include extra information. Because our current context _is_ `ExecutionContext`, and an implicit is provided to extract it, we can end up with two ways to get the same value. We use shadowing to prevent this. This problem should go away in the near future when a new context type is added. CHANGELOG_BEGIN - [Integration Kit] The `ResourceOwner` type is now parameterized by a `Context`, which is filled in by the corresponding `Context` class in the _ledger-resources_ dependency. This allows us to pass extra information through resource acquisition. CHANGELOG_END * ledger-resources: Move `ResourceOwner` here from `resources`. * ledger-resources: Remove dependencies from outside //ledger. * ledger-resource: Wrap the acquisition execution context in `Context`. So we can add a logging context to it. * resources: Pass the Context, not the ExecutionContext, to Resource. * Avoid importing `HasExecutionContext`. * ledger-resources: Publish to Maven Central. * resources: Make the small changes suggested by @stefanobaghino-da. Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com> * ledger-resources: Pull out a trait for test resource contexts. Saves a few lines of code. * Restore some imports that were accidentally wildcarded. * resources: Replace an `implicit def` with a couple of imports. * participant-integration-api: Simplify the JdbcLedgerDaoBackend tests. Try and use the right execution context where possible. Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2020-10-20 12:26:28 +03:00
"//ledger/ledger-resources",
"//ledger/metrics",
"//ledger/participant-state",
"//ledger/participant-state/kvutils",
"//libs-scala/concurrent",
ledger-on-sql: Get H2 working in the conformance tests. (#4155) * kvutils: Make logback.xml a base file, rather than the only option. * kvutils/app: Simplify logback.base.xml. Mostly by getting rid of unnecessary appenders. * ledger-on-sql: Add trace logging for all database work. * Upgrade H2; there's a few useful bug fixes. * kvutils/app: Let the user override the server JDBC URL. * kvutils/app: Provide a way to specify the ledger ID. * ledger-on-sql: If there are missing entries in the log, fail on read. This can happen right now because we insert in parallel. Next step: stop doing that. * ledger-on-sql: Stop writing in parallel; it causes race conditions. This unfortunately means we also stop _reading_ in parallel, which is less fun. * Revert "ledger-on-sql: Use a sequential log entry ID." This reverts commit c58265bf43b96d16bfa62ed30a795f365b1e83f2. * ledger-on-sql: Create tables with columns that are not nullable. * ledger-on-sql: The H2 conformance tests now work, just slowly. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Run tests against H2 and SQLite on memory and disk. * ledger-on-sql: Allow H2 to read from the log in parallel with writes. * ledger-on-sql: Use UUIDs for entry IDs, not 8 random bytes. * ledger-on-sql: Make sure to log the correlation ID. * ledger-on-sql: Do less while holding a database connection. * ledger-on-sql: Log the connection. * ledger-on-sql: We don't need to tell H2 not to drop the connection. The connection pool takes care of that. * ledger-on-sql: Disable H2 conformance tests on CI; they're too slow. * ledger-on-sql: Rename `loggingContext` to `logCtx`. * ledger-on-sql: Don't abuse log contexts; put the data in the message. * ledger-on-sql: Make the connection log line easier to read. And pull out the logger, even if it's only used once. * ledger-on-sql: Run the unit tests against (H2, SQLite) * (memory, file).
2020-01-22 18:54:51 +03:00
"//libs-scala/contextualized-logging",
"//libs-scala/resources",
resources: Customizable contexts. (#7678) * resources: Move builders into //ledger/ledger-resources. Keep the actual constructors in a trait, but instantiate it when working with ledger code. This allows us to later introduce an extra "context" type parameter to ResourceOwner. * resources-akka: Move the builders in to //ledger/ledger-resources. * resources: Introduce an abstract `Context` parameter for owners. This replaces the concrete `ExecutionContext`. While it _can_ be an execution context, it really doesn't matter as long as we can get at one somehow. This is being introduced so we can wrap the context in a container, either for type tagging or to include extra information. Because our current context _is_ `ExecutionContext`, and an implicit is provided to extract it, we can end up with two ways to get the same value. We use shadowing to prevent this. This problem should go away in the near future when a new context type is added. CHANGELOG_BEGIN - [Integration Kit] The `ResourceOwner` type is now parameterized by a `Context`, which is filled in by the corresponding `Context` class in the _ledger-resources_ dependency. This allows us to pass extra information through resource acquisition. CHANGELOG_END * ledger-resources: Move `ResourceOwner` here from `resources`. * ledger-resources: Remove dependencies from outside //ledger. * ledger-resource: Wrap the acquisition execution context in `Context`. So we can add a logging context to it. * resources: Pass the Context, not the ExecutionContext, to Resource. * Avoid importing `HasExecutionContext`. * ledger-resources: Publish to Maven Central. * resources: Make the small changes suggested by @stefanobaghino-da. Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com> * ledger-resources: Pull out a trait for test resource contexts. Saves a few lines of code. * Restore some imports that were accidentally wildcarded. * resources: Replace an `implicit def` with a couple of imports. * participant-integration-api: Simplify the JdbcLedgerDaoBackend tests. Try and use the right execution context where possible. Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2020-10-20 12:26:28 +03:00
"//libs-scala/resources-akka",
"@maven//:com_google_protobuf_protobuf_java",
"@maven//:com_typesafe_akka_akka_actor_2_12",
"@maven//:com_typesafe_akka_akka_stream_2_12",
"@maven//:com_zaxxer_HikariCP",
"@maven//:io_dropwizard_metrics_metrics_core",
ledger-on-sql: Migrate tables using Flyway. (#4232) * ledger-on-sql: Pull out a superclass for the various integration tests. * ledger-on-sql: Use Flyway to migrate tables in an idempotent manner. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Make it easy to run it with Bazel for experimentation. * ledger-on-sql: Test that migrations will never change in the future. * ledger-on-sql: Add a prefix of "ledger_" to the tables. This is so we don't accidentally conflict with the index when the schemas are shared. I am letting myself modify the migrations because the existing migrations haven't been merged into `master` yet. * ledger-on-sql: Explain why we change the pool size after migration. * ledger-api-test-tool: Tests now specify a timeout scale, not a timeout. Makes it easier to change the default timeout in one place. * ledger-api-test-tool: Increase timeouts on slow tests. These tests produce a lot of volume and can make CI flaky. * ledger-on-sql: Only tear down PostgreSQL in tests. For other databases, we just create a new file for each test case. * ledger-on-sql: Reduce the log output in tests. * ledger-on-sql: Use a separate connection pool for Flyway when possible. Apparently `setMaximumPoolSize` doesn't really have the desired effect after the connection pool has already been used. The new test case will be flaky if we process more than one commit in parallel. For SQLite, it seems to be OK. * ledger-on-sql: Use a separate connection pool for Flyway with SQLite. Except in memory. * ledger-on-sql: Use a separate PostgreSQL database for each test. Because performance, innit. Don't have to tear them down. * ledger-on-sql: Move the `Queries` values inside the `RDBMS` objects. * ledger-on-sql: Go into even more detail about pool size hijinks. Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-28 19:16:23 +03:00
"@maven//:org_flywaydb_flyway_core",
"@maven//:org_playframework_anorm_anorm_2_12",
"@maven//:org_playframework_anorm_anorm_tokenizer_2_12",
Sandbox & kvutils: Use the existing ledger ID if no ledger ID is specified. (#4607) * sandbox: If the ledger ID isn't provided, use the one in the database. Previously, we would fail if working against an existing ledger, and not explicitly providing the ledger ID. This was the case even if the ledger ID was randomly generated initially. CHANGELOG_BEGIN - [Sandbox] If no ledger ID is provided when running against an existing ledger, use the existing ID. Previously, Sandbox would fail to start. CHANGELOG_END * sandbox: The ReadOnlySqlLedger should always receive a ledger ID. It's read-only; it can't create one. * sandbox: Stop using `equal` in SqlLedgerSpec. * sandbox: Test that the ledger ID is as specified in SqlLedgerSpec. * sandbox: Let the top-level runner handle a ledger ID mismatch. And clean up the log text. * sandbox: Initialize the ledger properly when the ID is dynamic. * sandbox: Use `Vector`, not `List`, for SqlLedger initialization. Append with Vector, good. List, bad. * ledger-api-common: Make `LedgerApiMode.Dynamic` an object. And add Java-style static factory methods. * kvutils/app | ledger-on-{memory,sql}: Make `ledgerId` optional. It should be generated or retrieved from the persistence layer by the ledger itself. * kvutils: Make the ledger ID optional in the tests. * ledger-on-sql: Store the ledger ID, and reject conflicting IDs. * ledger-on-sql: Make more things final. * ledger-on-sql: Document the `ledger_meta.table_key` column better. * sandbox: Don't hardcode the number of packages in the test DAR. It changes. * ledger-on-sql: Merge the `head` resource owner with the `dispatcher`. * sandbox: Use backticks to simplify pattern match in ReadOnlySqlLedger. * ledger-on-sql: Extract methods in `owner`.
2020-02-20 13:35:16 +03:00
"@maven//:org_scalaz_scalaz_core_2_12",
ledger-on-sql: Migrate tables using Flyway. (#4232) * ledger-on-sql: Pull out a superclass for the various integration tests. * ledger-on-sql: Use Flyway to migrate tables in an idempotent manner. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Make it easy to run it with Bazel for experimentation. * ledger-on-sql: Test that migrations will never change in the future. * ledger-on-sql: Add a prefix of "ledger_" to the tables. This is so we don't accidentally conflict with the index when the schemas are shared. I am letting myself modify the migrations because the existing migrations haven't been merged into `master` yet. * ledger-on-sql: Explain why we change the pool size after migration. * ledger-api-test-tool: Tests now specify a timeout scale, not a timeout. Makes it easier to change the default timeout in one place. * ledger-api-test-tool: Increase timeouts on slow tests. These tests produce a lot of volume and can make CI flaky. * ledger-on-sql: Only tear down PostgreSQL in tests. For other databases, we just create a new file for each test case. * ledger-on-sql: Reduce the log output in tests. * ledger-on-sql: Use a separate connection pool for Flyway when possible. Apparently `setMaximumPoolSize` doesn't really have the desired effect after the connection pool has already been used. The new test case will be flaky if we process more than one commit in parallel. For SQLite, it seems to be OK. * ledger-on-sql: Use a separate connection pool for Flyway with SQLite. Except in memory. * ledger-on-sql: Use a separate PostgreSQL database for each test. Because performance, innit. Don't have to tear them down. * ledger-on-sql: Move the `Queries` values inside the `RDBMS` objects. * ledger-on-sql: Go into even more detail about pool size hijinks. Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-28 19:16:23 +03:00
],
)
da_scala_library(
name = "ledger-on-sql-app",
srcs = glob(["src/app/scala/**/*.scala"]),
resources = glob(["src/app/resources/**/*"]),
visibility = ["//visibility:public"],
deps = [
":ledger-on-sql",
"//daml-lf/data",
"//daml-lf/engine",
"//language-support/scala/bindings",
"//ledger/caching",
"//ledger/ledger-api-auth",
"//ledger/ledger-api-health",
resources: Customizable contexts. (#7678) * resources: Move builders into //ledger/ledger-resources. Keep the actual constructors in a trait, but instantiate it when working with ledger code. This allows us to later introduce an extra "context" type parameter to ResourceOwner. * resources-akka: Move the builders in to //ledger/ledger-resources. * resources: Introduce an abstract `Context` parameter for owners. This replaces the concrete `ExecutionContext`. While it _can_ be an execution context, it really doesn't matter as long as we can get at one somehow. This is being introduced so we can wrap the context in a container, either for type tagging or to include extra information. Because our current context _is_ `ExecutionContext`, and an implicit is provided to extract it, we can end up with two ways to get the same value. We use shadowing to prevent this. This problem should go away in the near future when a new context type is added. CHANGELOG_BEGIN - [Integration Kit] The `ResourceOwner` type is now parameterized by a `Context`, which is filled in by the corresponding `Context` class in the _ledger-resources_ dependency. This allows us to pass extra information through resource acquisition. CHANGELOG_END * ledger-resources: Move `ResourceOwner` here from `resources`. * ledger-resources: Remove dependencies from outside //ledger. * ledger-resource: Wrap the acquisition execution context in `Context`. So we can add a logging context to it. * resources: Pass the Context, not the ExecutionContext, to Resource. * Avoid importing `HasExecutionContext`. * ledger-resources: Publish to Maven Central. * resources: Make the small changes suggested by @stefanobaghino-da. Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com> * ledger-resources: Pull out a trait for test resource contexts. Saves a few lines of code. * Restore some imports that were accidentally wildcarded. * resources: Replace an `implicit def` with a couple of imports. * participant-integration-api: Simplify the JdbcLedgerDaoBackend tests. Try and use the right execution context where possible. Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2020-10-20 12:26:28 +03:00
"//ledger/ledger-resources",
"//ledger/metrics",
"//ledger/participant-integration-api",
"//ledger/participant-state",
"//ledger/participant-state/kvutils",
"//ledger/participant-state/kvutils/app",
"//libs-scala/contextualized-logging",
"//libs-scala/ports",
"//libs-scala/resources",
"@maven//:com_github_scopt_scopt_2_12",
"@maven//:com_typesafe_akka_akka_actor_2_12",
"@maven//:com_typesafe_akka_akka_stream_2_12",
],
)
ledger-on-sql: Migrate tables using Flyway. (#4232) * ledger-on-sql: Pull out a superclass for the various integration tests. * ledger-on-sql: Use Flyway to migrate tables in an idempotent manner. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Make it easy to run it with Bazel for experimentation. * ledger-on-sql: Test that migrations will never change in the future. * ledger-on-sql: Add a prefix of "ledger_" to the tables. This is so we don't accidentally conflict with the index when the schemas are shared. I am letting myself modify the migrations because the existing migrations haven't been merged into `master` yet. * ledger-on-sql: Explain why we change the pool size after migration. * ledger-api-test-tool: Tests now specify a timeout scale, not a timeout. Makes it easier to change the default timeout in one place. * ledger-api-test-tool: Increase timeouts on slow tests. These tests produce a lot of volume and can make CI flaky. * ledger-on-sql: Only tear down PostgreSQL in tests. For other databases, we just create a new file for each test case. * ledger-on-sql: Reduce the log output in tests. * ledger-on-sql: Use a separate connection pool for Flyway when possible. Apparently `setMaximumPoolSize` doesn't really have the desired effect after the connection pool has already been used. The new test case will be flaky if we process more than one commit in parallel. For SQLite, it seems to be OK. * ledger-on-sql: Use a separate connection pool for Flyway with SQLite. Except in memory. * ledger-on-sql: Use a separate PostgreSQL database for each test. Because performance, innit. Don't have to tear them down. * ledger-on-sql: Move the `Queries` values inside the `RDBMS` objects. * ledger-on-sql: Go into even more detail about pool size hijinks. Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-28 19:16:23 +03:00
da_scala_binary(
name = "app",
main_class = "com.daml.ledger.on.sql.Main",
visibility = ["//visibility:public"],
runtime_deps = [
"@maven//:ch_qos_logback_logback_classic",
"@maven//:ch_qos_logback_logback_core",
] + all_database_runtime_deps,
ledger-on-sql: Migrate tables using Flyway. (#4232) * ledger-on-sql: Pull out a superclass for the various integration tests. * ledger-on-sql: Use Flyway to migrate tables in an idempotent manner. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Make it easy to run it with Bazel for experimentation. * ledger-on-sql: Test that migrations will never change in the future. * ledger-on-sql: Add a prefix of "ledger_" to the tables. This is so we don't accidentally conflict with the index when the schemas are shared. I am letting myself modify the migrations because the existing migrations haven't been merged into `master` yet. * ledger-on-sql: Explain why we change the pool size after migration. * ledger-api-test-tool: Tests now specify a timeout scale, not a timeout. Makes it easier to change the default timeout in one place. * ledger-api-test-tool: Increase timeouts on slow tests. These tests produce a lot of volume and can make CI flaky. * ledger-on-sql: Only tear down PostgreSQL in tests. For other databases, we just create a new file for each test case. * ledger-on-sql: Reduce the log output in tests. * ledger-on-sql: Use a separate connection pool for Flyway when possible. Apparently `setMaximumPoolSize` doesn't really have the desired effect after the connection pool has already been used. The new test case will be flaky if we process more than one commit in parallel. For SQLite, it seems to be OK. * ledger-on-sql: Use a separate connection pool for Flyway with SQLite. Except in memory. * ledger-on-sql: Use a separate PostgreSQL database for each test. Because performance, innit. Don't have to tear them down. * ledger-on-sql: Move the `Queries` values inside the `RDBMS` objects. * ledger-on-sql: Go into even more detail about pool size hijinks. Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-28 19:16:23 +03:00
deps = [
":ledger-on-sql-app",
],
)
da_scala_library(
name = "ledger-on-sql-test-lib",
srcs = glob(["src/test/lib/scala/**/*.scala"]),
visibility = [
"//visibility:public",
],
deps = [
":ledger-on-sql",
":ledger-on-sql-app",
"//daml-lf/data",
"//daml-lf/engine",
"//language-support/scala/bindings",
ledger-on-sql: Migrate tables using Flyway. (#4232) * ledger-on-sql: Pull out a superclass for the various integration tests. * ledger-on-sql: Use Flyway to migrate tables in an idempotent manner. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Make it easy to run it with Bazel for experimentation. * ledger-on-sql: Test that migrations will never change in the future. * ledger-on-sql: Add a prefix of "ledger_" to the tables. This is so we don't accidentally conflict with the index when the schemas are shared. I am letting myself modify the migrations because the existing migrations haven't been merged into `master` yet. * ledger-on-sql: Explain why we change the pool size after migration. * ledger-api-test-tool: Tests now specify a timeout scale, not a timeout. Makes it easier to change the default timeout in one place. * ledger-api-test-tool: Increase timeouts on slow tests. These tests produce a lot of volume and can make CI flaky. * ledger-on-sql: Only tear down PostgreSQL in tests. For other databases, we just create a new file for each test case. * ledger-on-sql: Reduce the log output in tests. * ledger-on-sql: Use a separate connection pool for Flyway when possible. Apparently `setMaximumPoolSize` doesn't really have the desired effect after the connection pool has already been used. The new test case will be flaky if we process more than one commit in parallel. For SQLite, it seems to be OK. * ledger-on-sql: Use a separate connection pool for Flyway with SQLite. Except in memory. * ledger-on-sql: Use a separate PostgreSQL database for each test. Because performance, innit. Don't have to tear them down. * ledger-on-sql: Move the `Queries` values inside the `RDBMS` objects. * ledger-on-sql: Go into even more detail about pool size hijinks. Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-28 19:16:23 +03:00
"//ledger-api/rs-grpc-bridge",
"//ledger-api/testing-utils",
"//ledger/caching",
"//ledger/ledger-api-auth",
"//ledger/ledger-api-health",
resources: Customizable contexts. (#7678) * resources: Move builders into //ledger/ledger-resources. Keep the actual constructors in a trait, but instantiate it when working with ledger code. This allows us to later introduce an extra "context" type parameter to ResourceOwner. * resources-akka: Move the builders in to //ledger/ledger-resources. * resources: Introduce an abstract `Context` parameter for owners. This replaces the concrete `ExecutionContext`. While it _can_ be an execution context, it really doesn't matter as long as we can get at one somehow. This is being introduced so we can wrap the context in a container, either for type tagging or to include extra information. Because our current context _is_ `ExecutionContext`, and an implicit is provided to extract it, we can end up with two ways to get the same value. We use shadowing to prevent this. This problem should go away in the near future when a new context type is added. CHANGELOG_BEGIN - [Integration Kit] The `ResourceOwner` type is now parameterized by a `Context`, which is filled in by the corresponding `Context` class in the _ledger-resources_ dependency. This allows us to pass extra information through resource acquisition. CHANGELOG_END * ledger-resources: Move `ResourceOwner` here from `resources`. * ledger-resources: Remove dependencies from outside //ledger. * ledger-resource: Wrap the acquisition execution context in `Context`. So we can add a logging context to it. * resources: Pass the Context, not the ExecutionContext, to Resource. * Avoid importing `HasExecutionContext`. * ledger-resources: Publish to Maven Central. * resources: Make the small changes suggested by @stefanobaghino-da. Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com> * ledger-resources: Pull out a trait for test resource contexts. Saves a few lines of code. * Restore some imports that were accidentally wildcarded. * resources: Replace an `implicit def` with a couple of imports. * participant-integration-api: Simplify the JdbcLedgerDaoBackend tests. Try and use the right execution context where possible. Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2020-10-20 12:26:28 +03:00
"//ledger/ledger-resources",
"//ledger/ledger-resources:ledger-resources-test-lib",
"//ledger/metrics",
"//ledger/participant-integration-api",
"//ledger/participant-state",
"//ledger/participant-state/kvutils",
ledger-on-sql: Migrate tables using Flyway. (#4232) * ledger-on-sql: Pull out a superclass for the various integration tests. * ledger-on-sql: Use Flyway to migrate tables in an idempotent manner. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Make it easy to run it with Bazel for experimentation. * ledger-on-sql: Test that migrations will never change in the future. * ledger-on-sql: Add a prefix of "ledger_" to the tables. This is so we don't accidentally conflict with the index when the schemas are shared. I am letting myself modify the migrations because the existing migrations haven't been merged into `master` yet. * ledger-on-sql: Explain why we change the pool size after migration. * ledger-api-test-tool: Tests now specify a timeout scale, not a timeout. Makes it easier to change the default timeout in one place. * ledger-api-test-tool: Increase timeouts on slow tests. These tests produce a lot of volume and can make CI flaky. * ledger-on-sql: Only tear down PostgreSQL in tests. For other databases, we just create a new file for each test case. * ledger-on-sql: Reduce the log output in tests. * ledger-on-sql: Use a separate connection pool for Flyway when possible. Apparently `setMaximumPoolSize` doesn't really have the desired effect after the connection pool has already been used. The new test case will be flaky if we process more than one commit in parallel. For SQLite, it seems to be OK. * ledger-on-sql: Use a separate connection pool for Flyway with SQLite. Except in memory. * ledger-on-sql: Use a separate PostgreSQL database for each test. Because performance, innit. Don't have to tear them down. * ledger-on-sql: Move the `Queries` values inside the `RDBMS` objects. * ledger-on-sql: Go into even more detail about pool size hijinks. Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-28 19:16:23 +03:00
"//ledger/participant-state/kvutils:kvutils-tests-lib",
"//ledger/participant-state/kvutils/app",
ledger-on-sql: Migrate tables using Flyway. (#4232) * ledger-on-sql: Pull out a superclass for the various integration tests. * ledger-on-sql: Use Flyway to migrate tables in an idempotent manner. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Make it easy to run it with Bazel for experimentation. * ledger-on-sql: Test that migrations will never change in the future. * ledger-on-sql: Add a prefix of "ledger_" to the tables. This is so we don't accidentally conflict with the index when the schemas are shared. I am letting myself modify the migrations because the existing migrations haven't been merged into `master` yet. * ledger-on-sql: Explain why we change the pool size after migration. * ledger-api-test-tool: Tests now specify a timeout scale, not a timeout. Makes it easier to change the default timeout in one place. * ledger-api-test-tool: Increase timeouts on slow tests. These tests produce a lot of volume and can make CI flaky. * ledger-on-sql: Only tear down PostgreSQL in tests. For other databases, we just create a new file for each test case. * ledger-on-sql: Reduce the log output in tests. * ledger-on-sql: Use a separate connection pool for Flyway when possible. Apparently `setMaximumPoolSize` doesn't really have the desired effect after the connection pool has already been used. The new test case will be flaky if we process more than one commit in parallel. For SQLite, it seems to be OK. * ledger-on-sql: Use a separate connection pool for Flyway with SQLite. Except in memory. * ledger-on-sql: Use a separate PostgreSQL database for each test. Because performance, innit. Don't have to tear them down. * ledger-on-sql: Move the `Queries` values inside the `RDBMS` objects. * ledger-on-sql: Go into even more detail about pool size hijinks. Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-28 19:16:23 +03:00
"//libs-scala/contextualized-logging",
"//libs-scala/ports",
"//libs-scala/postgresql-testing",
"//libs-scala/resources",
"@maven//:com_github_scopt_scopt_2_12",
ledger-on-sql: Migrate tables using Flyway. (#4232) * ledger-on-sql: Pull out a superclass for the various integration tests. * ledger-on-sql: Use Flyway to migrate tables in an idempotent manner. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Make it easy to run it with Bazel for experimentation. * ledger-on-sql: Test that migrations will never change in the future. * ledger-on-sql: Add a prefix of "ledger_" to the tables. This is so we don't accidentally conflict with the index when the schemas are shared. I am letting myself modify the migrations because the existing migrations haven't been merged into `master` yet. * ledger-on-sql: Explain why we change the pool size after migration. * ledger-api-test-tool: Tests now specify a timeout scale, not a timeout. Makes it easier to change the default timeout in one place. * ledger-api-test-tool: Increase timeouts on slow tests. These tests produce a lot of volume and can make CI flaky. * ledger-on-sql: Only tear down PostgreSQL in tests. For other databases, we just create a new file for each test case. * ledger-on-sql: Reduce the log output in tests. * ledger-on-sql: Use a separate connection pool for Flyway when possible. Apparently `setMaximumPoolSize` doesn't really have the desired effect after the connection pool has already been used. The new test case will be flaky if we process more than one commit in parallel. For SQLite, it seems to be OK. * ledger-on-sql: Use a separate connection pool for Flyway with SQLite. Except in memory. * ledger-on-sql: Use a separate PostgreSQL database for each test. Because performance, innit. Don't have to tear them down. * ledger-on-sql: Move the `Queries` values inside the `RDBMS` objects. * ledger-on-sql: Go into even more detail about pool size hijinks. Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-28 19:16:23 +03:00
"@maven//:com_typesafe_akka_akka_actor_2_12",
"@maven//:com_typesafe_akka_akka_stream_2_12",
ledger-on-sql: Migrate tables using Flyway. (#4232) * ledger-on-sql: Pull out a superclass for the various integration tests. * ledger-on-sql: Use Flyway to migrate tables in an idempotent manner. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Make it easy to run it with Bazel for experimentation. * ledger-on-sql: Test that migrations will never change in the future. * ledger-on-sql: Add a prefix of "ledger_" to the tables. This is so we don't accidentally conflict with the index when the schemas are shared. I am letting myself modify the migrations because the existing migrations haven't been merged into `master` yet. * ledger-on-sql: Explain why we change the pool size after migration. * ledger-api-test-tool: Tests now specify a timeout scale, not a timeout. Makes it easier to change the default timeout in one place. * ledger-api-test-tool: Increase timeouts on slow tests. These tests produce a lot of volume and can make CI flaky. * ledger-on-sql: Only tear down PostgreSQL in tests. For other databases, we just create a new file for each test case. * ledger-on-sql: Reduce the log output in tests. * ledger-on-sql: Use a separate connection pool for Flyway when possible. Apparently `setMaximumPoolSize` doesn't really have the desired effect after the connection pool has already been used. The new test case will be flaky if we process more than one commit in parallel. For SQLite, it seems to be OK. * ledger-on-sql: Use a separate connection pool for Flyway with SQLite. Except in memory. * ledger-on-sql: Use a separate PostgreSQL database for each test. Because performance, innit. Don't have to tear them down. * ledger-on-sql: Move the `Queries` values inside the `RDBMS` objects. * ledger-on-sql: Go into even more detail about pool size hijinks. Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-28 19:16:23 +03:00
"@maven//:org_scalactic_scalactic_2_12",
"@maven//:org_scalatest_scalatest_2_12",
],
)
da_scala_test_suite(
name = "ledger-on-sql-tests",
srcs = glob(["src/test/suite/**/*.scala"]),
data = [
"//ledger/test-common:model-tests.dar",
],
resources = glob(["src/test/resources/*"]),
runtime_deps = [
"@maven//:ch_qos_logback_logback_classic",
"@maven//:ch_qos_logback_logback_core",
] + all_database_runtime_deps,
deps = [
":ledger-on-sql",
ledger-on-sql: Migrate tables using Flyway. (#4232) * ledger-on-sql: Pull out a superclass for the various integration tests. * ledger-on-sql: Use Flyway to migrate tables in an idempotent manner. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Make it easy to run it with Bazel for experimentation. * ledger-on-sql: Test that migrations will never change in the future. * ledger-on-sql: Add a prefix of "ledger_" to the tables. This is so we don't accidentally conflict with the index when the schemas are shared. I am letting myself modify the migrations because the existing migrations haven't been merged into `master` yet. * ledger-on-sql: Explain why we change the pool size after migration. * ledger-api-test-tool: Tests now specify a timeout scale, not a timeout. Makes it easier to change the default timeout in one place. * ledger-api-test-tool: Increase timeouts on slow tests. These tests produce a lot of volume and can make CI flaky. * ledger-on-sql: Only tear down PostgreSQL in tests. For other databases, we just create a new file for each test case. * ledger-on-sql: Reduce the log output in tests. * ledger-on-sql: Use a separate connection pool for Flyway when possible. Apparently `setMaximumPoolSize` doesn't really have the desired effect after the connection pool has already been used. The new test case will be flaky if we process more than one commit in parallel. For SQLite, it seems to be OK. * ledger-on-sql: Use a separate connection pool for Flyway with SQLite. Except in memory. * ledger-on-sql: Use a separate PostgreSQL database for each test. Because performance, innit. Don't have to tear them down. * ledger-on-sql: Move the `Queries` values inside the `RDBMS` objects. * ledger-on-sql: Go into even more detail about pool size hijinks. Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-28 19:16:23 +03:00
":ledger-on-sql-test-lib",
"//daml-lf/data",
"//daml-lf/engine",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/testing-utils",
"//ledger/ledger-api-common",
"//ledger/ledger-api-health",
resources: Customizable contexts. (#7678) * resources: Move builders into //ledger/ledger-resources. Keep the actual constructors in a trait, but instantiate it when working with ledger code. This allows us to later introduce an extra "context" type parameter to ResourceOwner. * resources-akka: Move the builders in to //ledger/ledger-resources. * resources: Introduce an abstract `Context` parameter for owners. This replaces the concrete `ExecutionContext`. While it _can_ be an execution context, it really doesn't matter as long as we can get at one somehow. This is being introduced so we can wrap the context in a container, either for type tagging or to include extra information. Because our current context _is_ `ExecutionContext`, and an implicit is provided to extract it, we can end up with two ways to get the same value. We use shadowing to prevent this. This problem should go away in the near future when a new context type is added. CHANGELOG_BEGIN - [Integration Kit] The `ResourceOwner` type is now parameterized by a `Context`, which is filled in by the corresponding `Context` class in the _ledger-resources_ dependency. This allows us to pass extra information through resource acquisition. CHANGELOG_END * ledger-resources: Move `ResourceOwner` here from `resources`. * ledger-resources: Remove dependencies from outside //ledger. * ledger-resource: Wrap the acquisition execution context in `Context`. So we can add a logging context to it. * resources: Pass the Context, not the ExecutionContext, to Resource. * Avoid importing `HasExecutionContext`. * ledger-resources: Publish to Maven Central. * resources: Make the small changes suggested by @stefanobaghino-da. Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com> * ledger-resources: Pull out a trait for test resource contexts. Saves a few lines of code. * Restore some imports that were accidentally wildcarded. * resources: Replace an `implicit def` with a couple of imports. * participant-integration-api: Simplify the JdbcLedgerDaoBackend tests. Try and use the right execution context where possible. Co-authored-by: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2020-10-20 12:26:28 +03:00
"//ledger/ledger-resources",
"//ledger/ledger-resources:ledger-resources-test-lib",
"//ledger/metrics",
"//ledger/participant-integration-api",
"//ledger/participant-state",
"//ledger/participant-state/kvutils",
"//ledger/participant-state/kvutils:kvutils-tests-lib",
"//libs-scala/contextualized-logging",
"//libs-scala/flyway-testing",
"//libs-scala/postgresql-testing",
"//libs-scala/resources",
"@maven//:com_typesafe_akka_akka_actor_2_12",
"@maven//:com_typesafe_akka_akka_stream_2_12",
"@maven//:io_dropwizard_metrics_metrics_core",
ledger-on-sql: Migrate tables using Flyway. (#4232) * ledger-on-sql: Pull out a superclass for the various integration tests. * ledger-on-sql: Use Flyway to migrate tables in an idempotent manner. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Make it easy to run it with Bazel for experimentation. * ledger-on-sql: Test that migrations will never change in the future. * ledger-on-sql: Add a prefix of "ledger_" to the tables. This is so we don't accidentally conflict with the index when the schemas are shared. I am letting myself modify the migrations because the existing migrations haven't been merged into `master` yet. * ledger-on-sql: Explain why we change the pool size after migration. * ledger-api-test-tool: Tests now specify a timeout scale, not a timeout. Makes it easier to change the default timeout in one place. * ledger-api-test-tool: Increase timeouts on slow tests. These tests produce a lot of volume and can make CI flaky. * ledger-on-sql: Only tear down PostgreSQL in tests. For other databases, we just create a new file for each test case. * ledger-on-sql: Reduce the log output in tests. * ledger-on-sql: Use a separate connection pool for Flyway when possible. Apparently `setMaximumPoolSize` doesn't really have the desired effect after the connection pool has already been used. The new test case will be flaky if we process more than one commit in parallel. For SQLite, it seems to be OK. * ledger-on-sql: Use a separate connection pool for Flyway with SQLite. Except in memory. * ledger-on-sql: Use a separate PostgreSQL database for each test. Because performance, innit. Don't have to tear them down. * ledger-on-sql: Move the `Queries` values inside the `RDBMS` objects. * ledger-on-sql: Go into even more detail about pool size hijinks. Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2020-01-28 19:16:23 +03:00
"@maven//:org_flywaydb_flyway_core",
"@maven//:org_scala_lang_modules_scala_java8_compat_2_12",
"@maven//:org_scalactic_scalactic_2_12",
"@maven//:org_scalatest_scalatest_2_12",
],
)
[
(
da_scala_binary(
name = "conformance-test-{}-bin".format(db["name"]),
main_class = db.get("conformance_test_server_main", "com.daml.ledger.on.sql.Main"),
visibility = ["//visibility:public"],
runtime_deps = db.get("runtime_deps", []),
deps = [
":ledger-on-sql",
":ledger-on-sql-test-lib",
],
),
conformance_test(
name = "conformance-test-{}".format(db["name"]),
ports = [6865],
server = ":conformance-test-{}-bin".format(db["name"]),
server_args = [
"--contract-id-seeding=testing-weak",
"--participant participant-id=conformance-test,port=6865",
] + db.get("conformance_test_server_args", []),
tags = db.get("conformance_test_tags", []),
ledger-on-sql: Get H2 working in the conformance tests. (#4155) * kvutils: Make logback.xml a base file, rather than the only option. * kvutils/app: Simplify logback.base.xml. Mostly by getting rid of unnecessary appenders. * ledger-on-sql: Add trace logging for all database work. * Upgrade H2; there's a few useful bug fixes. * kvutils/app: Let the user override the server JDBC URL. * kvutils/app: Provide a way to specify the ledger ID. * ledger-on-sql: If there are missing entries in the log, fail on read. This can happen right now because we insert in parallel. Next step: stop doing that. * ledger-on-sql: Stop writing in parallel; it causes race conditions. This unfortunately means we also stop _reading_ in parallel, which is less fun. * Revert "ledger-on-sql: Use a sequential log entry ID." This reverts commit c58265bf43b96d16bfa62ed30a795f365b1e83f2. * ledger-on-sql: Create tables with columns that are not nullable. * ledger-on-sql: The H2 conformance tests now work, just slowly. CHANGELOG_BEGIN CHANGELOG_END * ledger-on-sql: Run tests against H2 and SQLite on memory and disk. * ledger-on-sql: Allow H2 to read from the log in parallel with writes. * ledger-on-sql: Use UUIDs for entry IDs, not 8 random bytes. * ledger-on-sql: Make sure to log the correlation ID. * ledger-on-sql: Do less while holding a database connection. * ledger-on-sql: Log the connection. * ledger-on-sql: We don't need to tell H2 not to drop the connection. The connection pool takes care of that. * ledger-on-sql: Disable H2 conformance tests on CI; they're too slow. * ledger-on-sql: Rename `loggingContext` to `logCtx`. * ledger-on-sql: Don't abuse log contexts; put the data in the message. * ledger-on-sql: Make the connection log line easier to read. And pull out the logger, even if it's only used once. * ledger-on-sql: Run the unit tests against (H2, SQLite) * (memory, file).
2020-01-22 18:54:51 +03:00
test_tool_args = db.get("conformance_test_tool_args", []) + [
"--verbose",
],
),
conformance_test(
name = "conformance-test-participant-pruning-{}".format(db["name"]),
ports = [6865],
server = ":conformance-test-{}-bin".format(db["name"]),
server_args = [
"--contract-id-seeding=testing-weak",
"--participant participant-id=conformance-test,port=6865",
] + db.get("conformance_test_server_args", []),
tags = db.get("conformance_test_tags", []),
test_tool_args = db.get("conformance_test_tool_args", []) + [
"--verbose",
"--include=ParticipantPruningIT",
],
),
conformance_test(
name = "conformance-test-multi-party-submission-{}".format(db["name"]),
ports = [6865],
server = ":conformance-test-{}-bin".format(db["name"]),
server_args = [
"--contract-id-seeding=testing-weak",
"--participant participant-id=conformance-test,port=6865",
] + db.get("conformance_test_server_args", []),
tags = db.get("conformance_test_tags", []),
test_tool_args = db.get("conformance_test_tool_args", []) + [
"--verbose",
"--include=MultiPartySubmissionIT",
],
),
conformance_test(
name = "benchmark-performance-envelope-{}".format(db["name"]),
ports = [6865],
server = ":conformance-test-{}-bin".format(db["name"]),
server_args = [
"--contract-id-seeding=testing-weak",
"--participant participant-id=example,port=6865",
] + db.get("conformance_test_server_args", []),
tags = db.get("benchmark_performance_envelope_tags", []),
test_tool_args = db.get("benchmark_performance_envelope_tags", []) + [
"--verbose",
"--perf-tests=PerformanceEnvelope.Throughput.TwentyOPS",
"--perf-tests=PerformanceEnvelope.Latency.1000ms",
"--perf-tests=PerformanceEnvelope.TransactionSize.1000KB",
],
),
)
for db in supported_databases
]