Skip to content

Commit 9393fb4

Browse files
committed
fix: eliminate serialization in Master→QueryDO broadcast
Pass ArrayBuffer and bigint directly via RPC instead of converting footerRaw to number[] and fileSize to string. Zero-copy, zero serialization — consistent with QueryMode's no-materialization design.
1 parent 95610c3 commit 9393fb4

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/master-do.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ export class MasterDO extends DurableObject<Env> {
398398
const regions = (await this.ctx.storage.get<Record<string, string>>("regions")) ?? {};
399399
const payload = {
400400
table, r2Key, columns: footer.columns, format: footer.format ?? "lance",
401-
footerBytes: Array.from(new Uint8Array(footer.raw)),
402-
fileSize: footer.fileSize.toString(), timestamp: Date.now(),
401+
footerRaw: footer.raw,
402+
fileSize: footer.fileSize, timestamp: Date.now(),
403403
...(opts?.totalRows != null ? { totalRows: opts.totalRows } : {}),
404404
...(opts?.r2Prefix != null ? { r2Prefix: opts.r2Prefix } : {}),
405405
};

src/query-do.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,8 @@ export class QueryDO extends DurableObject<Env> {
540540
}
541541

542542
private async executeInvalidation(body: {
543-
table: string; r2Key: string; footerBytes: number[];
544-
columns?: ColumnMeta[]; fileSize?: string; timestamp: number;
543+
table: string; r2Key: string; footerRaw: ArrayBuffer;
544+
columns?: ColumnMeta[]; fileSize: bigint; timestamp: number;
545545
format?: "lance" | "parquet" | "iceberg";
546546
totalRows?: number; r2Prefix?: string;
547547
}): Promise<void> {
@@ -565,8 +565,8 @@ export class QueryDO extends DurableObject<Env> {
565565
// Parquet invalidation — columns already parsed by Master
566566
columns = body.columns;
567567
} else {
568-
// Lance invalidation — parse footer from raw bytes
569-
const parsed = parseFooter(new Uint8Array(body.footerBytes).buffer);
568+
// Lance invalidation — parse footer from raw ArrayBuffer (zero-copy via RPC)
569+
const parsed = parseFooter(body.footerRaw);
570570
if (!parsed) throw new Error("Invalid footer");
571571
footer = parsed;
572572
columns = body.columns ?? await this.readColumnMeta(body.r2Key, parsed);
@@ -579,7 +579,7 @@ export class QueryDO extends DurableObject<Env> {
579579
const meta: TableMeta = {
580580
name: body.table, footer, format: fmt, columns,
581581
totalRows,
582-
fileSize: body.fileSize ? BigInt(body.fileSize) : 0n,
582+
fileSize: body.fileSize,
583583
r2Key: body.r2Key, updatedAt: body.timestamp,
584584
};
585585

0 commit comments

Comments
 (0)