From bf3ed382a284f37a56d9fdf5b034db53aa6763a8 Mon Sep 17 00:00:00 2001 From: Fengnan Li Date: Sun, 24 Feb 2019 17:11:19 -0800 Subject: [PATCH 1/3] Update parse start script to handle the case that fsimage txid is covered in the range of edits --- .../src/main/bash/parse-start-timestamp.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dynamometer-workload/src/main/bash/parse-start-timestamp.sh b/dynamometer-workload/src/main/bash/parse-start-timestamp.sh index e5a440280f..f5328fc41e 100755 --- a/dynamometer-workload/src/main/bash/parse-start-timestamp.sh +++ b/dynamometer-workload/src/main/bash/parse-start-timestamp.sh @@ -25,12 +25,21 @@ else edits_dir="`pwd`" fi -edits_file_count=`ls -1 ${edits_dir} | grep -E "^edits_[[:digit:]]+-0*$image_txid\$" | wc -l` +# try to find the edit logs whose transaction range covers the txid from the fsimage +# first find the first txid which is greater or equal to the fsimage txid +ending_txid=`ls -1 ${edits_dir} | grep -E "^edits_[[:digit:]]+-[[:digit:]]+\$" | cut -d'-' -f 2 | \ + awk -v t="$image_txid" {'if ($1 >= t) {print $1}'} | head -1` +if [ -z "$ending_txid" ]; then + echo "Error; found 0 covering edit files." + exit 1 +fi +# then grep the file ending with the ending_txid, exit if duplicated edits exist +edits_file_count=`ls -1 ${edits_dir} | grep -E "^edits_[[:digit:]]+-0*$ending_txid\$" | wc -l` if [ "$edits_file_count" != 1 ]; then echo "Error; found $edits_file_count matching edit files." exit 1 fi -edits_file=`ls -1 ${edits_dir} | grep -E "^edits_[[:digit:]]+-0*$image_txid\$"` +edits_file=`ls -1 ${edits_dir} | grep -E "^edits_[[:digit:]]+-0*$ending_txid\$"` awk_script='/TIMESTAMP/ { line=$0 } \ END { match(line, />([[:digit:]]+) Date: Tue, 26 Feb 2019 16:51:15 -0800 Subject: [PATCH 2/3] Update awk script --- dynamometer-workload/src/main/bash/parse-start-timestamp.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dynamometer-workload/src/main/bash/parse-start-timestamp.sh b/dynamometer-workload/src/main/bash/parse-start-timestamp.sh index f5328fc41e..1866567a63 100755 --- a/dynamometer-workload/src/main/bash/parse-start-timestamp.sh +++ b/dynamometer-workload/src/main/bash/parse-start-timestamp.sh @@ -27,8 +27,8 @@ fi # try to find the edit logs whose transaction range covers the txid from the fsimage # first find the first txid which is greater or equal to the fsimage txid -ending_txid=`ls -1 ${edits_dir} | grep -E "^edits_[[:digit:]]+-[[:digit:]]+\$" | cut -d'-' -f 2 | \ - awk -v t="$image_txid" {'if ($1 >= t) {print $1}'} | head -1` +ending_txid=`ls -1 ${edits_dir} | grep -E "^edits_[[:digit:]]+-[[:digit:]]+\$" | \ + awk -v t="$tmp_txid" -F'-' '{if ($2 >= t) {print $2}}' | head -1` if [ -z "$ending_txid" ]; then echo "Error; found 0 covering edit files." exit 1 From 8cbf660df754c18238588071af88da7608b30de7 Mon Sep 17 00:00:00 2001 From: Fengnan Li Date: Tue, 26 Feb 2019 21:50:49 -0800 Subject: [PATCH 3/3] Fix typo --- dynamometer-workload/src/main/bash/parse-start-timestamp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dynamometer-workload/src/main/bash/parse-start-timestamp.sh b/dynamometer-workload/src/main/bash/parse-start-timestamp.sh index 1866567a63..e5e36b2b6f 100755 --- a/dynamometer-workload/src/main/bash/parse-start-timestamp.sh +++ b/dynamometer-workload/src/main/bash/parse-start-timestamp.sh @@ -28,7 +28,7 @@ fi # try to find the edit logs whose transaction range covers the txid from the fsimage # first find the first txid which is greater or equal to the fsimage txid ending_txid=`ls -1 ${edits_dir} | grep -E "^edits_[[:digit:]]+-[[:digit:]]+\$" | \ - awk -v t="$tmp_txid" -F'-' '{if ($2 >= t) {print $2}}' | head -1` + awk -v t="$image_txid" -F'-' '{if ($2 >= t) {print $2}}' | head -1` if [ -z "$ending_txid" ]; then echo "Error; found 0 covering edit files." exit 1