Skip to content

Commit c4c1dda

Browse files
committed
Replace deprecated translog flush setting in ES
1 parent d10d6d5 commit c4c1dda

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

share/github-backup-utils/ghe-backup-es-rsync

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ if [ -d "$GHE_DATA_DIR/current/elasticsearch" ]; then
3939
link_dest="--link-dest=../../current/elasticsearch"
4040
fi
4141

42+
# Store the existing flush_threshold_size setting if it exists and if does not set it to ES default
43+
current_threshold=$(ghe-ssh "$host" -- curl -s "localhost:9200/_settings" | jq -r '.[].settings.index.translog.flush_threshold_size')
44+
if [ -z "$current_threshold" ]; then
45+
current_threshold="512MB"
46+
fi
47+
4248
# Transfer ES indices from a GitHub instance to the current snapshot
4349
# directory, using a previous snapshot to avoid transferring files that have
4450
# already been transferred.
@@ -54,15 +60,15 @@ log_rsync "END elasticsearch rsync" 1>&3
5460
# Set up a trap to re-enable flushing on exit and remove temp file
5561
cleanup () {
5662
ghe_verbose "* Enabling ES index flushing ..."
57-
echo '{"index":{"translog.disable_flush":false}}' |
63+
echo "{\"index\":{\"index.translog.flush_threshold_size\":\"$current_threshold\"}}" |
5864
ghe-ssh "$host" -- curl -s -XPUT "localhost:9200/_settings" -d @- >/dev/null
5965
}
6066
trap 'cleanup' EXIT
6167
trap 'exit $?' INT # ^C always terminate
6268

6369
# Disable ES flushing and force a flush right now
6470
ghe_verbose "* Disabling ES index flushing ..."
65-
echo '{"index":{"translog.disable_flush":true}}' |
71+
echo '{"index":{"index.translog.flush_threshold_size":"1PB"}}' |
6672
ghe-ssh "$host" -- curl -s -XPUT "localhost:9200/_settings" -d @- >/dev/null
6773
ghe-ssh "$host" -- curl -s -XPOST "localhost:9200/_flush" >/dev/null
6874

0 commit comments

Comments
 (0)