Browse Source

benmark bug fixed

main
ArcueidType 9 months ago
parent
commit
f1d10e175c
5 changed files with 25 additions and 5 deletions
  1. +6
    -0
      .idea/misc.xml
  2. +14
    -3
      db/db_impl.cc
  3. +2
    -0
      db/filename.cc
  4. +2
    -1
      db/filename.h
  5. +1
    -1
      test/test_basicio.cc

+ 6
- 0
.idea/misc.xml View File

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<option name="pythonIntegrationState" value="YES" />
</component>

+ 14
- 3
db/db_impl.cc View File

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

+ 2
- 0
db/filename.cc View File

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

+ 2
- 1
db/filename.h View File

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

+ 1
- 1
test/test_basicio.cc View File

@ -3,7 +3,7 @@
#include "leveldb/db.h"
using namespace leveldb;
constexpr int value_size = 2000;
constexpr int value_size = 2048;
constexpr int data_size = 128 << 20;
std::map<std::string, std::string> data;

Loading…
Cancel
Save