Commit 368945a
committed
[SEA-NodeJS] Address code-review findings on async/TLS/options (#413)
Code-review #413 (81/100). Validated each against the code + a live warehouse:
- F1 (HIGH): the async poll loop threw plain HiveDriverError for server-driven
Cancelled/Closed/Unknown. The DBSQLOperation facade only mirrors its
cancelled/closed flags when `err instanceof OperationStateError` (and
OperationStateError extends HiveDriverError, not the reverse), so a
server-side cancel/close/admin-kill left the facade desynced. Now throws
OperationStateError(Canceled/Closed/Unknown) — matching the Thrift backend.
The Failed branch still surfaces the kernel SQL-error envelope via awaitResult.
- F2 (MED): the server-Cancelled test asserted only instanceOf(HiveDriverError),
which passes for both the correct and incorrect type — it couldn't catch F1.
Now asserts instanceOf(OperationStateError) + errorCode, plus a new Closed test.
- F3 (MED): queryTimeout was forwarded to submitStatement but the kernel ignores
queryTimeoutSecs on submit (always wait_timeout=0s), so the documented public
option was a silent no-op, and the poll loop had no client-side deadline (a
stalled Running statement polled forever). Now enforced client-side: the poll
loop tracks a deadline, best-effort cancels the statement on expiry, and
throws OperationStateError(Timeout) — matching Thrift's server TIMEDOUT
outcome. Stopped forwarding the ignored queryTimeoutSecs to the napi options.
Validated live: a 2s timeout interrupts a slow cross-join with TIMEOUT.
- F4 (LOW): customCaCert PEM string check now requires the END marker too (a
truncated/headerless cert no longer passes), consistent with the Buffer path.
- F5 (LOW): SeaAuth reads the SEA-only fields (checkServerCertificate /
customCaCert / maxConnections) through `InternalConnectionOptions` instead of
ad-hoc inline casts, so a typo'd key fails to compile.
- F6 (LOW): corrected the poll-loop comment — the prior text justified polling
by an incorrect "blocking awaitResult holds the mutex and queues cancel"
claim; cancel() is documented lock-free. The real rationale (real-time
status to the progress callback + cancel observed between ticks) is now stated.
Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>1 parent 32929aa commit 368945a
4 files changed
Lines changed: 120 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
181 | 182 | | |
182 | 183 | | |
183 | 184 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
188 | 189 | | |
189 | 190 | | |
190 | 191 | | |
| |||
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
197 | | - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
198 | 205 | | |
199 | 206 | | |
200 | | - | |
| 207 | + | |
| 208 | + | |
201 | 209 | | |
202 | 210 | | |
203 | 211 | | |
| |||
293 | 301 | | |
294 | 302 | | |
295 | 303 | | |
296 | | - | |
| 304 | + | |
297 | 305 | | |
298 | 306 | | |
299 | 307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
124 | 134 | | |
125 | 135 | | |
126 | 136 | | |
| |||
154 | 164 | | |
155 | 165 | | |
156 | 166 | | |
157 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
158 | 172 | | |
159 | 173 | | |
160 | 174 | | |
| |||
163 | 177 | | |
164 | 178 | | |
165 | 179 | | |
| 180 | + | |
166 | 181 | | |
167 | 182 | | |
168 | 183 | | |
| |||
329 | 344 | | |
330 | 345 | | |
331 | 346 | | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
340 | 363 | | |
341 | 364 | | |
342 | 365 | | |
343 | 366 | | |
344 | 367 | | |
345 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
346 | 372 | | |
347 | 373 | | |
348 | 374 | | |
| |||
373 | 399 | | |
374 | 400 | | |
375 | 401 | | |
376 | | - | |
| 402 | + | |
377 | 403 | | |
378 | | - | |
| 404 | + | |
379 | 405 | | |
380 | | - | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
381 | 416 | | |
382 | 417 | | |
383 | 418 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
173 | 181 | | |
174 | 182 | | |
175 | 183 | | |
| |||
195 | 203 | | |
196 | 204 | | |
197 | 205 | | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
203 | 209 | | |
204 | 210 | | |
205 | 211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
515 | 516 | | |
516 | 517 | | |
517 | 518 | | |
518 | | - | |
| 519 | + | |
519 | 520 | | |
520 | 521 | | |
521 | 522 | | |
522 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
523 | 527 | | |
524 | 528 | | |
525 | 529 | | |
| |||
734 | 738 | | |
735 | 739 | | |
736 | 740 | | |
737 | | - | |
| 741 | + | |
738 | 742 | | |
739 | | - | |
| 743 | + | |
740 | 744 | | |
741 | 745 | | |
742 | 746 | | |
| |||
794 | 798 | | |
795 | 799 | | |
796 | 800 | | |
797 | | - | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
798 | 808 | | |
799 | 809 | | |
800 | 810 | | |
801 | 811 | | |
802 | 812 | | |
803 | 813 | | |
804 | 814 | | |
805 | | - | |
806 | | - | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
807 | 846 | | |
808 | 847 | | |
809 | 848 | | |
| |||
0 commit comments