Bugfix for issue 33; reduce lock contention in Get(), parallel benchmarks.

- Fix for issue 33 (non-null-terminated result from
  leveldb_property_value())

- Support for running multiple instances of a benchmark in parallel.

- Reduce lock contention on Get():
  (1) Do not hold the lock while searching memtables.
  (2) Shard block and table caches 16-ways.

  Benchmark for evaluating this change:
  $ db_bench --benchmarks=fillseq1,readrandom --threads=$n
  (fillseq1 is a small hack to make sure fillseq runs once regardless
  of number of threads specified on the command line).



git-svn-id: https://leveldb.googlecode.com/svn/trunk@49 62dab493-f737-651d-591e-8d6aee1b9529
This commit is contained in:
gabor@google.com
2011-08-22 21:08:51 +00:00
parent ab323f7e1e
commit e3584f9c28
7 changed files with 510 additions and 259 deletions

View File

@@ -196,7 +196,8 @@ char* leveldb_property_value(
const char* propname) {
std::string tmp;
if (db->rep->GetProperty(Slice(propname), &tmp)) {
return CopyString(tmp);
// We use strdup() since we expect human readable output.
return strdup(tmp.c_str());
} else {
return NULL;
}