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
main
Peter Dillinger4 years agocommitted byFacebook GitHub Bot
# 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: <SCRIPT> [ref_for_current]
# `ref_for_current` can be a revision, tag, commit or branch name. Default is HEAD.
#
# Usage: <SCRIPT> [checkout]
# `checkout` can be a tag, commit or branch name. Will build using it and check DBs generated by all previous branches (or tags for very old versions without branch) can be opened by it.
# Return value 0 means all regression tests pass. 1 if not pass.
#
# Environment options:
# SHORT_TEST=1 - Test only the oldest branch for each kind of test. This is
# a good choice for PR validation as it is relatively fast and will find
# most issues.
# USE_SSH=1 - Connect to GitHub with ssh instead of https
if ! git diff-index --quiet HEAD;then
echo"You have uncommitted changes. Aborting."
exit1
fi
current_checkout_name=${1:-HEAD}
# This allows the script to work even if with transient refs like "HEAD"
# For saving current version of scripts as we checkout different versions to test
script_copy_dir=$test_dir"/script_copy"
input_data_path=$test_dir"/test_data_input/"
mkdir -p $script_copy_dir
cp -f $scriptpath/*.sh $script_copy_dir
python_bin=$(which python3 || which python ||echo python3)
# For shared raw input data
input_data_path=$test_dir"/test_data_input"
mkdir -p $input_data_path
# For external sst ingestion test
ext_test_dir=$test_dir"/ext"
mkdir -p $ext_test_dir
# For DB dump test
db_test_dir=$test_dir"/db"
mkdir -p $db_test_dir
# For backup/restore test (uses DB test)
bak_test_dir=$test_dir"/bak"
mkdir -p $bak_test_dir
mkdir $test_dir|| true
mkdir $input_data_path|| true
rm -rf $script_copy_dir
cp $scriptpath$script_copy_dir -rf
python_bin=$(which python3 || which python ||echo python3)
# Generate random files.
for i in {1..6}
@ -55,11 +113,55 @@ with open('${sorted_input_data}', 'w') as f:
print(k + " ==> " + v, file=f)
EOF
declare -a backward_compatible_checkout_objs=("2.2.fb.branch""2.3.fb.branch""2.4.fb.branch""2.5.fb.branch""2.6.fb.branch""2.7.fb.branch""2.8.1.fb""3.0.fb.branch""3.1.fb""3.2.fb""3.3.fb""3.4.fb""3.5.fb""3.6.fb""3.7.fb""3.8.fb""3.9.fb""4.2.fb""4.3.fb""4.4.fb""4.5.fb""4.6.fb""4.7.fb""4.8.fb""4.9.fb""4.10.fb""4.11.fb""4.12.fb""4.13.fb""5.0.fb""5.1.fb""5.2.fb""5.3.fb""5.4.fb""5.5.fb""5.6.fb""5.7.fb""5.8.fb""5.9.fb""5.10.fb""5.11.fb""5.12.fb""5.13.fb""5.14.fb""5.15.fb")
declare -a forward_compatible_checkout_objs=()# N/A at the moment
declare -a forward_compatible_with_options_checkout_objs=("5.16.fb""5.17.fb""5.18.fb""6.0.fb""6.1.fb""6.2.fb""6.3.fb""6.4.fb""6.5.fb""6.6.fb""6.7.fb""6.8.fb""6.9.fb""6.10.fb""6.11.fb""6.12.fb""6.13.fb""6.14.fb""6.15.fb""6.16.fb""6.17.fb")
declare -a checkout_objs=(${backward_compatible_checkout_objs[@]}${forward_compatible_checkout_objs[@]}${forward_compatible_with_options_checkout_objs[@]})
declare -a extern_sst_ingestion_compatible_checkout_objs=("5.16.fb""5.17.fb""5.18.fb""6.0.fb""6.1.fb""6.2.fb""6.3.fb""6.4.fb""6.5.fb""6.6.fb""6.7.fb""6.8.fb""6.9.fb""6.10.fb""6.11.fb""6.12.fb""6.13.fb""6.14.fb""6.15.fb""6.16.fb""6.17.fb")
# db_backward_only_refs defined below the rest
# To check for DB forward compatibility with loading options (old version
# reading data from new), as well as backward compatibility
declare -a db_forward_with_options_refs=("5.16.fb""5.17.fb""5.18.fb""6.0.fb""6.1.fb""6.2.fb""6.3.fb""6.4.fb""6.5.fb""6.6.fb""6.7.fb""6.8.fb""6.9.fb""6.10.fb""6.11.fb""6.12.fb""6.13.fb""6.14.fb""6.15.fb""6.16.fb""6.17.fb")
# To check for DB forward compatibility without loading options (in addition
# to the "with loading options" set), as well as backward compatibility
declare -a db_forward_no_options_refs=()# N/A at the moment
# To check for SST ingestion backward compatibility (new version reading
# data from old) (ldb ingest_extern_sst added in 5.16.x, back-ported to
# 5.14.x, 5.15.x)
declare -a ext_backward_only_refs=("5.14.fb""5.15.fb")
# To check for SST ingestion forward compatibility (old version reading
# data from new) as well as backward compatibility
declare -a ext_forward_refs=("${db_forward_no_options_refs[@]}""${db_forward_with_options_refs[@]}")
# To check for backup backward compatibility (new version reading data
# from old) (ldb backup/restore added in 4.11.x)
declare -a bak_backward_only_refs=("4.11.fb""4.12.fb""4.13.fb""5.0.fb""5.1.fb""5.2.fb""5.3.fb""5.4.fb""5.5.fb""5.6.fb""5.7.fb""5.8.fb""5.9.fb""5.10.fb""5.11.fb""5.12.fb""5.13.fb""${ext_backward_only_refs[@]}")
# To check for backup forward compatibility (old version reading data
# from new) as well as backward compatibility
declare -a bak_forward_refs=("${db_forward_no_options_refs[@]}""${db_forward_with_options_refs[@]}")
# Branches (git refs) to check for DB backward compatibility (new version
# reading data from old) (in addition to the "forward compatible" list)
# NOTE: 2.7.fb.branch shows assertion violation in some configurations
declare -a db_backward_only_refs=("2.2.fb.branch""2.3.fb.branch""2.4.fb.branch""2.5.fb.branch""2.6.fb.branch""2.7.fb.branch""2.8.1.fb""3.0.fb.branch""3.1.fb""3.2.fb""3.3.fb""3.4.fb""3.5.fb""3.6.fb""3.7.fb""3.8.fb""3.9.fb""4.2.fb""4.3.fb""4.4.fb""4.5.fb""4.6.fb""4.7.fb""4.8.fb""4.9.fb""4.10.fb""${bak_backward_only_refs[@]}")
for checkout_ref in "${db_backward_only_refs[@]}""${db_forward_no_options_refs[@]}""${db_forward_with_options_refs[@]}""${ext_backward_only_refs[@]}""${ext_forward_refs[@]}""${bak_backward_only_refs[@]}""${bak_forward_refs[@]}"
do
if[ ! -e $db_test_dir/$checkout_ref];then
mkdir -p $db_test_dir/$checkout_ref
checkout_refs+=($checkout_ref)
fi
done
generate_db()
{
@ -105,89 +207,155 @@ ingest_external_sst()
set -e
}
# Sandcastle sets us up with a remote that is just another directory on the same
# machine and doesn't have our branches. Need to fetch them so checkout works.
# Remote add may fail if added previously (we don't cleanup).