Skip to content

Commit

Permalink
fix(interactive): Make rust log location conform to LOG_DIR environme…
Browse files Browse the repository at this point in the history
…nt variable. (#3716)
  • Loading branch information
siyuan0322 authored Apr 17, 2024
1 parent 15d5fc2 commit 988aa46
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 40 deletions.
41 changes: 7 additions & 34 deletions interactive_engine/assembly/src/bin/groot/store_ctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,57 +22,30 @@ END

# a function to setup common variable and env
_setup_env() {
declare script="$0"
SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd)
if [ -z "${GROOT_HOME}" ]; then
# set GROOT_HOME base location of the script
while [ -h "${script}" ]; do
ls=$(ls -ld "${script}")
# Drop everything prior to ->
link=$(expr "${ls}" : '.*-> \(.*\)$')
if expr "${link}" : '/.*' >/dev/null; then
script="${link}"
else
script="$(dirname ${script})/${link}"
fi
done
GROOT_HOME=$(dirname "${script}")
GROOT_HOME=$(
cd "${GROOT_HOME}"
pwd
)
readonly GROOT_HOME=$(dirname ${GROOT_HOME})
fi

if [ -z "${GROOT_CONF_DIR}" ]; then
readonly GROOT_CONF_DIR="${GROOT_HOME}/conf"
GROOT_HOME=$(dirname "$SCRIPT_DIR")
fi

if [ -z "${GROOT_LOGBACK_FILE}" ]; then
readonly GROOT_LOGBACK_FILE="${GROOT_CONF_DIR}/logback.xml"
readonly GROOT_LOGBACK_FILE="${GROOT_HOME}/conf/logback.xml"
fi

if [ -z "${GROOT_CONF_FILE}" ]; then
readonly GROOT_CONF_FILE="${GROOT_CONF_DIR}/groot.config"
readonly GROOT_CONF_FILE="${GROOT_HOME}/conf/groot.config"
fi

if [ -z "${LOG_NAME}" ]; then
readonly LOG_NAME="groot"
readonly LOG_NAME="graphscope-store"
fi

export LD_LIBRARY_PATH=${GROOT_HOME}/native:${GROOT_HOME}/native/lib:${LD_LIBRARY_PATH}:/usr/local/lib

if [ -z "${LOG_DIR}" ]; then
GS_LOG="/var/log/graphscope"
if [[ ! -d "${GS_LOG}" || ! -w "${GS_LOG}" ]]; then
# /var/log/graphscope is not existed/writable, switch to ${HOME}/.local/log/graphscope
GS_LOG=${HOME}/.local/log/graphscope
fi
readonly GS_LOG
export LOG_DIR=${GS_LOG}
export LOG_DIR="/var/log/graphscope"
fi

mkdir -p ${LOG_DIR}

export LD_LIBRARY_PATH=${GROOT_HOME}/native:${GROOT_HOME}/native/lib:${LD_LIBRARY_PATH}:/usr/local/lib
libpath="$(echo "${GROOT_HOME}"/lib/*.jar | tr ' ' ':')"
}

Expand Down
4 changes: 2 additions & 2 deletions interactive_engine/assembly/src/conf/groot/log4rs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ appenders:
file:
kind: rolling_file
append: true
path: "/var/log/graphscope/store-executor.log"
path: "$ENV{LOG_DIR}/store-executor.log"
encoder:
pattern: "{d(%Y-%m-%d %H:%M:%S.%f)} {h({l:<5})} (({f}:{L})) [{T}] {m}{n}"
policy:
Expand All @@ -16,7 +16,7 @@ appenders:
limit: 100mb
roller:
kind: fixed_window
pattern: "/var/log/graphscope/store-executor.log.{}"
pattern: "$ENV{LOG_DIR}/store-executor.log.{}"
count: 10

root:
Expand Down
9 changes: 6 additions & 3 deletions interactive_engine/executor/store/groot/src/db/graph/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,14 +562,14 @@ impl MultiVersionGraph for GraphStore {

fn gc(&self, si: i64) -> GraphResult<()> {
let vertex_tables = self.vertex_manager.gc(si)?;
info!("garbage collect vertex table {:?}", vertex_tables);
for vt in vertex_tables {
info!("garbage collect vertex table {}", vt);
let table_prefix = vertex_table_prefix(vt);
self.delete_table_by_prefix(table_prefix, true)?;
}
let edge_tables = self.edge_manager.gc(si)?;
info!("garbage collect edge table {:?}", edge_tables);
for et in edge_tables {
info!("garbage collect edge table {}", et);
let out_table_prefix = edge_table_prefix(et, EdgeDirection::Out);
self.delete_table_by_prefix(out_table_prefix, false)?;
}
Expand Down Expand Up @@ -648,7 +648,10 @@ impl GraphStore {
let path = config
.get_storage_option("store.data.path")
.expect("invalid config, missing store.data.path");
info!("open graph store at {} with config {:?}", path, config);
let parts: Vec<&str> = path.split("/").collect();
if parts.get(parts.len() - 1) == Some(&"0") {
info!("open graph store at {} with config {:?}", path, config);
}
match config.get_storage_engine() {
"rocksdb" => {
let res = RocksDB::open(config.get_storage_options()).and_then(|db| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public void start() {
this.pollThread.setName("store-kafka-poller");
this.pollThread.setDaemon(true);
this.pollThread.start();
logger.info("Kafka processor started");
}

public void stop() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static void main(String[] args) throws Exception {
logger.info("Configs {}", conf);

NodeBase node;
if (args.length == 0) {
if (args.length == 0 || args[0].equals("all-in-one")) {
logger.warn("No role type, use MaxNode");
try {
node = new MaxNode(conf);
Expand Down

0 comments on commit 988aa46

Please sign in to comment.