Setting numHistoryShards

I’ve been dealing with some significant activity latency and wanted to try increasing the numHistoryShards from its current (default?) setting of 4.

I understand that the setting is immutable, so I’m dropping the temporal (postgres) dbs before restarting the server with the new setting, however, after restarting the server and seeing the temporal and temporal_visibility dbs recreated, the shards table still contains only 4 rows.

Shouldn’t the number of shards in the shard table match the number of shards specified in my development yaml?

Here is the relevant section from the development-postgres12.yaml file with the numHistoryShards specified.

persistence:
  defaultStore: postgres
  visibilityStore: postgres
  numHistoryShards: 512
  datastores:
    postgres:
      sql:
        pluginName: "postgres12"
        databaseName: "temporal"
        connectAddr: "temporal-postgresql:5432"
        connectProtocol: "tcp"
        user: "temporal"
        password: "${PWD}"
        maxConns: 20
        maxIdleConns: 20
        maxConnLifetime: "1h"
        databaseName_visibility: "temporal_visibility"
global:
  enableVisibilitySampling: true
  advancedVisibilityWritingMode: "on"

After looking through the repo, I realized that autosetup and temporallite actually ignore the yaml property here and instead expect an environmental property NUM_HISTORY_SHARDS to be provided (or it will use 4 as the default). It would be helpful to have that noted in the documentation.

I realized that autosetup and temporallite actually ignore the yaml property

Just to add maybe, autosetup image just like server image use by default
static config template to generate the server static config in /etc/temporal/config/docker.yaml. You can use env var to define your num shards count.

You can define your own static config template if you need as well.

Regarding temporallite, note it is deprecated, you should use temporal cli instead if possible