Compare commits

..

2 Commits

Author SHA1 Message Date
Vlasta
47c55021cb fix-default-values 2023-04-24 14:23:29 +02:00
Marko Budiselić
b02b201129 Improve Jepsen setup (#893) 2023-04-23 16:16:49 +02:00
3 changed files with 17 additions and 45 deletions

View File

@@ -164,16 +164,16 @@ DEFINE_VALIDATED_uint64(storage_gc_cycle_sec, 30, "Storage garbage collector int
// NOTE: The `storage_properties_on_edges` flag must be the same here and in // NOTE: The `storage_properties_on_edges` flag must be the same here and in
// `mg_import_csv`. If you change it, make sure to change it there as well. // `mg_import_csv`. If you change it, make sure to change it there as well.
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DEFINE_bool(storage_properties_on_edges, false, "Controls whether edges have properties."); DEFINE_bool(storage_properties_on_edges, true, "Controls whether edges have properties.");
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DEFINE_bool(storage_recover_on_startup, false, "Controls whether the storage recovers persisted data on startup."); DEFINE_bool(storage_recover_on_startup, true, "Controls whether the storage recovers persisted data on startup.");
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DEFINE_VALIDATED_uint64(storage_snapshot_interval_sec, 0, DEFINE_VALIDATED_uint64(storage_snapshot_interval_sec, 300,
"Storage snapshot creation interval (in seconds). Set " "Storage snapshot creation interval (in seconds). Set "
"to 0 to disable periodic snapshot creation.", "to 0 to disable periodic snapshot creation.",
FLAG_IN_RANGE(0, 7 * 24 * 3600)); FLAG_IN_RANGE(0, 7 * 24 * 3600));
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DEFINE_bool(storage_wal_enabled, false, DEFINE_bool(storage_wal_enabled, true,
"Controls whether the storage uses write-ahead-logging. To enable " "Controls whether the storage uses write-ahead-logging. To enable "
"WAL periodic snapshots must be enabled."); "WAL periodic snapshots must be enabled.");
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
@@ -190,7 +190,7 @@ DEFINE_VALIDATED_uint64(storage_wal_file_flush_every_n_tx,
"WAL file. Set to 1 for fully synchronous operation.", "WAL file. Set to 1 for fully synchronous operation.",
FLAG_IN_RANGE(1, 1000000)); FLAG_IN_RANGE(1, 1000000));
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DEFINE_bool(storage_snapshot_on_exit, false, "Controls whether the storage creates another snapshot on exit."); DEFINE_bool(storage_snapshot_on_exit, true, "Controls whether the storage creates another snapshot on exit.");
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
DEFINE_bool(telemetry_enabled, false, DEFINE_bool(telemetry_enabled, false,

View File

@@ -108,23 +108,25 @@ case $1 in
esac esac
done done
# Resolve binary path if it is a link. # Copy Memgraph binary, handles both cases, when binary is a sym link
# or a regular file.
binary_path="$MEMGRAPH_BINARY_PATH" binary_path="$MEMGRAPH_BINARY_PATH"
if [ -L "$binary_path" ]; then if [ -L "$binary_path" ]; then
binary_path=$(readlink "$binary_path") binary_path=$(readlink "$binary_path")
fi fi
binary_name=$(basename -- "$binary_path") binary_name=$(basename -- "$binary_path")
# Copy Memgraph binary.
for iter in $(seq 1 "$JEPSEN_ACTIVE_NODES_NO"); do for iter in $(seq 1 "$JEPSEN_ACTIVE_NODES_NO"); do
jepsen_node_name="jepsen-n$iter" jepsen_node_name="jepsen-n$iter"
# Cleanup the node folder with previous binaries. docker_exec="docker exec $jepsen_node_name bash -c"
docker exec "$jepsen_node_name" rm -rf /opt/memgraph/ if [ "$binary_name" == "memgraph" ]; then
docker exec "$jepsen_node_name" mkdir -p /opt/memgraph _binary_name="memgraph_tmp"
docker cp "$binary_path" "$jepsen_node_name":/opt/memgraph/"$binary_name" else
# TODO(gitbuda): This doesn't work if the pure binary is linked called memgraph _binary_name="$binary_name"
docker exec "$jepsen_node_name" bash -c "rm -f /opt/memgraph/memgraph && ln -s /opt/memgraph/$binary_name /opt/memgraph/memgraph" fi
docker exec "$jepsen_node_name" bash -c "touch /opt/memgraph/memgraph.log" $docker_exec "rm -rf /opt/memgraph/ && mkdir -p /opt/memgraph"
docker cp "$binary_path" "$jepsen_node_name":/opt/memgraph/"$_binary_name"
$docker_exec "ln -s /opt/memgraph/$_binary_name /opt/memgraph/memgraph"
$docker_exec "touch /opt/memgraph/memgraph.log"
INFO "Copying $binary_name to $jepsen_node_name DONE." INFO "Copying $binary_name to $jepsen_node_name DONE."
done done

View File

@@ -1,30 +0,0 @@
FROM debian:10
ARG TOOLCHAIN_VERSION=toolchain-v4
# Stops tzdata interactive configuration.
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y \
ca-certificates wget git
# Do NOT be smart here and clean the cache because the container is used in the
# stateful context.
RUN wget -q https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-binaries-debian-10-amd64.tar.gz \
-O ${TOOLCHAIN_VERSION}-binaries-debian-10-amd64.tar.gz \
&& tar xzvf ${TOOLCHAIN_VERSION}-binaries-debian-10-amd64.tar.gz -C /opt \
&& rm ${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-binaries-debian-10-amd64.tar.gz
RUN git clone https://github.com/memgraph/memgraph.git \
&& ./memgraph/environments/os/debian-10.sh install TOOLCHAIN_RUN_DEPS \
&& ./memgraph/environment/os/debian-10.sh install MEMGRAPH_BUILD_DEPS
RUN cd memgraph \
&& source /opt/toolchain-v4/activate \
&& ./init \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
&& make -j4 \
&& make -j4 mgconsole
ENTRYPOINT ["sleep", "infinity"]