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
fix(db): re-decide the deletion guard inside each deleting transaction and reset member relist state
Each deleting transaction share-locks the search index and its connectors and re-decides the guard, so a connector resumed between pages waits for the page in flight and the next page refuses. Every document-deleting transaction also resets the stopped connectors' listing state, now including the directory checkpoint and each member's retry time, so a run stopped partway never leaves a connector that would skip deleted documents on resume.
Copy file name to clipboardExpand all lines: apps/sim/scripts/dormant-org-search/README.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -152,12 +152,14 @@ Source-connected documents are not metered as uploaded storage, so there is no s
152
152
153
153
The **knowledge base row and its paused connectors are kept**: their configuration, credentials, members, permission snapshots and sync history. Re-enabling is then a matter of resuming the connectors, with nothing to set up again.
154
154
155
-
Once no connector-owned document remains, the run clears each stopped connector's listing state. These are the same columns the app clears when a connector must list everything again (an access-mode switch or a source change):
155
+
Every page that deletes documents also clears each stopped connector's listing state, in the same transaction, so a run stopped partway never leaves a connector that would skip what was already deleted. These are the columns the app clears when a connector must list everything again (an access-mode switch or a source change), plus the directory checkpoint and each member's retry time:
156
156
157
-
-`lastSyncAt`, `lastSyncDocCount`, `listingCheckpoint` and `memberTombstoneCursor` on `knowledge_connector`
158
-
-`listingCheckpoint`, `changeCursor`, `memberSyncedThrough`, `lastCompleteListingAt`and `lastListedCount` on its `knowledge_connector_member` rows
157
+
-`lastSyncAt`, `lastSyncDocCount`, `listingCheckpoint`, `directoryCheckpoint` and `memberTombstoneCursor` on `knowledge_connector`
158
+
-`listingCheckpoint`, `changeCursor`, `memberSyncedThrough`, `lastCompleteListingAt`, `lastListedCount`and `nextAttemptAt` (so every member is due) on its `knowledge_connector_member` rows
159
159
160
-
Without this, a resumed connector would sync incrementally from its old cursor ("changed since last sync"). It would never re-list the documents deleted here, and the index would stay silently incomplete. Partition work rows (`knowledge_connector_partition`) belong to the old listing generation, and the next full listing replaces them. `--no-connector-reset` skips the reset. The reset runs only when the run reaches the end with no connector documents left: a run resumed with `--after-id` checks for documents before its cursor and says so.
160
+
Without this, a resumed connector would sync incrementally from its old cursor ("changed since last sync"), skip directory reconciliation behind a `complete` checkpoint, or leave members waiting on a future retry. It would never re-list the documents deleted here, and the index would stay silently incomplete. Partition work rows (`knowledge_connector_partition`) belong to the old listing generation, and the next full listing replaces them. `--no-connector-reset` skips the reset. When a run finishes with no connector documents left, it resets once more to catch rows a page could not (for example a member added mid-run).
161
+
162
+
Each deleting transaction also re-decides the guard while holding the knowledge base and its connectors `FOR SHARE`. Resuming a connector or claiming a sync updates the connector row, so it waits for the page in flight to commit, and the next page refuses.
0 commit comments