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

   ## Purpose of the PR
   
   - part of #3090 (the HStore clear and recreate lifecycle item, including 
`infoInitializedGraph`)
   
   `HstoreSessionsImpl` registers each graph with PD once per JVM and records 
that in the static `infoInitializedGraph` set. `clear()` deletes the graph from 
the Store and from PD but never removes it from that set, and only `open()` 
registers a graph. When a running graph is cleared and initialized again, 
`clearBackend()` closes the stores, but the running graph still holds their 
sessions. `initBackend()`'s `open()` then takes the "opened before" early 
return in `HstoreStore.open()`, and `init()` creates tables for a graph PD no 
longer has. imbajin pointed out this path on #3141, which only removed the 
marker and was closed.
   
   ## Main Changes
   
   - The registration moved into `registerGraph()`. `open()` calls it as 
before, and `createTable()`, which `HstoreStore.init()` calls, now calls it 
too, so `init()` registers the graph whether or not `open()` returned early. 
While the marker is set it does nothing, so a normal start still registers once.
   - `clear()` removes the marker in a `finally` block, including when PD 
refuses `delGraph` or the Store-side delete throws, since the graph may already 
be gone on either side.
   - A registration failure in `createTable()` throws `BackendException` 
instead of creating tables for an unregistered graph. `open()` keeps its 
current behavior: `HstoreStore.open()` logs the error.
   
   The other items in #3090 (the property codec, the schema cleanup wait, the 
test guards) are not part of this change.
   
   ## 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:
       - `HstoreSessionsImplTest.testInitAfterClearRegistersGraphAgain` drives 
`HstoreSchemaStore` through its public calls with mocked `PDClient` and 
`HgStoreClient`: `open` and `init`, a second `open` for the running graph, then 
50 rounds of `open`/`clear(true)`/`close` followed by `open`/`init`/`close`. 
Each round must call `delGraph` once more and `setGraph` once more. Without the 
fix it fails in the first round, with `setGraph` called once where two calls 
are expected.
       - `testInitAfterFailedDeleteRegistersGraphAgain`: `delGraph` throws 
`PDException`, and `init()` after `clear(true)` still registers the graph.
       - `mvn test -pl hugegraph-server/hugegraph-hstore`: 21 tests, 0 failures.
       - Not run against a live PD and Store cluster.
   
   ## 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
   
   - [ ] `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