bitflicker64 commented on code in PR #3349:
URL: https://github.com/apache/hugegraph/pull/3349#discussion_r4282872143


##########
helm/hugegraph/templates/tests/test-connection.yaml:
##########
@@ -16,6 +16,18 @@
 #
 
 {{ include "hugegraph.resolveValues" . }}
+{{- $smoke := `def ids = [] as Set;
+(graph.schema().getVertexLabels() + graph.schema().getEdgeLabels()).each {
+    ids.addAll(it.indexLabels())
+};
+ids.each {
+    def index = graph.indexLabel(it);

Review Comment:
   Important: On hstore this read can create the stale state the hook is meant 
to detect, and the retry window cannot clear it.
   
   `graph.indexLabel(it)` goes through 
`CachedSchemaTransactionV2.getSchema(type, id)` (the schema transaction 
`StandardHugeGraph.openSchemaTransaction()` uses for hstore), which loads the 
index label from meta on a miss and stores it in the id cache; the cache has no 
expiry ("must disable schema cache-expire" in `cache()`). A new index label is 
saved as `CREATING` (`IndexLabelBuilder.createWithTask()`, `rebuild` defaults 
to true), and `addSchema` broadcasts a cache clear, so other Pods start with no 
entry for it. The rebuild job then moves it to `CREATED` through 
`updateSchemaStatus()` -> `updateSchema()`, which updates only the local cache 
and deliberately sends no broadcast (comment in 
`CachedSchemaTransactionV2.updateSchema`). `REBUILDING` follows the same path 
in `IndexLabelRebuildJob`.
   
   So if `helm test` runs while an index job is in progress, every Server Pod 
except the one running the job caches `CREATING` on the first sweep. Each later 
attempt reads the same cached value, the hook fails at the deadline, and after 
the hook exits those Pods keep rejecting indexed queries on that label in 
`GraphIndexTransaction.validateIndexLabel()` until they restart or a later 
schema create or remove broadcasts a cache clear. Before this PR the hook never 
read index labels, so on an idle cluster this outcome depends on the test being 
run. `docs/operations.md` line 295 says the retry window "allows transient 
index work to settle before the hook fails", which only holds for the Pod that 
ran the job.
   
   Requested change: do not load index labels while index work is running. For 
example, first query the task scheduler for unfinished `rebuild_index` tasks 
and fail with a message to rerun after they finish, without calling 
`graph.indexLabel()`. If the read stays as it is, replace line 295 and README 
line 193 with a warning that on hstore, running `helm test` before index jobs 
finish can leave Pods failing indexed queries until restart, and that the retry 
window does not cover this.



-- 
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