sandbox: Deprecate the --eager-package-loading flag. (#11404)

It never did anything in Sandbox Next. Packages are always loaded
eagerly in KV ledgers.

CHANGELOG_BEGIN
- [Sandbox] The ``--eager-package-loading`` flag has been deprecated. It
  hasn't actually done anything for many releases; packages are always
  loaded eagerly. This does not affect Daml on SQL, which does support
  lazy package loading.
CHANGELOG_END
This commit is contained in:
Samir Talwar 2021-10-26 16:10:11 +02:00 committed by GitHub
parent 9f882f2161
commit ea5f09e524
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 37 additions and 13 deletions

View File

@ -20,6 +20,14 @@ private[sql] final class Cli(
.withContractIdSeeding(defaultConfig, Some(Seeding.Strong), Some(Seeding.Weak))
.parser
parser
.opt[Unit]("eager-package-loading")
.optional()
.text(
"Whether to load all the packages in the .dar files provided eagerly, rather than when needed as the commands come."
)
.action((_, config) => config.copy(eagerPackageLoading = true))
parser
.opt[String]("sql-backend-jdbcurl-env")
.optional()

View File

@ -54,6 +54,10 @@ class CliSpec
config shouldEqual None
}
"parse the eager package loading flag when given" in {
checkOption(Array("--eager-package-loading"), _.copy(eagerPackageLoading = true))
}
"reject when sql-backend-jdbcurl-env points to a non-existing environment variable" in {
val config =
cli.parse(Array("--ledgerid", "test-ledger", "--sql-backend-jdbcurl-env", "JDBC_URL"))

View File

@ -32,6 +32,13 @@ private[sandbox] object Cli extends SandboxCli {
" Two identifier formats are supported: Module.Name:Entity.Name (preferred) and Module.Name.Entity.Name (deprecated, will print a warning when used)." +
s" Also note that instructing $Name to load a scenario will have the side effect of loading _all_ the .dar files provided eagerly (see --eager-package-loading)."
)
parser
.opt[Unit]("eager-package-loading")
.optional()
.text(
"Whether to load all the packages in the .dar files provided eagerly, rather than when needed as the commands come."
)
.action((_, config) => config.copy(eagerPackageLoading = true))
parser
.opt[String]("sql-backend-jdbcurl")
.optional()

View File

@ -23,6 +23,10 @@ class CliSpec extends CommonCliSpecBase(Cli) {
)
}
"parse the eager package loading flag when given" in {
checkOption(Array("--eager-package-loading"), _.copy(eagerPackageLoading = true))
}
"parse the sql-backend-jdbcurl flag when given" in {
val jdbcUrl = "jdbc:postgresql://localhost:5432/test?user=test"
checkOption(Array("--sql-backend-jdbcurl", jdbcUrl), _.copy(jdbcUrl = Some(jdbcUrl)))

View File

@ -237,13 +237,6 @@ class CommonCliBase(name: LedgerName) {
com.daml.cliopts.Logging.logLevelParse(this)((f, c) => c.copy(logLevel = f(c.logLevel)))
opt[Unit]("eager-package-loading")
.optional()
.text(
"Whether to load all the packages in the .dar files provided eagerly, rather than when needed as the commands come."
)
.action((_, config) => config.copy(eagerPackageLoading = true))
JwtVerifierConfigurationCli.parse(this)((v, c) =>
c.copy(authService = Some(AuthServiceJWT(v)))
)

View File

@ -207,10 +207,6 @@ abstract class CommonCliSpecBase(
)
}
"parse the eager package loading flag when given" in {
checkOption(Array("--eager-package-loading"), _.copy(eagerPackageLoading = true))
}
"parse a console metrics reporter when given" in {
checkOption(
Array("--metrics-reporter", "console"),

View File

@ -263,7 +263,6 @@ NEXT_SERVERS = {
"server_args": [
"--contract-id-seeding=testing-weak",
"--port=6865",
"--eager-package-loading",
],
},
"postgresql": {
@ -271,7 +270,6 @@ NEXT_SERVERS = {
"server_args": [
"--contract-id-seeding=testing-weak",
"--port=6865",
"--eager-package-loading",
],
},
}

View File

@ -21,6 +21,19 @@ private[sandboxnext] object Cli extends SandboxCli {
Some(Seeding.Static),
)
.parser
parser
.opt[Unit]("eager-package-loading")
.hidden()
.optional()
.text("Deprecated. This flag no longer has any effect.")
.action((_, config) => {
System.err.println(
"WARNING: The `--eager-package-loading` flag no longer has any effect in the Sandbox. Packages are always loaded eagerly."
)
config
})
parser
.opt[Boolean](name = "implicit-party-allocation")
.optional()
@ -29,6 +42,7 @@ private[sandboxnext] object Cli extends SandboxCli {
s"When referring to a party that doesn't yet exist on the ledger, $Name will implicitly allocate that party."
+ s" You can optionally disable this behavior to bring $Name into line with other ledgers."
)
parser
.opt[String]("sql-backend-jdbcurl")
.optional()