Function: compactChangeLog()
Function: compactChangeLog()
Section titled “Function: compactChangeLog()”compactChangeLog(
options):Promise<CompactionResult>
Defined in: server/src/compaction.ts:27
Delete intermediate change-log entries per (table_name, row_id) up to
safeUpToVersion. For each row, only the latest change record with
row_version <= safeUpToVersion is retained.
The upper bound is important: any client whose cookie sits before
safeUpToVersion will see the row jump directly to the folded state
(they miss the intermediate transitions) but they still converge to
the truth. Clients whose cookies are beyond safeUpToVersion are
unaffected. Pick safeUpToVersion = min(cookie across live clients)
— or leave a generous safety margin when that data isn’t available.
NOTE: this permanently discards audit history for row_versions before
the cut-off. Combine with snapshotAsOf(...) in a separate audit table
if you need long-term compliance retention.
Parameters
Section titled “Parameters”options
Section titled “options”executor
Section titled “executor”dialect?
Section titled “dialect?”safeUpToVersion
Section titled “safeUpToVersion”number
Returns
Section titled “Returns”Promise<CompactionResult>