Fix the build error caused by the dynamic array (#4918)

Summary:
In the MixGraph benchmark of db_bench #4788 , the char array is initialized with an argument from user's input, which can cause build error on some platforms. Also, the msg char array size can be potentially smaller than the printed data, which should be extended from 100 to 256.

Tested with make check.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4918

Differential Revision: D13844298

Pulled By: sagar0

fbshipit-source-id: 33c4809c5c4438f0a9f7b289d3f42e20c545bbab
This commit is contained in:
zhichao-cao 2019-01-28 12:23:03 -08:00 committed by Facebook Github Bot
parent e242fa4664
commit e2547103fd

View File

@ -4667,23 +4667,25 @@ void VerifyDBFromDB(std::string& truth_db_name) {
int64_t seek = 0;
int64_t seek_found = 0;
int64_t bytes = 0;
int64_t value_max = FLAGS_mix_max_value_size;
const int64_t default_value_max = 64*1024*1024;
int64_t value_max = default_value_max;
int64_t scan_len_max = FLAGS_mix_max_scan_len;
double write_rate = 1000000.0;
double read_rate = 1000000.0;
std::vector<double> ratio;
char value_buffer[2 * value_max];
std::vector<double> ratio {FLAGS_mix_get_ratio,
FLAGS_mix_put_ratio, FLAGS_mix_seek_ratio};
char value_buffer[default_value_max];
QueryDecider query;
RandomGenerator gen;
Status s;
if(value_max > FLAGS_mix_max_value_size) {
value_max = FLAGS_mix_max_value_size;
}
ReadOptions options(FLAGS_verify_checksum, true);
std::unique_ptr<const char[]> key_guard;
Slice key = AllocateKey(&key_guard);
PinnableSlice pinnable_val;
ratio.push_back(FLAGS_mix_get_ratio);
ratio.push_back(FLAGS_mix_put_ratio);
ratio.push_back(FLAGS_mix_seek_ratio);
query.Initiate(ratio);
// the limit of qps initiation