@@ -39,6 +39,12 @@ if [ -d "$GHE_DATA_DIR/current/elasticsearch" ]; then
39
39
link_dest=" --link-dest=../../current/elasticsearch"
40
40
fi
41
41
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
+
42
48
# Transfer ES indices from a GitHub instance to the current snapshot
43
49
# directory, using a previous snapshot to avoid transferring files that have
44
50
# already been transferred.
@@ -54,15 +60,15 @@ log_rsync "END elasticsearch rsync" 1>&3
54
60
# Set up a trap to re-enable flushing on exit and remove temp file
55
61
cleanup () {
56
62
ghe_verbose " * Enabling ES index flushing ..."
57
- echo ' { "index":{" translog.disable_flush":false}} ' |
63
+ echo " { \ " index\ " :{\" index. translog.flush_threshold_size \" : \" $current_threshold \" }} " |
58
64
ghe-ssh " $host " -- curl -s -XPUT " localhost:9200/_settings" -d @- > /dev/null
59
65
}
60
66
trap ' cleanup' EXIT
61
67
trap ' exit $?' INT # ^C always terminate
62
68
63
69
# Disable ES flushing and force a flush right now
64
70
ghe_verbose " * Disabling ES index flushing ..."
65
- echo ' {"index":{"translog.disable_flush":true }}' |
71
+ echo ' {"index":{"index. translog.flush_threshold_size":"1PB" }}' |
66
72
ghe-ssh " $host " -- curl -s -XPUT " localhost:9200/_settings" -d @- > /dev/null
67
73
ghe-ssh " $host " -- curl -s -XPOST " localhost:9200/_flush" > /dev/null
68
74
0 commit comments