Summary: This fixes a longstanding bug in which `ldb dump` swallows iterator errors. This can affect check_format_compatible.sh test results; if lucky, it will misleadingly look like a data mismatch instead of an outright failure. If unlucky, it could cause a test false negative. However the compatibility test uses old versions of ldb, so the best way to improve the test (for the foreseeable future) is to replace `ldb dump` with `ldb scan`. Pull Request resolved: https://github.com/facebook/rocksdb/pull/14422 Test Plan: manual Reviewed By: joshkang97 Differential Revision: D95332577 Pulled By: pdillinger fbshipit-source-id: bef1b427dd8aaa2cabbd23b7ad9f3cad1f67a349
42 lines
1.3 KiB
Bash
Executable file
42 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
#
|
|
# A shell script to verify DB generated by generate_random_db.sh cannot opened and read correct data.
|
|
# ./ldb needs to be avaible to be executed.
|
|
#
|
|
# Usage: <SCRIPT> <DB Path>
|
|
|
|
scriptpath=`dirname $BASH_SOURCE`
|
|
if [ "$#" -lt 2 ]; then
|
|
echo "usage: $BASH_SOURCE <db_directory> <compare_base_db_directory> [dump_file_name] [if_try_load_options] [if_ignore_unknown_options]"
|
|
exit 1
|
|
fi
|
|
|
|
db_dir=$1
|
|
base_db_dir=$2
|
|
dump_file_name=${3:-"dump_file.txt"}
|
|
try_load_options=${4:-"1"}
|
|
ignore_unknown_options=${5:-"0"}
|
|
db_dump=$db_dir"/"$dump_file_name
|
|
base_db_dump=$base_db_dir"/"$dump_file_name
|
|
extra_params=
|
|
|
|
if [ "$try_load_options" = "0" ]; then
|
|
extra_params=" --try_load_options=false"
|
|
elif [ "$try_load_options" = "1" ]; then
|
|
extra_params=" --try_load_options=true"
|
|
fi
|
|
|
|
if [ "$ignore_unknown_options" = "1" ]; then
|
|
extra_params="$extra_params --ignore_unknown_options"
|
|
fi
|
|
|
|
set -e
|
|
echo == Dumping data from $db_dir to $db_dump
|
|
# NOTE: old versions of `ldb dump` could swallow errors, so we use `scan`
|
|
./ldb scan --db=$db_dir $extra_params > $db_dump
|
|
|
|
echo == Dumping data from $base_db_dir to $base_db_dump
|
|
./ldb scan --db=$base_db_dir $extra_params > $base_db_dump
|
|
|
|
diff $db_dump $base_db_dump
|