Skip to content

Commit

Permalink
erl scripts (#1049)
Browse files Browse the repository at this point in the history
* erl scripts

Some riak admin scripts require an erlang node to be started, and then connected to the riak node (rather than using rpc).

These scripts don't work in 3.0.1.

$ERTS_PATH and $NAME_PARAM are not defined (as was previously defined in node_package);
boot file - cannot find start.boot only start_clean.boot (for reasons unknown);
observer not an installed application

These changes work with OTP 20.3, OTP 21.3 and OTP 22.3.  Tested using:

`make rel`
`rel/riak/bin/riak start`
`rel/riak/bin/riak admin top`

* Remove bespoke top formatter

There was a special formatter for etop packaged within riak top.  This may have been visually more appealing than the format for etop in OTP16?

However, going forward want to take advantage of mainstream OTP improvements not rely on bespoke formatter.  The bespoke formatter may not have been working anyway.
  • Loading branch information
martinsumner authored Jan 5, 2021
1 parent a1bcc0c commit 95bb247
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 136 deletions.
135 changes: 0 additions & 135 deletions apps/riak/src/etop_txt.erl

This file was deleted.

1 change: 0 additions & 1 deletion apps/riak/src/riak.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
[{description, "The Riak Database"},
{vsn, "3.0"},
{registered, []},
{modules, [etop_txt]},
{applications, [
kernel,
stdlib,
Expand Down
1 change: 1 addition & 0 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
riak_sysmon,
os_mon,
crypto,
observer,
runtime_tools,
xmerl,
mochiweb,
Expand Down
10 changes: 10 additions & 0 deletions rel/files/riak-admin
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ cd $RUNNER_BASE_DIR
# Identify the script name
SCRIPT="riak-admin"

# Setup required due to relx not node-package
ERTS_PATH=$BINDIR
NAME_PARAM="-name"
BOOT_FILE="start_clean"

usage() {
echo "Usage: $SCRIPT { cluster | join | leave | backup | restore | test | "
echo " reip | js-reload | erl-reload | wait-for-service | "
Expand Down Expand Up @@ -908,6 +913,7 @@ case "$1" in
NEWNODE=$2
$ERTS_PATH/erl -noshell \
-pa $RUNNER_LIB_DIR/basho-patches \
-boot $BOOT_FILE \
$CONFIG_ARGS \
-eval "riak_kv_console:$ACTION(['$OLDNODE', '$NEWNODE'])" \
-s init stop
Expand All @@ -928,6 +934,7 @@ case "$1" in

$ERTS_PATH/erl -noshell $NAME_PARAM riak_kv_backup$NAME_HOST -setcookie $COOKIE \
-pa $RUNNER_LIB_DIR/basho-patches \
-boot $BOOT_FILE \
-eval "riak_kv_backup:$ACTION('$NODE', \"$FILENAME\")" -s init stop
;;

Expand All @@ -947,6 +954,7 @@ case "$1" in

$ERTS_PATH/erl -noshell $NAME_PARAM riak_kv_backup$NAME_HOST -setcookie $COOKIE \
-pa $RUNNER_LIB_DIR/basho-patches \
-boot $BOOT_FILE \
-eval "riak_kv_backup:$ACTION('$NODE', \"$FILENAME\", \"$TYPE\")" -s init stop
;;

Expand All @@ -960,6 +968,7 @@ case "$1" in

$ERTS_PATH/erl -noshell $NAME_PARAM riak_test$NAME_HOST $COOKIE_ARG \
-pa $RUNNER_LIB_DIR/basho-patches \
-boot $BOOT_FILE \
-eval "case catch(riak:client_test(\"$NODE_NAME\")) of \
ok -> init:stop(); \
_ -> init:stop(1) \
Expand Down Expand Up @@ -995,6 +1004,7 @@ case "$1" in
# Using np_etop instead of riak_etop to follow node_package convention
$ERTS_PATH/erl -noshell -noinput \
-pa $RUNNER_LIB_DIR/basho-patches \
-boot $BOOT_FILE \
-hidden $NAME_PARAM np_etop$RAND$NAME_HOST $COOKIE_ARG \
-s etop -s erlang halt -output text \
-node $NODE_NAME \
Expand Down

0 comments on commit 95bb247

Please sign in to comment.