Fix -Wshadow for tools

Summary: Previously I made `make check` work with -Wshadow, but there are some tools that are not compiled using `make check`.

Test Plan: make all

Reviewers: yhchiang, rven, ljin, sdong

Reviewed By: ljin, sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D28497
main
Igor Canadi 10 years ago
parent 8447861896
commit 68effa0348
  1. 38
      db/perf_context_test.cc
  2. 2
      table/table_reader_bench.cc
  3. 24
      tools/blob_store_bench.cc
  4. 7
      tools/db_stress.cc
  5. 1
      tools/sst_dump.cc
  6. 6
      util/cache_bench.cc

@ -88,22 +88,27 @@ TEST(PerfContextTest, SeekIntoDeletion) {
hist_get_time.Add(elapsed_nanos);
}
std::cout << "Get uesr key comparison: \n" << hist_get.ToString()
std::cout << "Get user key comparison: \n" << hist_get.ToString()
<< "Get time: \n" << hist_get_time.ToString();
HistogramImpl hist_seek_to_first;
std::unique_ptr<Iterator> iter(db->NewIterator(read_options));
{
HistogramImpl hist_seek_to_first;
std::unique_ptr<Iterator> iter(db->NewIterator(read_options));
perf_context.Reset();
StopWatchNano timer(Env::Default(), true);
iter->SeekToFirst();
hist_seek_to_first.Add(perf_context.user_key_comparison_count);
auto elapsed_nanos = timer.ElapsedNanos();
perf_context.Reset();
StopWatchNano timer(Env::Default(), true);
iter->SeekToFirst();
hist_seek_to_first.Add(perf_context.user_key_comparison_count);
auto elapsed_nanos = timer.ElapsedNanos();
std::cout << "SeekToFirst uesr key comparison: \n" << hist_seek_to_first.ToString()
<< "ikey skipped: " << perf_context.internal_key_skipped_count << "\n"
<< "idelete skipped: " << perf_context.internal_delete_skipped_count << "\n"
<< "elapsed: " << elapsed_nanos << "\n";
std::cout << "SeekToFirst uesr key comparison: \n"
<< hist_seek_to_first.ToString()
<< "ikey skipped: " << perf_context.internal_key_skipped_count
<< "\n"
<< "idelete skipped: "
<< perf_context.internal_delete_skipped_count << "\n"
<< "elapsed: " << elapsed_nanos << "\n";
}
HistogramImpl hist_seek;
for (int i = 0; i < FLAGS_total_keys; ++i) {
@ -224,7 +229,6 @@ void ProfileQueries(bool enabled_time = false) {
std::string key = "k" + std::to_string(i);
std::string value = "v" + std::to_string(i);
std::vector<Slice> keys = {Slice(key)};
std::vector<std::string> values;
perf_context.Reset();
@ -239,7 +243,7 @@ void ProfileQueries(bool enabled_time = false) {
std::string key = "k" + std::to_string(i);
std::string value = "v" + std::to_string(i);
std::vector<Slice> keys = {Slice(key)};
std::vector<Slice> multiget_keys = {Slice(key)};
std::vector<std::string> values;
perf_context.Reset();
@ -252,7 +256,7 @@ void ProfileQueries(bool enabled_time = false) {
hist_get.Add(perf_context.user_key_comparison_count);
perf_context.Reset();
db->MultiGet(read_options, keys, &values);
db->MultiGet(read_options, multiget_keys, &values);
hist_mget_snapshot.Add(perf_context.get_snapshot_time);
hist_mget_memtable.Add(perf_context.get_from_memtable_time);
hist_mget_files.Add(perf_context.get_from_output_files_time);
@ -329,7 +333,7 @@ void ProfileQueries(bool enabled_time = false) {
std::string key = "k" + std::to_string(i);
std::string value = "v" + std::to_string(i);
std::vector<Slice> keys = {Slice(key)};
std::vector<Slice> multiget_keys = {Slice(key)};
std::vector<std::string> values;
perf_context.Reset();
@ -342,7 +346,7 @@ void ProfileQueries(bool enabled_time = false) {
hist_get.Add(perf_context.user_key_comparison_count);
perf_context.Reset();
db->MultiGet(read_options, keys, &values);
db->MultiGet(read_options, multiget_keys, &values);
hist_mget_snapshot.Add(perf_context.get_snapshot_time);
hist_mget_memtable.Add(perf_context.get_from_memtable_time);
hist_mget_files.Add(perf_context.get_from_output_files_time);

@ -115,7 +115,7 @@ void TableReaderBenchmark(Options& opts, EnvOptions& env_options,
unique_ptr<TableReader> table_reader;
unique_ptr<RandomAccessFile> raf;
if (!through_db) {
Status s = env->NewRandomAccessFile(file_name, &raf, env_options);
s = env->NewRandomAccessFile(file_name, &raf, env_options);
uint64_t file_size;
env->GetFileSize(file_name, &file_size);
s = opts.table_factory->NewTableReader(

@ -59,11 +59,13 @@ struct Result {
writes = reads = deletes = data_read = data_written = 0;
}
Result (uint32_t writes, uint32_t reads, uint32_t deletes,
uint64_t data_written, uint64_t data_read) :
writes(writes), reads(reads), deletes(deletes),
data_written(data_written), data_read(data_read) {}
Result(uint32_t _writes, uint32_t _reads, uint32_t _deletes,
uint64_t _data_written, uint64_t _data_read)
: writes(_writes),
reads(_reads),
deletes(_deletes),
data_written(_data_written),
data_read(_data_read) {}
};
namespace {
@ -81,11 +83,13 @@ struct WorkerThread {
Result result;
atomic<bool> stopped;
WorkerThread(uint64_t data_size_from, uint64_t data_size_to,
double read_ratio, uint64_t working_set_size) :
data_size_from(data_size_from), data_size_to(data_size_to),
read_ratio(read_ratio), working_set_size(working_set_size),
stopped(false) {}
WorkerThread(uint64_t _data_size_from, uint64_t _data_size_to,
double _read_ratio, uint64_t _working_set_size)
: data_size_from(_data_size_from),
data_size_to(_data_size_to),
read_ratio(_read_ratio),
working_set_size(_working_set_size),
stopped(false) {}
WorkerThread(const WorkerThread& wt) :
data_size_from(wt.data_size_from), data_size_to(wt.data_size_to),

@ -751,11 +751,8 @@ struct ThreadState {
SharedState* shared;
Stats stats;
ThreadState(uint32_t index, SharedState *shared)
: tid(index),
rand(1000 + index + shared->GetSeed()),
shared(shared) {
}
ThreadState(uint32_t index, SharedState* _shared)
: tid(index), rand(1000 + index + shared->GetSeed()), shared(_shared) {}
};
} // namespace

@ -378,7 +378,6 @@ int main(int argc, char** argv) {
}
rocksdb::SstFileReader reader(filename, verify_checksum,
output_hex);
rocksdb::Status st;
// scan all files in give file path.
if (command == "" || command == "scan" || command == "check") {
st = reader.ReadSequential(command != "check",

@ -122,10 +122,8 @@ struct ThreadState {
Random rnd;
SharedState* shared;
ThreadState(uint32_t index, SharedState *shared)
: tid(index),
rnd(1000 + index),
shared(shared) {}
ThreadState(uint32_t index, SharedState* _shared)
: tid(index), rnd(1000 + index), shared(_shared) {}
};
} // namespace

Loading…
Cancel
Save