getDebugInfo() for Bulldozer
Some checks failed
all-good: Did all the other checks pass? / all-good (push) Has been cancelled
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
DB migration compat / Check if migrations changed (push) Has been cancelled
Docker Server Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Server Build and Run / docker (push) Has been cancelled
Runs E2E API Tests / E2E Tests (Node ${{ matrix.node-version }}, Freestyle ${{ matrix.freestyle-mode }}) (mock, 22.x) (push) Has been cancelled
Runs E2E API Tests / E2E Tests (Node ${{ matrix.node-version }}, Freestyle ${{ matrix.freestyle-mode }}) (prod, 22.x) (push) Has been cancelled
Runs E2E API Tests with custom port prefix / build (22.x) (push) Has been cancelled
Runs E2E Fallback Tests / E2E Fallback Tests (Node ${{ matrix.node-version }}) (22.x) (push) Has been cancelled
Lint & build / lint_and_build (24) (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
DB migration compat / Back-compat — Current branch migrations with ${{ needs.check-migrations-changed.outputs.base_branch }} branch code (push) Has been cancelled
DB migration compat / Forward-compat — Current branch code with ${{ needs.check-migrations-changed.outputs.base_branch }} branch migrations (push) Has been cancelled
DB migration compat / No migration changes (skipped) (push) Has been cancelled

This commit is contained in:
Konstantin Wohlwend 2026-07-02 17:04:15 -07:00
parent c21fa2ee88
commit d568752a3d
7 changed files with 78 additions and 1 deletions

View File

@ -579,6 +579,7 @@ function createTablesStateFromMigrations(migrations: readonly BulldozerDatabaseM
}
export type BulldozerDatabase = {
getDebugInfo(): any,
listTables(): BulldozerDatabaseTableDescriptor[],
debugPiledriverSnapshot?(): Promise<PiledriverDatabaseDebugSnapshot>,
debugLowLevelSnapshot?(): Promise<LowLevelDatabaseDebugSnapshot>,
@ -641,6 +642,18 @@ export function declareBulldozerDatabase(piledriverDatabase: PiledriverDatabase,
};
return {
getDebugInfo() {
return {
backend: "bulldozer",
constructorArguments: { piledriverDatabase, options },
piledriverDatabase,
rootKey,
getRoot,
setRoot,
tablesState,
currentOperation,
};
},
listTables: () => Object.entries(tablesState.tables).map(([tableId, tableState]) => ({
tableId,
inputTableIds: { ...tableState.inputTableIds },

View File

@ -1,6 +1,7 @@
export type DatabaseSeq = (readonly (string | number)[] & { __brand: "hexclave-low-level-kv-store-seq" });
export type Database = {
getDebugInfo(): any,
/**
* Returns a promise that resolves once it is guaranteed that queries made from this database client will see the
* given seq.

View File

@ -127,8 +127,15 @@ export function declareInMemoryLowLevelDatabase(dbId: string): LowLevelDatabase
return result;
};
return {
getDebugInfo() {
return {
backend: "in-memory",
constructorArguments: { dbId },
inMemoryLowLevelKvStores,
debugEntriesByStoreId,
};
},
declareKvDump(dumpId) {
return declareInMemoryLowLevelKvStoreOrDump("dump", JSON.stringify([dbId, dumpId]));
},

View File

@ -38,6 +38,16 @@ function createSlowSetDatabase() {
},
};
const db: LowLevelDatabase = {
getDebugInfo() {
return {
backend: "slow-set-test",
releaseSets,
setCallCount,
committed,
seqToPromise,
initialSeq,
};
},
declareKvStore: () => store,
declareKvDump: () => {
throw new Error("not implemented");

View File

@ -243,6 +243,23 @@ export function declareInstantAvailabilityLowLevelDatabase(wrapped: LowLevelData
};
return {
getDebugInfo() {
return {
backend: "instant-availability",
constructorArguments: { wrapped, options },
wrapped,
dbId,
maxPendingSeqRecords,
initialSeq,
seqRecords,
createdSeqRecords,
underlyingAvailableSeqRecords,
pendingSeqRecords,
currentWriteGateOperation,
pendingSeqRecordsChanged,
cacheMaps,
};
},
declareKvStore(id) {
return declareStoreOrDump(wrapped.declareKvStore(id) as LowLevelKvStore & LowLevelKvDump);
},

View File

@ -243,6 +243,21 @@ export function declareLmdbLowLevelDatabase(options: { path: string, dbId?: stri
};
return {
getDebugInfo() {
return {
backend: "lmdb",
constructorArguments: options,
dbId,
simulateReadMissDelayMs,
root,
meta,
currentVersion,
debugEntriesByStoreId,
seqToAvailability,
seqToDurability,
initialSeq,
};
},
declareKvDump(dumpId) {
return declareLmdbLowLevelKvStoreOrDump("dump", dumpId);
},

View File

@ -287,6 +287,20 @@ export function declarePiledriverDatabase(lowLevelDb: LowLevelDatabase, options:
};
return {
getDebugInfo() {
return {
backend: "piledriver",
constructorArguments: { lowLevelDb, options },
lowLevelDb,
rootStore,
heapDump,
heapObjectsByObject,
heapObjectsByHeapKeyBase64,
heapObjectsByHeapKeyFinalizer,
heapKeysAndSeqByHeapObjects,
heapReadCacheDisabled: options.disableHeapReadCache === true,
};
},
async getRootObject(key): Promise<{ object: PiledriverObject, seq: DatabaseSeq }> {
return await traceSpan("bulldozer-js.piledriver.getRootObject", async () => {
const { buffer, seq: rootSeq } = await rootStore.get(key);