Repository navigation
Commit be929ac
[fix](flight-sql) Finish the previous request before checking a prepared handle
### What problem does this PR solve?
Issue Number: None
Related PR: #68631
Problem Summary:
A prepared GetFlightInfo checks its handle before it executes anything:
the handle must exist, the session must still be in the namespace it was
prepared in, and the statement re-analyzed now must have the schema that
Prepare advertised. `executePreparedStatement` ran these checks before
`executeQueryStatement` reached `FlightProtocolAdapter.beginRequest()`,
where a request drops what the previous one left: its deferred
coordinator, the frontend-side result no DoGet took, and its endpoints.
A handle that the checks refused therefore left all three in place. The
previous query's deferred coordinator, which a batch-mode external-table
scan or a remote Doris scan leaves, kept its workload group queue slot
and its query registration until the session's next statement, the
timeout checker or teardown, and the previous frontend-side result could
still be fetched. Before #69867, every prepared GetFlightInfo reached
`executeQueryStatement`, and a missing handle failed inside it, where the
catch finalized the previous coordinator.
`executePreparedStatement` now calls `beginRequest()` before the checks:
a prepared execution is the session's next request whatever they find.
Prepare and GetSchema are metadata requests and still leave the previous
request alone, so the call is neither in the session's command lock nor
in `preparedQuery()`, which GetSchema goes through too.
A checked handle whose statement could no longer be described when it was
re-analyzed answered UNIMPLEMENTED and was kept, so every later execution
failed the same way. That happens after a column grant is revoked so that
the analyzed plan is denied, or after a DDL that turns a result column
into an untyped NULL. The check now compares the schema Prepare would
advertise now, the placeholder for such a statement: the handle is
removed and the request answers NOT_FOUND "Prepared statement schema
changed; prepare again", as for any other schema change, and the
statement prepared again keeps the placeholder and runs unchecked.
Prepare and the check share `advertisedSchema` for this.
### Release note
A Flight SQL prepared execution refused before it runs no longer keeps the
previous query's deferred coordinator and result. A prepared statement
whose result schema can no longer be determined before it runs answers
NOT_FOUND and must be prepared again.
### Check List (For Author)
- Test: Unit Test, Regression test
- `DorisFlightSqlSchemaTest` adds one test for each way the checks
refuse a handle: a missing handle, a namespace change, a sql_mode
drift, a dropped view (INVALID_ARGUMENT, the handle is kept) and a
revoked column grant (NOT_FOUND, the handle is removed, and
preparing again gives the placeholder). Each sends GetSchema and
GetFlightInfo after a previous request left a deferred executor, a
frontend-side result and an endpoint, and checks that only
GetFlightInfo finished it.
- Without the new `beginRequest()` call the five tests fail at
GetFlightInfo; with the call in `preparedQuery()` they fail at
GetSchema; with the previous UNIMPLEMENTED only the revoked-grant
test fails.
- 45 FE test classes (555 tests) pass and fe-core Checkstyle is clean.
- Local cluster: all 21 suites under `arrow_flight_sql_p0`,
`test_uuid_arrow_flight` and `test_sort_operator` over Flight SQL
pass.
- Behavior changed: Yes. A prepared GetFlightInfo that its checks refuse
finishes the previous request first. A checked handle that can no
longer be described is removed and answers NOT_FOUND instead of
UNIMPLEMENTED.
- Does this need documentation: No
Co-Authored-By: Claude Opus 5.5 <[email protected]>1 parent 36772dc commit be929ac
2 files changed
Lines changed: 162 additions & 16 deletions
File tree
- fe/fe-core/src
- main/java/org/apache/doris/arrowflight
- test/java/org/apache/doris/arrowflight
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
404 | 408 | | |
405 | 409 | | |
406 | 410 | | |
| |||
489 | 493 | | |
490 | 494 | | |
491 | 495 | | |
492 | | - | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
493 | 500 | | |
494 | 501 | | |
495 | | - | |
496 | | - | |
| 502 | + | |
| 503 | + | |
497 | 504 | | |
498 | 505 | | |
499 | 506 | | |
500 | 507 | | |
501 | 508 | | |
502 | 509 | | |
503 | 510 | | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
504 | 522 | | |
505 | 523 | | |
506 | | - | |
| 524 | + | |
507 | 525 | | |
508 | 526 | | |
509 | | - | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
510 | 535 | | |
511 | 536 | | |
512 | 537 | | |
| |||
564 | 589 | | |
565 | 590 | | |
566 | 591 | | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
| 592 | + | |
578 | 593 | | |
579 | 594 | | |
580 | 595 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
36 | 38 | | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| |||
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| 48 | + | |
45 | 49 | | |
46 | 50 | | |
47 | 51 | | |
| |||
924 | 928 | | |
925 | 929 | | |
926 | 930 | | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
927 | 1058 | | |
0 commit comments