1 // Copyright 2013 Yangqing Jia
3 #include <glog/logging.h>
4 #include <leveldb/db.h>
5 #include <leveldb/write_batch.h>
9 int main(int argc, char** argv) {
10 ::google::InitGoogleLogging(argv[0]);
12 leveldb::Options options;
13 options.create_if_missing = false;
15 LOG(INFO) << "Opening leveldb " << argv[1];
16 leveldb::Status status = leveldb::DB::Open(
17 options, argv[1], &db);
18 CHECK(status.ok()) << "Failed to open leveldb " << argv[1];
20 leveldb::ReadOptions read_options;
21 read_options.fill_cache = false;
23 leveldb::Iterator* it = db->NewIterator(read_options);
24 for (it->SeekToFirst(); it->Valid(); it->Next()) {
25 // just a dummy operation
26 volatile std::string value = it->value().ToString();
27 // LOG(ERROR) << it->key().ToString();
28 if (++count % 10000 == 0) {
29 LOG(ERROR) << "Processed " << count << " files.";