Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pd): integrate pd-dist into hugegraph & add core tests, client tests, and REST tests for PD #2532

Merged
merged 11 commits into from
May 6, 2024
Merged
Prev Previous commit
chore: delete binary license file
  • Loading branch information
imbajin committed May 6, 2024
commit c12d3673c98097f26def80c1223ee9a1609f52d3
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ PID_FILE="$BIN/pid"
ensure_path_writable "$LOGS"
ensure_path_writable "$PLUGINS"

# The maximum and minium heap memory that service can use
# The maximum and minimum heap memory that service can use
MAX_MEM=$((32 * 1024))
MIN_MEM=$((1 * 512))
EXPECT_JDK_VERSION=11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if [ ! -f ${PID_FILE} ]; then
exit 0
fi

PID=`cat $PID_FILE`
PID=$(cat $PID_FILE)
kill_process_and_wait "HugeGraphPDServer" "$PID" "$SERVER_SHUTDOWN_TIMEOUT_S"

if [ $? -eq 0 ]; then
Expand Down
5 changes: 3 additions & 2 deletions hugegraph-pd/hg-pd-dist/src/assembly/static/bin/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# limitations under the License.
#

# TODO: consider reuse it with server-dist module (almost same as it)
function command_available() {
local cmd=$1
if [ $(command -v $cmd >/dev/null 2>&1) ]; then
Expand All @@ -31,7 +32,7 @@ function read_property() {
# file path
file_name=$1
# replace "." to "\."
property_name=`echo $2 | sed 's/\./\\\./g'`
property_name=$(echo $2 | sed 's/\./\\\./g')
cat $file_name | sed -n -e "s/^[ ]*//g;/^#/d;s/^$property_name=//p" | tail -1
}

Expand All @@ -40,7 +41,7 @@ function write_property() {
local key=$2
local value=$3

local os=`uname`
local os=$(uname)
case $os in
# Note: in mac os should use sed -i '' "xxx" to replace string,
# otherwise prompt 'command c expects \ followed by text'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ management:

logging:
config: 'file:./conf/log4j2.xml'
# TODO: handle the license file later (PDConfig)
license:
verify-path: ./conf/verify-license.json
license-path: ./conf/hugegraph.license
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
filePattern="${LOG_PATH}/$${date:yyyy-MM}/audit-${FILE_NAME}-%d{yyyy-MM-dd-HH}-%i.gz"
bufferedIO="true" bufferSize="524288" immediateFlush="false">
<ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY" />
<!-- Use simple format for audit log to speed up -->
<!-- Use a simple format for audit log to speed up -->
<!-- PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} - %m%n"/ -->
<JsonLayout compact="true" eventEol="true" locationInfo="true">
<KeyValuePair key="timestamp" value="$${date:yyyy-MM-dd HH:mm:ss.SSS}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,7 @@ public void balanceLeaders(Pdpb.BalanceLeadersRequest request,
observer.onCompleted();
}

// TODO: keep it now & clean it later
@Override
public void putLicense(PutLicenseRequest request,
StreamObserver<PutLicenseResponse> responseObserver) {
Expand All @@ -1366,12 +1367,12 @@ public void putLicense(PutLicenseRequest request,
}
FileUtils.writeByteArrayToFile(licenseFile, content, false);
} catch (Exception e) {
log.error("putLicense with error: {}", e);
log.error("putLicense with error:", e);
if (moved) {
try {
FileUtils.moveFile(bakFile, licenseFile);
} catch (IOException ex) {
log.error("failed to restore the license file.{}", ex);
log.error("failed to restore the license file:", ex);
}
}
Pdpb.ResponseHeader header =
Expand Down
Loading