Repository navigation
Complete configured Volume transfers through the native backend #613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
836b8d8
49f32ae
531e8a0
bd3d68c
3a01877
fc0ac1d
b7e0be6
3c6a8cc
0f5be1e
4bf828a
381f4e0
f8df87c
d58e929
191582b
0d84261
2e2c4c7
745f36f
efc0e10
a4f1649
11b1d72
6be0b76
7537263
0a266a2
9003e80
3bf5367
86319e7
7787206
9f511fb
dea2867
08d2e83
5e80236
2de1567
c960aa4
e0d4aaf
c842040
c0e8f45
8f7882e
e2611e0
816d808
40c34bf
e48dfc9
1d03dbe
113f7ad
d848dfa
0947cc8
af167f4
292db68
1bba307
a2b6442
14b8cfb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| dac32e2bf44468bdab06747dad4f289d1c0a18bd | ||
| 56106bbf6a3abcabe5f4245c837cfea368cbd2fb |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,12 +46,13 @@ import { LogLevel } from '../contracts/IDBSQLLogger'; | |
| import { RowMode } from '../contracts/IDBSQLSession'; | ||
| import Status from '../dto/Status'; | ||
| import HiveDriverError from '../errors/HiveDriverError'; | ||
| import StagingError from '../errors/StagingError'; | ||
| import OperationStateError, { OperationStateErrorCode } from '../errors/OperationStateError'; | ||
| import ArrowResultConverter from '../result/ArrowResultConverter'; | ||
| import ResultSlicer from '../result/ResultSlicer'; | ||
| import KernelResultsProvider from './KernelResultsProvider'; | ||
| import { arrowSchemaToThriftSchema, decodeIpcSchema, patchIpcBytes } from './KernelArrowIpc'; | ||
| import { decodeNapiKernelError } from './KernelErrorMapping'; | ||
| import { decodeNapiKernelError, toStagingTransferError } from './KernelErrorMapping'; | ||
| import { | ||
| KernelStatement, | ||
| KernelNativeAsyncStatement, | ||
|
|
@@ -84,7 +85,10 @@ export type KernelOperationStatement = KernelStatementHandle & Partial<KernelSta | |
| * (`KernelResultsProvider` → `ArrowResultConverter` → `ResultSlicer`) consumes | ||
| * either interchangeably. | ||
| */ | ||
| type KernelFetchHandle = Pick<KernelStatement, 'fetchNextBatch' | 'schema'>; | ||
| type KernelFetchHandle = Pick< | ||
| KernelStatement, | ||
| 'fetchNextBatch' | 'schema' | 'isVolumeOperation' | 'completeVolumeOperation' | ||
| >; | ||
|
|
||
| /** | ||
| * The rich operation-status surface the kernel exposes on a terminal sync | ||
|
|
@@ -220,6 +224,8 @@ export default class KernelOperationBackend implements IOperationBackend { | |
| // already-terminal statement. Drives both fetch and result-metadata. | ||
| private fetchHandlePromise?: Promise<KernelFetchHandle>; | ||
|
|
||
| private volumeCompleted = false; | ||
|
|
||
| // Async path only: set once the kernel reported the statement Succeeded (a | ||
| // status poll, or `awaitResult()` resolving). The kernel exposes no | ||
| // synchronous terminal-state accessor, so the observed success is retained. | ||
|
|
@@ -308,6 +314,27 @@ export default class KernelOperationBackend implements IOperationBackend { | |
| // Fetch / metadata (owned by the kernel-results pipeline). | ||
| // --------------------------------------------------------------------------- | ||
|
|
||
| public async completeStagingOperation(allowedPaths: string[]): Promise<void> { | ||
| failIfNotActive(this.lifecycle); | ||
| await this.waitUntilReady(); | ||
| const handle = await this.getFetchHandle(); | ||
| let outcome; | ||
| try { | ||
| outcome = await handle.completeVolumeOperation(allowedPaths, true); // Thrift REMOVE treats missing objects as success. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High — completeStagingOperation calls handle.completeVolumeOperation unconditionally, and assertBindingShape never checks for it. With an older installed binding (platform packages are still pinned to 1.4.0), kernel executeStatement with stagingAllowedLocalPath throws a raw TypeError. Previously it warned and returned results. Add a capability check that gives a clear error, and bump the pins together with this change. 🔀 Found by both reviewers · confirmed by the judge
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Release gate. The kernel ships as 1.5.0 first; this PR then moves every platform package pin and the lockfile to 1.5.0 before merge, so npm installs get a binding with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still open at 0947cc8: the platform pins in package.json:95-102 are still 1.4.0, so this blocks merge until they move to 1.5.0.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correction: the zero-timeout handling no longer applies. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still open at 292db68: package.json:95-102 still pins every platform package to 1.4.0, so this blocks merge until they move to 1.5.0.
aakash-saravanan-db marked this conversation as resolved.
Resolved
aakash-saravanan-db marked this conversation as resolved.
Resolved
aakash-saravanan-db marked this conversation as resolved.
Resolved
aakash-saravanan-db marked this conversation as resolved.
Resolved
aakash-saravanan-db marked this conversation as resolved.
Resolved
aakash-saravanan-db marked this conversation as resolved.
Resolved
aakash-saravanan-db marked this conversation as resolved.
Resolved
aakash-saravanan-db marked this conversation as resolved.
Resolved
|
||
| } catch (err) { | ||
| if (this.lifecycle.isCancelled || this.closeRequested) { | ||
| throw new OperationStateError( | ||
| this.lifecycle.isCancelled ? OperationStateErrorCode.Canceled : OperationStateErrorCode.Closed, | ||
| ); | ||
| } | ||
| throw toStagingTransferError(decodeNapiKernelError(err)); | ||
|
aakash-saravanan-db marked this conversation as resolved.
Resolved
aakash-saravanan-db marked this conversation as resolved.
Resolved
|
||
| } | ||
| if (outcome === 'needs_input_stream') { | ||
| throw new StagingError('Volume PUT requires a local file path'); | ||
| } | ||
| this.volumeCompleted = outcome === 'completed'; | ||
| } | ||
|
|
||
| public async fetchChunk({ | ||
| limit, | ||
| disableBuffering, | ||
|
|
@@ -320,6 +347,7 @@ export default class KernelOperationBackend implements IOperationBackend { | |
| // Cancel-mid-fetch propagation: if cancel() has flipped the | ||
| // lifecycle flag, fail locally without a wire round-trip. | ||
| failIfNotActive(this.lifecycle); | ||
| if (this.volumeCompleted) return []; | ||
| // Cooperative cancel (parity with ThriftOperationBackend): the facade | ||
| // supplies `isClosed` and re-checks `failIfClosed()` after we return, so | ||
| // bailing with `[]` at a yield point is the contract-correct way for a | ||
|
|
@@ -340,6 +368,7 @@ export default class KernelOperationBackend implements IOperationBackend { | |
|
|
||
| public async hasMore(): Promise<boolean> { | ||
| failIfNotActive(this.lifecycle); | ||
| if (this.volumeCompleted) return false; | ||
| try { | ||
| // `hasMore()` prefetches the next batch, so it fails like `fetchChunk()`. | ||
| const slicer = await this.getResultSlicer(); | ||
|
|
@@ -383,7 +412,7 @@ export default class KernelOperationBackend implements IOperationBackend { | |
| // `arrowSchema` doesn't hit apache-arrow@13's `Unrecognized type | ||
| // "Duration" (18)`. Matches what the per-batch fetch path already does. | ||
| arrowSchema: patchIpcBytes(arrowSchemaIpc.ipcBytes), | ||
| isStagingOperation: false, | ||
| isStagingOperation: handle.isVolumeOperation, | ||
| }; | ||
| this.metadata = meta; | ||
| return meta; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.