Skip to content

v0.5.559

@cbb330 cbb330 tagged this 13 Nov 19:30
## Summary
- Add `cluster.tables.max-tables-per-database`, disabled by default (`0`); non-positive values leave creation unlimited.
- Reject new-table creation and restoration with HTTP 422 when the database has reached its configured live-table ceiling. Existing-table reads, updates and drops remain available.
- Reuse the paginated HouseTables total rather than materializing every table in the service. Views, soft-deleted tables and uncommitted stages do not count; staged creation is checked again at commit.
- Allow operator-controlled runtime exceptions through the existing `bypass_table_count_limit` HouseTables toggle rules. User-written table properties cannot self-exempt.
- Emit metrics while the limit is enabled, so owning teams can monitor utilization and headroom, and operators can see rejections and which exceptions are in use:
  - `repo_table_count_db_total_count` (gauge, `database`): live tables counted at the latest create or restore check.
  - `repo_table_count_limit` (gauge): the configured ceiling.
  - `repo_table_count_limit_rejected` (counter, `database`): creates and restores rejected at the limit.
  - `repo_table_count_limit_bypassed` (counter, `database`): creates and restores admitted at the limit by a bypass rule.
- Document configuration, HTTP behavior, counting semantics, exception removal and metrics.

## Tradeoffs
This is best-effort admission control, not a transactional quota: concurrent creates or restores can pass the check together and exceed the ceiling. Exceptions do not expire automatically, and exempt tables still count toward the database total. The limit is per database, not an aggregate per principal.

The count gauge is sampled at create and restore checks, so each instance reports its last observation; after drops it stays high until that instance checks the database again. Per-database metrics add one series for each database that receives a create or restore.

The downstream li-openhouse change sets the deployment value to 60000. Its release pin remains unchanged until an upstream release containing this guard is available.

## Verification
- 87 targeted tests passed: `TableCountLimitTest` (9), `RepositoryTest` (69), `OpenHouseInternalRepositoryImplTest` (8), and `CreateTableFeatureToggleTest` (1).
- Built both tables and HouseTables service JARs.
- Ran both real services and exercised HTTP creation at/below the ceiling, rejection without persistence above it, staged-create rejection, table-property bypass rejection, per-database isolation, existing-table updates, capacity recovery after drop, and operator wildcard bypass.
- Scraped `/actuator/prometheus` from the running tables service with a limit of 2: the limit gauge appeared at startup; after a rejected create and a bypassed create, both count gauges read 2 and the rejected and bypassed counters each read 1 for their database; a drop followed by a create moved the count gauge to 1.
- Compiled downstream `:services:tables-extensions:compileJava` against local snapshots of `configs`, `internalcatalog`, and `tables:lib`, using `--no-configure-on-demand` to avoid the downstream JaCoCo configuration-order failure.

Nothing deployed.
Assets 2
Loading