Hi all,

A nice recent contribution [1], still under review, proposes to create
a separate admin tool command for setting up the database schema.

Currently, schema setup is done as part of realm bootstrapping [2],
which can happen at server bootstrap, when running the tool's
bootstrap command, or on-demand, depending on the RealmContextResolver
in use. For this reason, the setup script must be idempotent.

But the PR raised several questions. I will try to summarize them here:

1) Should schema setup be separate from realm bootstrapping?

2) Should the server perform schema setup at all? If so, when? At
startup, or when a new realm is resolved?
  - Side question: if the server doesn't perform schema setup, how are
tests going to do it?

3) Do we want/need to support – or at least leave the door open for –
different schemas per realm?

4) If we introduce an option to control how schema setup is done:
  - Should it be a configuration option in application.properties? It
would then be available to both server and tool.
  - Should it be an option of the admin tool's `bootstrap` command?
Opt-in or opt-out?
  - Should it be an admin tool's separate command like `setup` ?

For 4) I would be in favor of a new configuration option, e.g.:

polaris.schema.setup-mode=NEVER|STARTUP|PER_REALM

It would be accessible to both server and tool, and the default could
be NEVER for production, and AT_STARTUP for tests. PER_REALM could be
introduced later.

I'm curious to see what others think.

Thanks,
Alex

[1] https://github.com/apache/polaris/pull/2196
[2] 
https://github.com/apache/polaris/blob/2117dbd08e8352b32a2c948ed6c166d7c77da50a/persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java#L148-L158

Reply via email to