From fe1f23f10fa656307a933def2fa8a107d120162f Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Sun, 24 May 2020 23:52:30 +0300 Subject: [PATCH] fix(zk): Fix zookeper upgrade to 5.5.0 (#511) Fixes the "logs found but no snapshot" error when upgrading from a short-lived older version. Fixes #472. See https://issues.apache.org/jira/browse/ZOOKEEPER-3056. --- install.sh | 10 ++++++++++ zookeeper/snapshot.0 | Bin 0 -> 424 bytes 2 files changed, 10 insertions(+) create mode 100644 zookeeper/snapshot.0 diff --git a/install.sh b/install.sh index 3aa3b89..c0419b1 100755 --- a/install.sh +++ b/install.sh @@ -164,6 +164,16 @@ $dc build --force-rm --parallel echo "" echo "Docker images built." + +ZOOKEEPER_LOG_FILE_COUNT=$($dcr zookeeper bash -c 'ls 2>/dev/null -Ubad1 -- /var/lib/zookeeper/log/version-2/* | wc -l | tr -d '[:space:]'') +ZOOKEEPER_SNAPSHOT_FILE_COUNT=$($dcr zookeeper bash -c 'ls 2>/dev/null -Ubad1 -- /var/lib/zookeeper/data/version-2/* | wc -l | tr -d '[:space:]'') +# This is a workaround for a ZK upgrade bug: https://issues.apache.org/jira/browse/ZOOKEEPER-3056 +if [ "$ZOOKEEPER_LOG_FILE_COUNT" -gt "0" ] && [ "$ZOOKEEPER_SNAPSHOT_FILE_COUNT" -eq "0" ]; then + $dcr -v $(pwd)/zookeeper:/temp zookeeper bash -c 'cp /temp/snapshot.0 /var/lib/zookeeper/data/version-2/snapshot.0' + $dc run -e ZOOKEEPER_SNAPSHOT_TRUST_EMPTY=true zookeeper +fi + + echo "Bootstrapping and migrating Snuba..." $dcr snuba-api bootstrap --force echo "" diff --git a/zookeeper/snapshot.0 b/zookeeper/snapshot.0 new file mode 100644 index 0000000000000000000000000000000000000000..3e6deee02b83966e6e933ea33a686a7c11223515 GIT binary patch literal 424 zcma#@4)$YUU|{+W1wb|kFhVFW4Pt{ZYk7WAP7090mY7$WpO*?%!hog~CQK^LrC*hw zpPiaokXi)NN+nYT5vJ-V=jWwmrX#rv=1U|Y>`ahju*e7?8D3bLUy=w?LnVhZ>Vpj1 MvB=sJNHOXI0LqX(R{#J2 literal 0 HcmV?d00001