bitflicker64 opened a new pull request, #3369:
URL: https://github.com/apache/hugegraph/pull/3369

   ## Purpose of the PR
   
   - Related to #3242. The 1.8.0 checklist asks for these Server fixes to be 
split out from the schema cache sync work (#3235).
   
   Two Server bugs and one missing regression test, found while working on 
schema sync. None of them depends on the sync protocol.
   
   ## Main Changes
   
   1. `fix(server): keep the schema id counters on hstore truncate`
      `HstoreSessionsImpl.truncate()` called `resetIdByKey()` for the store's 
graph name. For the schema store that is `{graphspace}/{graph}/m`, so PD 
dropped every schema id counter of the graph, while the schema itself stays in 
PD meta and survives the truncate. The truncating Server kept handing out ids 
from its cached range, but any other Server, or the same one after a restart, 
got ids from 1 again and reused the ids of existing schema elements. Truncate 
no longer resets the counters.
   2. `fix(server): delete only auth keys in the graphspace auth clear`
      `clearGraphSpace()` deletes `HUGEGRAPH/{cluster}/GRAPHSPACE/{gs}/AUTH` by 
prefix. Graph keys sit beside `AUTH` under the graphspace, so the prefix also 
matched every key of a graph named `AUTH` or named with `AUTH` at the start, 
such as `AUTHx`, and wiped its schema and task keys. Graph names created 
through the API are lower case, so only an upper-case name loaded from local 
config or meta can hit this. The clear now deletes the five kinds of graphspace 
auth keys (`ROLE`, `TARGET`, `BELONG`, `ACCESS`, `PROJECT`), each up to its 
path delimiter, and nothing else under `AUTH`.
   3. `test(server): cover the graph space clear for names sharing a prefix`
      `GraphManager.clearGraphSpace()` used to pick the graphs and services to 
drop by checking that their `{graphspace}-{name}` key starts with the graph 
space name, so clearing `gs` also dropped the graphs and services of `gs2` and 
`gs_x`. #3308 now matches the key up to the delimiter. This commit adds the 
regression test for that behaviour.
   
   ## Verifying these changes
   
   - [ ] Trivial rework / code cleanup without any test coverage. (No Need)
   - [ ] Already covered by existing tests, such as *(please modify tests 
here)*.
   - [x] Need tests and can be verified as follows:
       - New tests: 
`MultiGraphsTest#testHstoreTruncateBackendKeepsSchemaIdCounters`, 
`AuthMetaManagerTest#testClearGraphAuthKeepsGraphsNamedLikeAuth`, 
`GraphManagerClearGraphSpaceTest#testClearKeepsGraphsOfSpacesNamedLikeIt`.
       - Run on this head (bfb021c83) on 2026-10-17, JDK 17.0.20, Linux x86_64:
         - `mvn test -pl hugegraph-server/hugegraph-test -am -P unit-test`: 
1295 run, 0 failures, 0 errors, 8 skipped.
         - With the old `startsWith(name)` match put back in 
`GraphManager.clearGraphSpace()`, `testClearKeepsGraphsOfSpacesNamedLikeIt` 
fails.
         - `mvn editorconfig:check`: clean.
       - Run on the earlier version of these commits, on base 000d538ab, on 
2026-10-11 (commit 3 then also carried the `GraphManager` change that #3308 has 
since made upstream):
         - `mvn test -pl hugegraph-server/hugegraph-test -am -P 
core-test,hstore` against PD and Store started from the packaged dists with 
`install-backend.sh hstore`, as in CI: 928 run, 0 failures, 0 errors, 53 
skipped.
         - With the old `HstoreSessionsImpl.java` put back, the new truncate 
test fails with `id 1 reused after 20001`.
         - With the old `AuthMetaManager.java` put back, 
`testClearGraphAuthKeepsGraphsNamedLikeAuth` fails. It also fails with a 
version that only ends the prefix at `AUTH/`, which still deletes the keys of a 
graph named `AUTH`.
       - Not run locally: the API tests. CI runs those.
   
   ## Does this PR potentially affect the following parts?
   
   - [ ]  Dependencies ([add/update 
license](https://hugegraph.apache.org/docs/contribution-guidelines/contribute/#321-check-licenses)
 info & 
[regenerate_known_dependencies.sh](../install-dist/scripts/dependency/regenerate_known_dependencies.sh))
   - [ ]  Modify configurations
   - [ ]  The public API
   - [ ]  Other affects (typed here)
   - [x]  Nope
   
   
   ## Documentation Status
   
   Select one option and provide the documentation location when applicable.
   
   - [ ] `Doc - TODO`: required documentation is pending; complete it before 
merging.
   - [ ] `Doc - Done`: documentation is included here or linked below.
   - [x] `Doc - No Need`: no user-visible documentation is affected.
   
   Documentation files in this PR or paired hugegraph-doc PR:
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to