You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 235558d
Browse filesBrowse the repository at this point in the historyBrowse files
Elrond
committed
docs(database): describe the fence prerequisite against current deletion checks
Startup and deletion validation no longer require a fence on any table, and
every serving writer already goes through admission. The remaining blocker
for a trigger-less tenant table is the desired-state fence loop. Also name
the leased-completion admission exception and fix mid-sentence wraps.
Signed-off-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz>
in `crates/buzz-db/src/store/deletion.rs`). Two things still matter:
107
+
108
+
- Deletion's catalog check is an exact set. A `community_id` table missing from
109
+
`EXPECTED_SCOPED_TABLES`, fenced or not, fails it
110
+
(`community deletion catalog drift (missing=…, unknown=…)`), and deletion
111
+
fails closed for every community, not only the new table's. Listing the
112
+
table is enough to pass.
107
113
- Desired-state bootstraps run `schema/community_write_fence.sql`, which
108
-
attaches a fence trigger to every `community_id` table automatically.
114
+
attaches a fence trigger to every `community_id` table not excluded by
115
+
`community_write_fence_excluded_table`. A fresh desired-state database would
116
+
put a trigger on the new table and a migrated one would not, so the two
117
+
schema paths would diverge.
109
118
110
-
So before a feature can add a tenant-owned `community_id` table, these checks
111
-
must recognise application-fenced tables, and the desired-state loop must stop
112
-
attaching triggers to them. That change belongs to the fence-retirement work.
113
-
Land it before the feature, or as the feature's first PR. Do not work around
114
-
it with a trigger, or with an entry in `community_write_fence_excluded_table`
115
-
for a table the community owns.
119
+
So before a feature can add a tenant-owned `community_id` table, the
120
+
desired-state bootstrap must stop attaching fence triggers. That change belongs
121
+
to the fence-retirement work. Land it before the feature, or as the feature's
122
+
first PR. Do not work around it with a trigger, or with an entry in
123
+
`community_write_fence_excluded_table` for a table the community owns.
116
124
117
125
#### Checklist: adding a tenant-owned `community_id` table
118
126
119
-
After the catalog change above has landed, all in the same PR:
127
+
After the desired-state change above has landed, all in the same PR:
120
128
121
129
-[ ] Every writer of the table goes through community admission
122
130
(`begin_community_write_transaction` or another constructor that returns
123
131
`AdmittedTx`). Nothing writes the table outside it.
124
132
-[ ] No fence trigger: no `attach_community_write_fence` call in the
125
133
migration and no `schema/triggers/` file.
126
-
-[ ] The table in `EXPECTED_SCOPED_TABLES` (`crates/buzz-db/src/store/deletion.rs`),
127
-
plus any registration the catalog change introduces for
128
-
application-fenced tables.
134
+
-[ ] The table in `EXPECTED_SCOPED_TABLES` (`crates/buzz-db/src/store/deletion.rs`).
129
135
-[ ] The table in `PURGE_SCOPED_TABLES` in the same file, ordered child
130
136
before parent. A table missing here keeps its rows after the purge, and
131
137
deletion verification fails closed.
@@ -358,7 +364,7 @@ before the contract have already committed, so an old pod that restarts hits
358
364
| Add `CHECK`, `UNIQUE`, or a narrower index | Old writes violate it, or an old `ON CONFLICT` target no longer matches an index | Deploy writers that satisfy it, backfill, then add it. Add a `CHECK` as `NOT VALID`, then `VALIDATE CONSTRAINT` in a later step. Keep every index an old `ON CONFLICT` names until no deployed code uses it |
359
365
| Add an enum value that new code writes | Old code fails to decode the unknown variant | Deploy readers that accept the value, then deploy writers that produce it |
360
366
| Drop a column, table, index, trigger, function, or FK | Old code reads it or relies on its side effect | Contract step only, after the release that stops relying on it is fully deployed |
361
-
| Add a table with a `community_id` column | The old relay's exact-set deletion catalog check (`EXPECTED_SCOPED_TABLES`) sees an unknown table, so community deletion fails closed until the new release deploys. Serving is unaffected, apart from the auto-migration restart case in Rule 5 | Allowed, after Rule 1's catalog change for a tenant-owned table. Keep the gap between expand and deploy short, and do not run community deletion during it |
367
+
| Add a table with a `community_id` column | The old relay's exact-set deletion catalog check (`EXPECTED_SCOPED_TABLES`) sees an unknown table, so community deletion fails closed until the new release deploys. Serving is unaffected, apart from the auto-migration restart case in Rule 5 | Allowed. For a tenant-owned table, only after the desired-state change in Rule 1. Keep the gap between expand and deploy short, and do not run community deletion during it |
362
368
|`SELECT *` or `RETURNING *` decoded by position | Column order differs between desired-state and migrated databases and changes when columns are added | Select named columns |
0 commit comments