18285c1e2f
Summary: Make RocksDb build and run on Windows to be functionally complete and performant. All existing test cases run with no regressions. Performance numbers are in the pull-request. Test plan: make all of the existing unit tests pass, obtain perf numbers. Co-authored-by: Praveen Rao praveensinghrao@outlook.com Co-authored-by: Sherlock Huang baihan.huang@gmail.com Co-authored-by: Alex Zinoviev alexander.zinoviev@me.com Co-authored-by: Dmitri Smirnov dmitrism@microsoft.com
94 lines
3.4 KiB
C++
94 lines
3.4 KiB
C++
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
|
|
#ifndef ROCKSDB_LITE
|
|
#include "table/plain_table_factory.h"
|
|
|
|
#include <memory>
|
|
#include <stdint.h>
|
|
#include "db/dbformat.h"
|
|
#include "table/plain_table_builder.h"
|
|
#include "table/plain_table_reader.h"
|
|
#include "port/port.h"
|
|
|
|
namespace rocksdb {
|
|
|
|
Status PlainTableFactory::NewTableReader(const ImmutableCFOptions& ioptions,
|
|
const EnvOptions& env_options,
|
|
const InternalKeyComparator& icomp,
|
|
std::unique_ptr<RandomAccessFile>&& file,
|
|
uint64_t file_size,
|
|
std::unique_ptr<TableReader>* table) const {
|
|
return PlainTableReader::Open(ioptions, env_options, table_options_,
|
|
icomp, std::move(file), file_size, table);
|
|
}
|
|
|
|
TableBuilder* PlainTableFactory::NewTableBuilder(
|
|
const TableBuilderOptions& table_builder_options,
|
|
WritableFile* file) const {
|
|
// Ignore the skip_filters flag. PlainTable format is optimized for small
|
|
// in-memory dbs. The skip_filters optimization is not useful for plain
|
|
// tables
|
|
//
|
|
return new PlainTableBuilder(table_builder_options.ioptions,
|
|
table_builder_options.int_tbl_prop_collector_factories,
|
|
table_options_, file, 6);
|
|
}
|
|
|
|
std::string PlainTableFactory::GetPrintableTableOptions() const {
|
|
std::string ret;
|
|
ret.reserve(20000);
|
|
const int kBufferSize = 200;
|
|
char buffer[kBufferSize];
|
|
|
|
snprintf(buffer, kBufferSize, " user_key_len: %u\n",
|
|
table_options_.user_key_len);
|
|
ret.append(buffer);
|
|
snprintf(buffer, kBufferSize, " bloom_bits_per_key: %d\n",
|
|
table_options_.bloom_bits_per_key);
|
|
ret.append(buffer);
|
|
snprintf(buffer, kBufferSize, " hash_table_ratio: %lf\n",
|
|
table_options_.hash_table_ratio);
|
|
ret.append(buffer);
|
|
snprintf(buffer, kBufferSize, " index_sparseness: %" ROCKSDB_PRIszt "\n",
|
|
table_options_.index_sparseness);
|
|
ret.append(buffer);
|
|
snprintf(buffer, kBufferSize, " huge_page_tlb_size: %" ROCKSDB_PRIszt "\n",
|
|
table_options_.huge_page_tlb_size);
|
|
ret.append(buffer);
|
|
snprintf(buffer, kBufferSize, " encoding_type: %d\n",
|
|
table_options_.encoding_type);
|
|
ret.append(buffer);
|
|
snprintf(buffer, kBufferSize, " full_scan_mode: %d\n",
|
|
table_options_.full_scan_mode);
|
|
ret.append(buffer);
|
|
snprintf(buffer, kBufferSize, " store_index_in_file: %d\n",
|
|
table_options_.store_index_in_file);
|
|
ret.append(buffer);
|
|
return ret;
|
|
}
|
|
|
|
const PlainTableOptions& PlainTableFactory::GetTableOptions() const {
|
|
return table_options_;
|
|
}
|
|
|
|
extern TableFactory* NewPlainTableFactory(const PlainTableOptions& options) {
|
|
return new PlainTableFactory(options);
|
|
}
|
|
|
|
const std::string PlainTablePropertyNames::kPrefixExtractorName =
|
|
"rocksdb.prefix.extractor.name";
|
|
|
|
const std::string PlainTablePropertyNames::kEncodingType =
|
|
"rocksdb.plain.table.encoding.type";
|
|
|
|
const std::string PlainTablePropertyNames::kBloomVersion =
|
|
"rocksdb.plain.table.bloom.version";
|
|
|
|
const std::string PlainTablePropertyNames::kNumBloomBlocks =
|
|
"rocksdb.plain.table.bloom.numblocks";
|
|
|
|
} // namespace rocksdb
|
|
#endif // ROCKSDB_LITE
|