Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding small key diff based on snapshots #9

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
omc
omc-v1.4.0_Linux_x86_64.tar.gz
build.sh
push.sh
push.sh
default.etcd
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will add the newline in the next commit

8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ or
> podman run --privileged --volume /$(pwd):/test quay.io/peterducai/openshift-etcd-suite:latest etcd /test/\<path-to-must-gather\>


## 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.
Expand Down
29 changes: 29 additions & 0 deletions snap_diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# dump_keys <snapshot file> <output file>
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 <snapshot file> <snapshot file> <output diff>"
exit 1
fi

first=$(mktemp)
dump_keys $1 $first
second=$(mktemp)
dump_keys $2 $second

diff $first $second > $3
echo "diff $first $second -> $3"