Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): speed up shell snapshots on large databases #23751

MergedYash-Singh1(GitHub profile, opens in a new tab)merged 7 commits intomain fromrefs/pull/23751/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 5 changed files with 164 additions and 0 deletions (loading 4).

x
0 of 5 viewed, 5 left
164 additions and 0 deletionsapps/server/src/orchestration-v2/ProjectionStore.test.tsModified
View file
@@ -2374,6 +2374,170 @@
+ it.effect("looks up shell stop requests through the interrupt request index", () =>
+ Effect.gen(function* () {
+ const projectionStore = yield* ProjectionStore.ProjectionStoreV2;
+ const sql = yield* SqlClient.SqlClient;
+ const { projectId } = yield* assertProjectScopedShells("sql-shell-stop-index");
+ const { statements, tracer } = traceSqlStatements();
+ yield* projectionStore
+ .getShellSnapshot({ projectId, location: "active" })
+ .pipe(Effect.withTracer(tracer));
+​
+ const threadQuery = statements.find((statement) =>
+ statement.includes("AS latest_run_stop_requested"),
+ );
+ assert.isDefined(threadQuery);
+ const stopRequestLookups = (yield* sql.unsafe<{ readonly detail: string }>(
+ `EXPLAIN QUERY PLAN ${threadQuery}`,
+ ))
+ .map((row) => row.detail)
+ .filter((detail) => detail.startsWith("SEARCH stop_request "));
+ assert.lengthOf(stopRequestLookups, 2);
+ for (const lookup of stopRequestLookups) {
+ assert.include(lookup, "orchestration_v2_projection_turn_items_stop_request_idx");
+ }
+ }),
+ );
+​