@clickup/pg-microsharding
Version:
Microshards support for PostgreSQL
28 lines • 1.36 kB
TypeScript
import type { TableInfo } from "./getTablesInSchema";
/**
* Waits until all physical replicas on a DSN are not lagging for too much, so
* we can e.g. call waitUntilIncrementalCompletes() and then resultCommit().
* Also, if fromDsn is passed, waits for the logical slot to lag not more than
* maxReplicationLagSec time.
*
* For the logical slot replication lag estimation, in the beginning, we
* "latch", i.e. remember the master's LSN, and then wait until the slot replay
* is past that LSN. Once it happens, the amount of time passed is roughly the
* logical replication slot lag in seconds. This is the only way to estimate,
* how many seconds behind is a logical slot.
*
* For physical replicas, we query their replication lag in seconds directly.
*
* If waitForUserToContinue=true, then the function exits ONLY when the user
* told it to do so explicitly by pressing the hotkey.
*/
export declare function waitUntilEverythingIsNotLaggingMuch({ when, fromDsn, tables, toDsn, schema, maxReplicationLagSec: maxLagSec, waitForUserToContinue, }: {
when: string;
fromDsn?: string | null;
tables: TableInfo[];
toDsn: string;
schema: string;
maxReplicationLagSec: number;
waitForUserToContinue: boolean;
}, throwIfAborted?: () => void): Promise<void>;
//# sourceMappingURL=waitUntilEverythingIsNotLaggingMuch.d.ts.map