Repository navigation
Commit d7d56cf
Fix paginated getChildren returning no children for the root path (#160)
* Fix paginated getChildren returning no children for the root path
DataTree.buildChildrenPathWithStat looked children up as path + "/" + child,
which yields "//child" for "/", so every child was skipped and the server
replied with an empty last page. Use "/child" for the root.
Only paginated listings that take the sorted path were affected: bounded page
sizes, minCzxId > 0, or a response larger than jute.maxbuffer.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Strengthen root pagination tests
The previous assertions could pass even without the DataTree fix:
- The watch count was only checked after pagination finished. With the
"//child" bug the child list is empty, so index ends at -1 == size-1 and
the watch is registered on the very first page -- yielding the same final
count. The count is now asserted after every page: unchanged before the
last page, incremented on it.
- Children were created in lexical order, which matched czxid order, so a
regression that sorted by name instead of czxid would still have passed.
They are now created in reverse lexical order.
- "zookeeper" was filtered out, so its presence and position were never
checked. The full ordered list is now asserted.
- The end-to-end test collected into a Set, hiding duplicates and ordering
errors. It now collects into a List and asserts creation order.
Both tests were confirmed to fail with the fix reverted and pass with it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 9b0eeef commit d7d56cf
3 files changed
Lines changed: 88 additions & 1 deletion
File tree
- zookeeper-server/src
- main/java/org/apache/zookeeper/server
- test/java/org/apache/zookeeper
- server
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
976 | 976 | | |
977 | 977 | | |
978 | 978 | | |
| 979 | + | |
| 980 | + | |
979 | 981 | | |
980 | | - | |
| 982 | + | |
981 | 983 | | |
982 | 984 | | |
983 | 985 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
415 | 416 | | |
416 | 417 | | |
417 | 418 | | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
418 | 470 | | |
419 | 471 | | |
420 | 472 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
130 | 163 | | |
131 | 164 | | |
132 | 165 | | |
| |||
0 commit comments