Skip to content
This repository was archived by the owner on Feb 26, 2020. It is now read-only.

Commit 86460c5

Browse files
authored
Merge pull request #17 from paritytech/andre/update-rocksdb-v5.14.3
Update to RocksDB v5.14.3
2 parents 312c9fe + f28f5d9 commit 86460c5

File tree

14 files changed

+326
-40
lines changed

14 files changed

+326
-40
lines changed

rocksdb-sys/rocksdb/HISTORY.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
# Rocksdb Change Log
2+
3+
## 5.14.3 (8/21/2018)
4+
### Public API Change
5+
* The merge operands are passed to `MergeOperator::ShouldMerge` in the reversed order relative to how they were merged (passed to FullMerge or FullMergeV2) for performance reasons
6+
### Bug Fixes
7+
* Fixes DBImpl::FindObsoleteFiles() calling GetChildren() on the same path
8+
29
## 5.14.2 (7/3/2018)
310
### Bug Fixes
411
* Change default value of `bytes_max_delete_chunk` to 0 in NewSstFileManager() as it doesn't work well with checkpoints.

rocksdb-sys/rocksdb/TARGETS

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,14 +1069,3 @@ if not is_opt_mode:
10691069
command = [TEST_RUNNER, BUCK_BINS + test_bin]
10701070
)
10711071

1072-
custom_unittest(
1073-
name = "make_rocksdbjavastatic",
1074-
command = ["internal_repo_rocksdb/make_rocksdbjavastatic.sh"],
1075-
type = "simple",
1076-
)
1077-
1078-
custom_unittest(
1079-
name = "make_rocksdb_lite_release",
1080-
command = ["internal_repo_rocksdb/make_rocksdb_lite_release.sh"],
1081-
type = "simple",
1082-
)

rocksdb-sys/rocksdb/buckifier/targets_cfg.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,4 @@
135135
command = [TEST_RUNNER, BUCK_BINS + test_bin]
136136
)
137137
138-
custom_unittest(
139-
name = "make_rocksdbjavastatic",
140-
command = ["internal_repo_rocksdb/make_rocksdbjavastatic.sh"],
141-
type = "simple",
142-
)
143-
144-
custom_unittest(
145-
name = "make_rocksdb_lite_release",
146-
command = ["internal_repo_rocksdb/make_rocksdb_lite_release.sh"],
147-
type = "simple",
148-
)
149138
"""

rocksdb-sys/rocksdb/db/db_impl_files.cc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define __STDC_FORMAT_MACROS
1313
#endif
1414
#include <inttypes.h>
15+
#include <set>
1516
#include <unordered_set>
1617
#include "db/event_helpers.h"
1718
#include "db/memtable_list.h"
@@ -99,10 +100,10 @@ void DBImpl::FindObsoleteFiles(JobContext* job_context, bool force,
99100
if (doing_the_full_scan) {
100101
InfoLogPrefix info_log_prefix(!immutable_db_options_.db_log_dir.empty(),
101102
dbname_);
102-
std::vector<std::string> paths;
103+
std::set<std::string> paths;
103104
for (size_t path_id = 0; path_id < immutable_db_options_.db_paths.size();
104105
path_id++) {
105-
paths.emplace_back(immutable_db_options_.db_paths[path_id].path);
106+
paths.insert(immutable_db_options_.db_paths[path_id].path);
106107
}
107108

108109
// Note that if cf_paths is not specified in the ColumnFamilyOptions
@@ -113,7 +114,11 @@ void DBImpl::FindObsoleteFiles(JobContext* job_context, bool force,
113114
for (auto cfd : *versions_->GetColumnFamilySet()) {
114115
for (size_t path_id = 0; path_id < cfd->ioptions()->cf_paths.size();
115116
path_id++) {
116-
paths.emplace_back(cfd->ioptions()->cf_paths[path_id].path);
117+
auto& path = cfd->ioptions()->cf_paths[path_id].path;
118+
119+
if (paths.find(path) == paths.end()) {
120+
paths.insert(path);
121+
}
117122
}
118123
}
119124

rocksdb-sys/rocksdb/db/memtable.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ static bool SaveValue(void* arg, const char* entry) {
696696
*(s->merge_in_progress) = true;
697697
merge_context->PushOperand(
698698
v, s->inplace_update_support == false /* operand_pinned */);
699-
if (merge_operator->ShouldMerge(merge_context->GetOperands())) {
699+
if (merge_operator->ShouldMerge(merge_context->GetOperandsDirectionBackward())) {
700700
*(s->status) = MergeHelper::TimedFullMerge(
701701
merge_operator, s->key->user_key(), nullptr,
702702
merge_context->GetOperands(), s->value, s->logger, s->statistics,

rocksdb-sys/rocksdb/db/merge_context.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,13 @@ class MergeContext {
7474
return (*operand_list_)[index];
7575
}
7676

77-
// Return all the operands.
77+
// Same as GetOperandsDirectionForward
7878
const std::vector<Slice>& GetOperands() {
79+
return GetOperandsDirectionForward();
80+
}
81+
82+
// Return all the operands in the order as they were merged (passed to FullMerge or FullMergeV2)
83+
const std::vector<Slice>& GetOperandsDirectionForward() {
7984
if (!operand_list_) {
8085
return empty_operand_list;
8186
}
@@ -84,6 +89,16 @@ class MergeContext {
8489
return *operand_list_;
8590
}
8691

92+
// Return all the operands in the reversed order relative to how they were merged (passed to FullMerge or FullMergeV2)
93+
const std::vector<Slice>& GetOperandsDirectionBackward() {
94+
if (!operand_list_) {
95+
return empty_operand_list;
96+
}
97+
98+
SetDirectionBackward();
99+
return *operand_list_;
100+
}
101+
87102
private:
88103
void Initialize() {
89104
if (!operand_list_) {

rocksdb-sys/rocksdb/include/rocksdb/merge_operator.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ class MergeOperator {
195195
// during a point lookup, thereby helping in limiting the number of levels to
196196
// read from.
197197
// Doesn't help with iterators.
198+
//
199+
// Note: the merge operands are passed to this function in the reversed order
200+
// relative to how they were merged (passed to FullMerge or FullMergeV2)
201+
// for performance reasons, see also:
202+
// https://github.com/facebook/rocksdb/issues/3865
198203
virtual bool ShouldMerge(const std::vector<Slice>& /*operands*/) const {
199204
return false;
200205
}

rocksdb-sys/rocksdb/include/rocksdb/utilities/ldb_cmd.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,20 @@ class LDBCommand {
210210
bool ParseStringOption(const std::map<std::string, std::string>& options,
211211
const std::string& option, std::string* value);
212212

213+
/**
214+
* Returns the value of the specified option as a boolean.
215+
* default_val is used if the option is not found in options.
216+
* Throws an exception if the value of the option is not
217+
* "true" or "false" (case insensitive).
218+
*/
219+
bool ParseBooleanOption(const std::map<std::string, std::string>& options,
220+
const std::string& option, bool default_val);
221+
213222
Options options_;
214223
std::vector<ColumnFamilyDescriptor> column_families_;
215224
LDBOptions ldb_options_;
216225

217226
private:
218-
friend class WALDumperCommand;
219227
/**
220228
* Interpret command line options and flags to determine if the key
221229
* should be input/output in hex.
@@ -230,15 +238,6 @@ class LDBCommand {
230238
bool IsValueHex(const std::map<std::string, std::string>& options,
231239
const std::vector<std::string>& flags);
232240

233-
/**
234-
* Returns the value of the specified option as a boolean.
235-
* default_val is used if the option is not found in options.
236-
* Throws an exception if the value of the option is not
237-
* "true" or "false" (case insensitive).
238-
*/
239-
bool ParseBooleanOption(const std::map<std::string, std::string>& options,
240-
const std::string& option, bool default_val);
241-
242241
/**
243242
* Converts val to a boolean.
244243
* val must be either true or false (case insensitive).

rocksdb-sys/rocksdb/include/rocksdb/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#define ROCKSDB_MAJOR 5
88
#define ROCKSDB_MINOR 14
9-
#define ROCKSDB_PATCH 2
9+
#define ROCKSDB_PATCH 3
1010

1111
// Do not use these. We made the mistake of declaring macros starting with
1212
// double underscore. Now we have to live with our choice. We'll deprecate these

rocksdb-sys/rocksdb/table/get_context.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ bool GetContext::SaveValue(const ParsedInternalKey& parsed_key,
200200
merge_context_->PushOperand(value, false);
201201
}
202202
if (merge_operator_ != nullptr &&
203-
merge_operator_->ShouldMerge(merge_context_->GetOperands())) {
203+
merge_operator_->ShouldMerge(merge_context_->GetOperandsDirectionBackward())) {
204204
state_ = kFound;
205205
if (LIKELY(pinnable_val_ != nullptr)) {
206206
Status merge_status = MergeHelper::TimedFullMerge(

0 commit comments

Comments
 (0)