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
This commit is contained in:
Igor Canadi 2014-11-07 15:04:30 -08:00
parent 8447861896
commit 68effa0348
6 changed files with 40 additions and 38 deletions

View File

@ -88,9 +88,10 @@ TEST(PerfContextTest, SeekIntoDeletion) {
hist_get_time.Add(elapsed_nanos); 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(); << "Get time: \n" << hist_get_time.ToString();
{
HistogramImpl hist_seek_to_first; HistogramImpl hist_seek_to_first;
std::unique_ptr<Iterator> iter(db->NewIterator(read_options)); std::unique_ptr<Iterator> iter(db->NewIterator(read_options));
@ -100,10 +101,14 @@ TEST(PerfContextTest, SeekIntoDeletion) {
hist_seek_to_first.Add(perf_context.user_key_comparison_count); hist_seek_to_first.Add(perf_context.user_key_comparison_count);
auto elapsed_nanos = timer.ElapsedNanos(); auto elapsed_nanos = timer.ElapsedNanos();
std::cout << "SeekToFirst uesr key comparison: \n" << hist_seek_to_first.ToString() std::cout << "SeekToFirst uesr key comparison: \n"
<< "ikey skipped: " << perf_context.internal_key_skipped_count << "\n" << hist_seek_to_first.ToString()
<< "idelete skipped: " << perf_context.internal_delete_skipped_count << "\n" << "ikey skipped: " << perf_context.internal_key_skipped_count
<< "\n"
<< "idelete skipped: "
<< perf_context.internal_delete_skipped_count << "\n"
<< "elapsed: " << elapsed_nanos << "\n"; << "elapsed: " << elapsed_nanos << "\n";
}
HistogramImpl hist_seek; HistogramImpl hist_seek;
for (int i = 0; i < FLAGS_total_keys; ++i) { 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 key = "k" + std::to_string(i);
std::string value = "v" + std::to_string(i); std::string value = "v" + std::to_string(i);
std::vector<Slice> keys = {Slice(key)};
std::vector<std::string> values; std::vector<std::string> values;
perf_context.Reset(); perf_context.Reset();
@ -239,7 +243,7 @@ void ProfileQueries(bool enabled_time = false) {
std::string key = "k" + std::to_string(i); std::string key = "k" + std::to_string(i);
std::string value = "v" + 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; std::vector<std::string> values;
perf_context.Reset(); perf_context.Reset();
@ -252,7 +256,7 @@ void ProfileQueries(bool enabled_time = false) {
hist_get.Add(perf_context.user_key_comparison_count); hist_get.Add(perf_context.user_key_comparison_count);
perf_context.Reset(); 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_snapshot.Add(perf_context.get_snapshot_time);
hist_mget_memtable.Add(perf_context.get_from_memtable_time); hist_mget_memtable.Add(perf_context.get_from_memtable_time);
hist_mget_files.Add(perf_context.get_from_output_files_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 key = "k" + std::to_string(i);
std::string value = "v" + 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; std::vector<std::string> values;
perf_context.Reset(); perf_context.Reset();
@ -342,7 +346,7 @@ void ProfileQueries(bool enabled_time = false) {
hist_get.Add(perf_context.user_key_comparison_count); hist_get.Add(perf_context.user_key_comparison_count);
perf_context.Reset(); 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_snapshot.Add(perf_context.get_snapshot_time);
hist_mget_memtable.Add(perf_context.get_from_memtable_time); hist_mget_memtable.Add(perf_context.get_from_memtable_time);
hist_mget_files.Add(perf_context.get_from_output_files_time); hist_mget_files.Add(perf_context.get_from_output_files_time);

View File

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

View File

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

View File

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

View File

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

View File

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