From a9046f3c45ced7237aaeacd61b413b8197359afd Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Tue, 2 Mar 2021 11:40:36 -0800 Subject: [PATCH] Revamp check_format_compatible.sh (#8012) Summary: * Adds backup/restore forward/backward compatibility testing * Adds forward/backward compatibility testing to sst ingestion * More structure sharing and comments for the lists of branches comprising each group * Less reliant on invariants between groups with de-duplication logic * Restructured for n+1 branch checkout+build steps rather than something like 3n. Should be much faster despite more checks. And to make manual runs easier * On success, restores working trees to original working branch (aborts early if uncommitted changes) and deletes temporary branch & remote * Adds SHORT_TEST=1 mode that uses only the oldest version for each * Adds USE_SSH=1 to use ssh instead of https for github group Pull Request resolved: https://github.com/facebook/rocksdb/pull/8012 Test Plan: a number of manual tests, mostly with SHORT_TEST=1. Using one version older for any of the groups (except I didn't check db_backward_only_refs) fails. Changing default format_version to 5 (planned) without updating this script fails as it should, and passes with appropriate update. Full local run passed (had to remove "2.7.fb.branch" due to compiler issues, also before this change). Reviewed By: riversand963 Differential Revision: D26735840 Pulled By: pdillinger fbshipit-source-id: 1320c22de5674760657e385aa42df9fade8b6fff --- tools/backup_db.sh | 15 ++ tools/check_format_compatible.sh | 330 +++++++++++++++++++++++-------- tools/restore_db.sh | 15 ++ tools/write_external_sst.sh | 1 + 4 files changed, 280 insertions(+), 81 deletions(-) create mode 100755 tools/backup_db.sh create mode 100755 tools/restore_db.sh diff --git a/tools/backup_db.sh b/tools/backup_db.sh new file mode 100755 index 000000000..aa82f1dba --- /dev/null +++ b/tools/backup_db.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +# +# + +if [ "$#" -lt 2 ]; then + echo "usage: ${BASH_SOURCE[0]} " + exit 1 +fi + +db_dir="$1" +backup_dir="$2" + +echo "== Backing up DB $db_dir to $backup_dir" +./ldb backup --db="$db_dir" --backup_dir="$backup_dir" diff --git a/tools/check_format_compatible.sh b/tools/check_format_compatible.sh index c7d86027e..1d4076995 100755 --- a/tools/check_format_compatible.sh +++ b/tools/check_format_compatible.sh @@ -1,24 +1,82 @@ #!/usr/bin/env bash # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # -# A shell script to load some pre generated data file to a DB using ldb tool -# ./ldb needs to be avaible to be executed. +# A shell script to build and run different versions of ldb to check for +# expected forward and backward compatibility with "current" version. The +# working copy must have no uncommitted changes. +# +# Usage: