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


##########
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:
   ⚠️ Important: This value enters through SPRING_APPLICATION_JSON, but 
StoreNodeApplication installs PdConfigureListener, which can add a PD-managed 
application-pd.yml at the front of the property sources before RocksdbConfig 
binds. If that file contains rocksdb.total_memory_size, it shadows 
HG_STORE_ROCKSDB_TOTAL_MEMORY_SIZE, so the documented per-Store override can be 
ignored and an old large budget can remain active. Please preserve this 
environment value as highest priority after PD configuration is loaded and 
cover that precedence case.



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