byteayan commented on code in PR #3355:
URL: https://github.com/apache/hugegraph/pull/3355#discussion_r4307980846


##########
hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh:
##########
@@ -54,6 +54,22 @@ require_env "HG_STORE_RAFT_ADDRESS"
 : "${HG_STORE_GRPC_PORT:=8500}"
 : "${HG_STORE_REST_PORT:=8520}"
 : "${HG_STORE_DATA_PATH:=/hugegraph-store/storage}"
+: "${HG_STORE_ROCKSDB_TOTAL_MEMORY_SIZE:=}"
+
+# Bytes only: the Store parses the value as a long and refuses to start 
otherwise
+if [[ -n "${HG_STORE_ROCKSDB_TOTAL_MEMORY_SIZE}" &&
+      ! "${HG_STORE_ROCKSDB_TOTAL_MEMORY_SIZE}" =~ ^[0-9]+$ ]]; then
+    echo "ERROR: HG_STORE_ROCKSDB_TOTAL_MEMORY_SIZE must be a number of 
bytes," \
+         "got '${HG_STORE_ROCKSDB_TOTAL_MEMORY_SIZE}'" >&2
+    exit 2
+fi
+
+# Only emitted when set: SPRING_APPLICATION_JSON outranks 
conf/application-pd.yml
+ROCKSDB_JSON=""
+if [[ -n "${HG_STORE_ROCKSDB_TOTAL_MEMORY_SIZE}" ]]; then
+    ROCKSDB_JSON=",
+  \"rocksdb\":  { \"total_memory_size\": 
\"${HG_STORE_ROCKSDB_TOTAL_MEMORY_SIZE}\" }"

Review Comment:
   Thanks for confirming it with the real binder, fixed in 8b950e04d. Right 
after `updatePdConfig()` adds `pd-config` first, `keepMemoryOverride()` puts 
back on top a source holding only `rocksdb.total_memory_size`. Its value comes 
from `spring.application.json` (`HG_STORE_ROCKSDB_TOTAL_MEMORY_SIZE` via the 
entrypoint) first, then `systemProperties` (`-D`). No other PD key changes 
precedence, and nothing is written back to PD, since `writeYml` and the PD KV 
are untouched. `PdConfigureListenerMemoryOverrideTest`, now in `CoreSuiteTest`, 
binds `rocksdb` as `Map<String, String>` with Boot's `Binder` against a remote 
32 GB `pd-config`. An explicit 256 MiB, `0` and a `-D` 512 MiB each win, JSON 
beats `-D`, and PD's `write_buffer_size` still applies. The unset-override 
control gets PD's 32 GB, and re-running after a PD reload keeps exactly one 
override on top. With `keepMemoryOverride()` turned into a no-op, the four 
override cases fail and only the control passes. Store core tests: 134 pa
 ssed. The deployment guide now says the variable also outranks the 
PD-distributed `application-pd.yml`.



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