From 8f852aea7265bb20cc61727134565ab8222c0547 Mon Sep 17 00:00:00 2001 From: Thomas Jungblut Date: Tue, 31 May 2022 16:12:56 +0200 Subject: [PATCH] adding small key diff based on snapshots --- .gitignore | 3 ++- README.md | 8 ++++++++ snap_diff.sh | 29 +++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100755 snap_diff.sh diff --git a/.gitignore b/.gitignore index a2f7034..ab98582 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ omc omc-v1.4.0_Linux_x86_64.tar.gz build.sh -push.sh \ No newline at end of file +push.sh +default.etcd \ No newline at end of file diff --git a/README.md b/README.md index 356942a..52d900e 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,14 @@ or > podman run --privileged --volume /$(pwd):/test quay.io/peterducai/openshift-etcd-suite:latest etcd /test/\ +## snap_diff.sh script + +This can be used to debug why a database file is bigger compared to some snapshot before. It creates a diff between the keys to understand where such increase might come from. + +> ./snap_diff.sh first.snapshot second.snapshot diff.txt + +the qualified diff in keys can be found in a newly created file `diff.txt`. + ## fio_suite fio_suite is benchmark tool which runs several fio tests to see how IOPS change under different load. diff --git a/snap_diff.sh b/snap_diff.sh new file mode 100755 index 0000000..e9366a2 --- /dev/null +++ b/snap_diff.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# dump_keys +function dump_keys() { + rm -rf default.etcd + etcdctl snapshot restore "$1" + + etcd --enable-pprof & + etcdPid=$! + + # wait for it to come up + etcdctl member list + etcdctl get / --prefix --keys-only | awk NF | sort -n > "$2" + + kill -9 $etcdPid +} + +if [ "$#" -ne 3 ]; then + echo "./snap_diff.sh " + exit 1 +fi + +first=$(mktemp) +dump_keys $1 $first +second=$(mktemp) +dump_keys $2 $second + +diff $first $second > $3 +echo "diff $first $second -> $3"