Skip to content

Commit

Permalink
Adapt rocksdb 6.5.2 (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
linxGnu committed Dec 13, 2019
1 parent 9107617 commit eed39a1
Show file tree
Hide file tree
Showing 68 changed files with 858 additions and 274 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ STRIPFLAGS = -S -x

# Dependencies and Rocksdb
ZLIB_COMMIT = cacf7f1d4e3d44d871b605da3b647f07d718623f
SNAPPY_COMMIT = e9e11b84e629c3e06fbaa4f0a86de02ceb9d6992
LZ4_COMMIT = e8baeca51ef2003d6c9ec21c32f1563fef1065b9
ZSTD_COMMIT = a3d655d2255481333e09ecca9855f1b37f757c52
SNAPPY_COMMIT = f5acee902c4d2110f671455460172cb6d3bf5b73
LZ4_COMMIT = 0f749838bf29bc0d1df428e23cf3dbb76ec4e9fc
ZSTD_COMMIT = 10f0e6993f9d2f682da6d04aa2385b7d53cbb4ee
BZ2_COMMIT = 6a8690fc8d26c815e798c588f796eabe9d684cf0
ROCKSDB_COMMIT = e3169e3ea8762d2f34880742106858a23c8dc8b7
ROCKSDB_COMMIT = 4cfbd87afd08a16df28436fb990ef6b154ee6114

ROCKSDB_EXTRA_CXXFLAGS :=
ifeq ($(GOOS), darwin)
Expand Down
29 changes: 22 additions & 7 deletions dist/darwin_amd64/include/rocksdb/advanced_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,26 @@ struct AdvancedColumnFamilyOptions {
// individual write buffers. Default: 1
int min_write_buffer_number_to_merge = 1;

// DEPRECATED
// The total maximum number of write buffers to maintain in memory including
// copies of buffers that have already been flushed. Unlike
// max_write_buffer_number, this parameter does not affect flushing.
// This controls the minimum amount of write history that will be available
// in memory for conflict checking when Transactions are used.
// This parameter is being replaced by max_write_buffer_size_to_maintain.
// If both parameters are set to non-zero values, this parameter will be
// ignored.
int max_write_buffer_number_to_maintain = 0;

// The total maximum size(bytes) of write buffers to maintain in memory
// including copies of buffers that have already been flushed. This parameter
// only affects trimming of flushed buffers and does not affect flushing.
// This controls the maximum amount of write history that will be available
// in memory for conflict checking when Transactions are used. The actual
// size of write history (flushed Memtables) might be higher than this limit
// if further trimming will reduce write history total size below this
// limit. For example, if max_write_buffer_size_to_maintain is set to 64MB,
// and there are three flushed Memtables, with sizes of 32MB, 20MB, 20MB.
// Because trimming the next Memtable of size 20MB will reduce total memory
// usage to 52MB which is below the limit, RocksDB will stop trimming.
//
// When using an OptimisticTransactionDB:
// If this value is too low, some transactions may fail at commit time due
Expand All @@ -192,14 +207,14 @@ struct AdvancedColumnFamilyOptions {
// done for conflict detection.
//
// Setting this value to 0 will cause write buffers to be freed immediately
// after they are flushed.
// If this value is set to -1, 'max_write_buffer_number' will be used.
// after they are flushed. If this value is set to -1,
// 'max_write_buffer_number * write_buffer_size' will be used.
//
// Default:
// If using a TransactionDB/OptimisticTransactionDB, the default value will
// be set to the value of 'max_write_buffer_number' if it is not explicitly
// set by the user. Otherwise, the default is 0.
int max_write_buffer_number_to_maintain = 0;
// be set to the value of 'max_write_buffer_number * write_buffer_size'
// if it is not explicitly set by the user. Otherwise, the default is 0.
int64_t max_write_buffer_size_to_maintain = 0;

// Allows thread-safe inplace updates. If this is true, there is no way to
// achieve point-in-time consistency using snapshot or iterator (assuming
Expand Down
6 changes: 6 additions & 0 deletions dist/darwin_amd64/include/rocksdb/c.h
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,9 @@ rocksdb_options_set_min_write_buffer_number_to_merge(rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_max_write_buffer_number_to_maintain(rocksdb_options_t*,
int);
extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_max_write_buffer_size_to_maintain(rocksdb_options_t*,
int64_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_enable_pipelined_write(
rocksdb_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_unordered_write(
Expand Down Expand Up @@ -1260,6 +1263,9 @@ extern ROCKSDB_LIBRARY_API void rocksdb_writeoptions_set_no_slowdown(
rocksdb_writeoptions_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void rocksdb_writeoptions_set_low_pri(
rocksdb_writeoptions_t*, unsigned char);
extern ROCKSDB_LIBRARY_API void
rocksdb_writeoptions_set_memtable_insert_hint_per_batch(rocksdb_writeoptions_t*,
unsigned char);

/* Compact range options */

Expand Down
7 changes: 3 additions & 4 deletions dist/darwin_amd64/include/rocksdb/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ class Cache {

Cache(std::shared_ptr<MemoryAllocator> allocator = nullptr)
: memory_allocator_(std::move(allocator)) {}
// No copying allowed
Cache(const Cache&) = delete;
Cache& operator=(const Cache&) = delete;

// Destroys all existing entries by calling the "deleter"
// function that was passed via the Insert() function.
Expand Down Expand Up @@ -253,10 +256,6 @@ class Cache {
MemoryAllocator* memory_allocator() const { return memory_allocator_.get(); }

private:
// No copying allowed
Cache(const Cache&);
Cache& operator=(const Cache&);

std::shared_ptr<MemoryAllocator> memory_allocator_;
};

Expand Down
4 changes: 2 additions & 2 deletions dist/darwin_amd64/include/rocksdb/cleanable.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ namespace rocksdb {
class Cleanable {
public:
Cleanable();
~Cleanable();

// No copy constructor and copy assignment allowed.
Cleanable(Cleanable&) = delete;
Cleanable& operator=(Cleanable&) = delete;

~Cleanable();

// Move constructor and move assignment is allowed.
Cleanable(Cleanable&&);
Cleanable& operator=(Cleanable&&);
Expand Down
7 changes: 7 additions & 0 deletions dist/darwin_amd64/include/rocksdb/convenience.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,13 @@ Status DeleteFilesInRanges(DB* db, ColumnFamilyHandle* column_family,
Status VerifySstFileChecksum(const Options& options,
const EnvOptions& env_options,
const std::string& file_path);

// Verify the checksum of file
Status VerifySstFileChecksum(const Options& options,
const EnvOptions& env_options,
const ReadOptions& read_options,
const std::string& file_path);

#endif // ROCKSDB_LITE

} // namespace rocksdb
42 changes: 36 additions & 6 deletions dist/darwin_amd64/include/rocksdb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ struct IngestExternalFileArg {
IngestExternalFileOptions options;
};

struct GetMergeOperandsOptions {
int expected_max_number_of_operands = 0;
};

// A collections of table properties objects, where
// key: is the table's file name.
// value: the table properties object of the given table.
Expand Down Expand Up @@ -251,6 +255,10 @@ class DB {
std::vector<std::string>* column_families);

DB() {}
// No copying allowed
DB(const DB&) = delete;
void operator=(const DB&) = delete;

virtual ~DB();

// Create a column_family and return the handle of column family
Expand Down Expand Up @@ -403,6 +411,22 @@ class DB {
return Get(options, DefaultColumnFamily(), key, value);
}

// Returns all the merge operands corresponding to the key. If the
// number of merge operands in DB is greater than
// merge_operands_options.expected_max_number_of_operands
// no merge operands are returned and status is Incomplete. Merge operands
// returned are in the order of insertion.
// merge_operands- Points to an array of at-least
// merge_operands_options.expected_max_number_of_operands and the
// caller is responsible for allocating it. If the status
// returned is Incomplete then number_of_operands will contain
// the total number of merge operands found in DB for key.
virtual Status GetMergeOperands(
const ReadOptions& options, ColumnFamilyHandle* column_family,
const Slice& key, PinnableSlice* merge_operands,
GetMergeOperandsOptions* get_merge_operands_options,
int* number_of_operands) = 0;

// If keys[i] does not exist in the database, then the i'th returned
// status will be one for which Status::IsNotFound() is true, and
// (*values)[i] will be set to some arbitrary value (often ""). Otherwise,
Expand Down Expand Up @@ -1103,6 +1127,15 @@ class DB {
// Retrieve the sorted list of all wal files with earliest file first
virtual Status GetSortedWalFiles(VectorLogPtr& files) = 0;

// Retrieve information about the current wal file
//
// Note that the log might have rolled after this call in which case
// the current_log_file would not point to the current log file.
//
// Additionally, for the sake of optimization current_log_file->StartSequence
// would always be set to 0
virtual Status GetCurrentWalFile(std::unique_ptr<LogFile>* current_log_file) = 0;

// Note: this API is not yet consistent with WritePrepared transactions.
// Sets iter to an iterator that is positioned at a write-batch containing
// seq_number. If the sequence number is non existent, it returns an iterator
Expand Down Expand Up @@ -1205,7 +1238,9 @@ class DB {
const ExportImportFilesMetaData& metadata,
ColumnFamilyHandle** handle) = 0;

virtual Status VerifyChecksum() = 0;
virtual Status VerifyChecksum(const ReadOptions& read_options) = 0;

virtual Status VerifyChecksum() { return VerifyChecksum(ReadOptions()); }

// AddFile() is deprecated, please use IngestExternalFile()
ROCKSDB_DEPRECATED_FUNC virtual Status AddFile(
Expand Down Expand Up @@ -1390,11 +1425,6 @@ class DB {
return Status::NotSupported("Supported only by secondary instance");
}
#endif // !ROCKSDB_LITE

private:
// No copying allowed
DB(const DB&);
void operator=(const DB&);
};

// Destroy the contents of the specified database.
Expand Down
33 changes: 16 additions & 17 deletions dist/darwin_amd64/include/rocksdb/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ class Env {
};

Env() : thread_status_updater_(nullptr) {}
// No copying allowed
Env(const Env&) = delete;
void operator=(const Env&) = delete;

virtual ~Env();

Expand Down Expand Up @@ -527,11 +530,6 @@ class Env {
// The pointer to an internal structure that will update the
// status of each thread.
ThreadStatusUpdater* thread_status_updater_;

private:
// No copying allowed
Env(const Env&);
void operator=(const Env&);
};

// The factory function to construct a ThreadStatusUpdater. Any Env
Expand Down Expand Up @@ -711,6 +709,9 @@ class WritableFile {
io_priority_(Env::IO_TOTAL),
write_hint_(Env::WLTH_NOT_SET),
strict_bytes_per_sync_(options.strict_bytes_per_sync) {}
// No copying allowed
WritableFile(const WritableFile&) = delete;
void operator=(const WritableFile&) = delete;

virtual ~WritableFile();

Expand Down Expand Up @@ -870,9 +871,6 @@ class WritableFile {
private:
size_t last_preallocated_block_;
size_t preallocation_block_size_;
// No copying allowed
WritableFile(const WritableFile&);
void operator=(const WritableFile&);

protected:
Env::IOPriority io_priority_;
Expand All @@ -884,6 +882,10 @@ class WritableFile {
class RandomRWFile {
public:
RandomRWFile() {}
// No copying allowed
RandomRWFile(const RandomRWFile&) = delete;
RandomRWFile& operator=(const RandomRWFile&) = delete;

virtual ~RandomRWFile() {}

// Indicates if the class makes use of direct I/O
Expand Down Expand Up @@ -914,10 +916,6 @@ class RandomRWFile {

// If you're adding methods here, remember to add them to
// RandomRWFileWrapper too.

// No copying allowed
RandomRWFile(const RandomRWFile&) = delete;
RandomRWFile& operator=(const RandomRWFile&) = delete;
};

// MemoryMappedFileBuffer object represents a memory-mapped file's raw buffer.
Expand Down Expand Up @@ -975,6 +973,10 @@ class Logger {

explicit Logger(const InfoLogLevel log_level = InfoLogLevel::INFO_LEVEL)
: closed_(false), log_level_(log_level) {}
// No copying allowed
Logger(const Logger&) = delete;
void operator=(const Logger&) = delete;

virtual ~Logger();

// Close the log file. Must be called before destructor. If the return
Expand Down Expand Up @@ -1016,9 +1018,6 @@ class Logger {
bool closed_;

private:
// No copying allowed
Logger(const Logger&);
void operator=(const Logger&);
InfoLogLevel log_level_;
};

Expand All @@ -1030,8 +1029,8 @@ class FileLock {

private:
// No copying allowed
FileLock(const FileLock&);
void operator=(const FileLock&);
FileLock(const FileLock&) = delete;
void operator=(const FileLock&) = delete;
};

class DynamicLibrary {
Expand Down
9 changes: 4 additions & 5 deletions dist/darwin_amd64/include/rocksdb/iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ namespace rocksdb {
class Iterator : public Cleanable {
public:
Iterator() {}
// No copying allowed
Iterator(const Iterator&) = delete;
void operator=(const Iterator&) = delete;

virtual ~Iterator() {}

// An iterator is either positioned at a key/value pair, or
Expand Down Expand Up @@ -104,11 +108,6 @@ class Iterator : public Cleanable {
// Get the user-key portion of the internal key at which the iteration
// stopped.
virtual Status GetProperty(std::string prop_name, std::string* prop);

private:
// No copying allowed
Iterator(const Iterator&);
void operator=(const Iterator&);
};

// Return an empty iterator (yields nothing).
Expand Down
22 changes: 22 additions & 0 deletions dist/darwin_amd64/include/rocksdb/memtablerep.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,28 @@ class MemTableRep {
return true;
}

// Same as ::InsertWithHint, but allow concurrnet write
//
// If hint points to nullptr, a new hint will be allocated on heap, otherwise
// the hint will be updated to reflect the last insert location. The hint is
// owned by the caller and it is the caller's responsibility to delete the
// hint later.
//
// Currently only skip-list based memtable implement the interface. Other
// implementations will fallback to InsertConcurrently() by default.
virtual void InsertWithHintConcurrently(KeyHandle handle, void** /*hint*/) {
// Ignore the hint by default.
InsertConcurrently(handle);
}

// Same as ::InsertWithHintConcurrently
// Returns false if MemTableRepFactory::CanHandleDuplicatedKey() is true and
// the <key, seq> already exists.
virtual bool InsertKeyWithHintConcurrently(KeyHandle handle, void** hint) {
InsertWithHintConcurrently(handle, hint);
return true;
}

// Like Insert(handle), but may be called concurrent with other calls
// to InsertConcurrently for other handles.
//
Expand Down
Loading

0 comments on commit eed39a1

Please sign in to comment.