Ver código fonte

baseline benchmark

baseline
ArcueidType 8 meses atrás
pai
commit
a9a8a8d73d
5 arquivos alterados com 32 adições e 7 exclusões
  1. +6
    -0
      .idea/misc.xml
  2. +8
    -3
      benchmarks/db_bench.cc
  3. +14
    -3
      db/db_impl.cc
  4. +2
    -0
      db/filename.cc
  5. +2
    -1
      db/filename.h

+ 6
- 0
.idea/misc.xml Ver arquivo

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="BackendCodeEditorMiscSettings">
<option name="/Default/RiderDebugger/RiderRestoreDecompile/RestoreDecompileSetting/@EntryValue" value="false" type="bool" />
<option name="/Default/Housekeeping/GlobalSettingsUpgraded/IsUpgraded/@EntryValue" value="true" type="bool" />
<option name="/Default/Housekeeping/FeatureSuggestion/FeatureSuggestionManager/DisabledSuggesters/=SwitchToGoToActionSuggester/@EntryIndexedValue" value="true" type="bool" />
<option name="/Default/Environment/Hierarchy/GeneratedFilesCacheKey/Timestamp/@EntryValue" value="5" type="long" />
</component>
<component name="CMakePythonSetting"> <component name="CMakePythonSetting">
<option name="pythonIntegrationState" value="YES" /> <option name="pythonIntegrationState" value="YES" />
</component> </component>

+ 8
- 3
benchmarks/db_bench.cc Ver arquivo

@ -74,7 +74,7 @@ static int FLAGS_reads = -1;
static int FLAGS_threads = 1; static int FLAGS_threads = 1;
// Size of each value // Size of each value
static int FLAGS_value_size = 100;
static int FLAGS_value_size = 1000;
// Arrange to generate values that shrink to this fraction of // Arrange to generate values that shrink to this fraction of
// their original size after compression // their original size after compression
@ -852,8 +852,13 @@ class Benchmark {
for (int j = 0; j < entries_per_batch_; j++) { for (int j = 0; j < entries_per_batch_; j++) {
const int k = seq ? i + j : thread->rand.Uniform(FLAGS_num); const int k = seq ? i + j : thread->rand.Uniform(FLAGS_num);
key.Set(k); key.Set(k);
batch.Put(key.slice(), gen.Generate(value_size_));
bytes += value_size_ + key.slice().size();
auto value = gen.Generate(value_size_);
FieldArray field_array = {
{"1", value.ToString()},
};
auto encoded_value = Fields(field_array).Serialize();
batch.Put(key.slice(), Slice(encoded_value));
bytes += encoded_value.size() + key.slice().size();
thread->stats.FinishedSingleOp(); thread->stats.FinishedSingleOp();
} }
s = db_->Write(write_options_, &batch); s = db_->Write(write_options_, &batch);

+ 14
- 3
db/db_impl.cc Ver arquivo

@ -257,6 +257,9 @@ void DBImpl::RemoveObsoleteFiles() {
case kTableFile: case kTableFile:
keep = (live.find(number) != live.end()); keep = (live.find(number) != live.end());
break; break;
case kVTableFile:
keep = (live.find(number) != live.end());
break;
case kTempFile: case kTempFile:
// Any temp files that are currently being written to must // Any temp files that are currently being written to must
// be recorded in pending_outputs_, which is inserted into "live" // be recorded in pending_outputs_, which is inserted into "live"
@ -1153,8 +1156,12 @@ Status DBImpl::Get(const ReadOptions& options, const Slice& key,
s = current->Get(options, lkey, value, &stats); s = current->Get(options, lkey, value, &stats);
have_stat_update = true; have_stat_update = true;
} }
auto fields = Fields(Slice(*value));
*value = fields["1"];
if (s.ok()) {
auto fields = Fields(Slice(*value));
*value = fields["1"];
} else {
*value = "";
}
mutex_.Lock(); mutex_.Lock();
} }
@ -1203,7 +1210,11 @@ Status DBImpl::Get(const ReadOptions& options, const Slice& key,
s = current->Get(options, lkey, value, &stats); s = current->Get(options, lkey, value, &stats);
have_stat_update = true; have_stat_update = true;
} }
*fields = Fields(Slice(*value));
if (s.ok()) {
*fields = Fields(Slice(*value));
} else {
*fields = Fields();
}
mutex_.Lock(); mutex_.Lock();
} }

+ 2
- 0
db/filename.cc Ver arquivo

@ -112,6 +112,8 @@ bool ParseFileName(const std::string& filename, uint64_t* number,
*type = kTableFile; *type = kTableFile;
} else if (suffix == Slice(".dbtmp")) { } else if (suffix == Slice(".dbtmp")) {
*type = kTempFile; *type = kTempFile;
} else if (suffix == Slice(".vtb")) {
*type = kVTableFile;
} else { } else {
return false; return false;
} }

+ 2
- 1
db/filename.h Ver arquivo

@ -25,7 +25,8 @@ enum FileType {
kDescriptorFile, kDescriptorFile,
kCurrentFile, kCurrentFile,
kTempFile, kTempFile,
kInfoLogFile // Either the current one, or an old one
kInfoLogFile, // Either the current one, or an old one
kVTableFile
}; };
// Return the name of the log file with the specified number // Return the name of the log file with the specified number

Carregando…
Cancelar
Salvar