Merge branch 'keydbpro' into PRO_RELEASE_6
Former-commit-id: 08264b4e755cee34704c85b191606a2b28d6d883
This commit is contained in:
commit
d613231798
@ -313,7 +313,7 @@ bool initializeStorageProvider(const char **err)
|
||||
{
|
||||
// Create The Storage Factory (if necessary)
|
||||
serverLog(LL_NOTICE, "Initializing FLASH storage provider (this may take a long time)");
|
||||
g_pserver->m_pstorageFactory = CreateRocksDBStorageFactory(g_sdsArgs, cserver.dbnum);
|
||||
g_pserver->m_pstorageFactory = CreateRocksDBStorageFactory(g_sdsArgs, cserver.dbnum, cserver.storage_conf, cserver.storage_conf ? strlen(cserver.storage_conf) : 0);
|
||||
}
|
||||
else if (!strcasecmp(g_sdsProvider, "test") && g_sdsArgs == nullptr)
|
||||
{
|
||||
@ -2324,6 +2324,7 @@ standardConfig configs[] = {
|
||||
createStringConfig("bio_cpulist", NULL, IMMUTABLE_CONFIG, EMPTY_STRING_IS_NULL, g_pserver->bio_cpulist, NULL, NULL, NULL),
|
||||
createStringConfig("aof_rewrite_cpulist", NULL, IMMUTABLE_CONFIG, EMPTY_STRING_IS_NULL, g_pserver->aof_rewrite_cpulist, NULL, NULL, NULL),
|
||||
createStringConfig("bgsave_cpulist", NULL, IMMUTABLE_CONFIG, EMPTY_STRING_IS_NULL, g_pserver->bgsave_cpulist, NULL, NULL, NULL),
|
||||
createStringConfig("storage-provider-options", NULL, IMMUTABLE_CONFIG, EMPTY_STRING_IS_NULL, cserver.storage_conf, NULL, NULL, NULL),
|
||||
|
||||
/* Enum Configs */
|
||||
createEnumConfig("supervised", NULL, IMMUTABLE_CONFIG, supervised_mode_enum, cserver.supervised_mode, SUPERVISED_NONE, NULL, NULL),
|
||||
|
@ -2061,6 +2061,7 @@ struct redisServerConst {
|
||||
int thread_min_client_threshold = 50;
|
||||
int multimaster_no_forward;
|
||||
int storage_memory_model = STORAGE_WRITETHROUGH;
|
||||
char *storage_conf = nullptr;
|
||||
};
|
||||
|
||||
struct redisServer {
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <rocksdb/table.h>
|
||||
#include <rocksdb/utilities/options_util.h>
|
||||
#include <rocksdb/sst_file_manager.h>
|
||||
#include <rocksdb/utilities/convenience.h>
|
||||
|
||||
class RocksDBStorageFactory : public IStorageFactory
|
||||
{
|
||||
@ -12,7 +13,7 @@ class RocksDBStorageFactory : public IStorageFactory
|
||||
std::shared_ptr<rocksdb::SstFileManager> m_pfilemanager;
|
||||
|
||||
public:
|
||||
RocksDBStorageFactory(const char *dbfile, int dbnum);
|
||||
RocksDBStorageFactory(const char *dbfile, int dbnum, const char *rgchConfig, size_t cchConfig);
|
||||
~RocksDBStorageFactory();
|
||||
|
||||
virtual IStorage *create(int db, key_load_iterator iter, void *privdata) override;
|
||||
@ -26,12 +27,12 @@ private:
|
||||
void setVersion(rocksdb::ColumnFamilyHandle*);
|
||||
};
|
||||
|
||||
IStorageFactory *CreateRocksDBStorageFactory(const char *path, int dbnum)
|
||||
IStorageFactory *CreateRocksDBStorageFactory(const char *path, int dbnum, const char *rgchConfig, size_t cchConfig)
|
||||
{
|
||||
return new RocksDBStorageFactory(path, dbnum);
|
||||
return new RocksDBStorageFactory(path, dbnum, rgchConfig, cchConfig);
|
||||
}
|
||||
|
||||
RocksDBStorageFactory::RocksDBStorageFactory(const char *dbfile, int dbnum)
|
||||
RocksDBStorageFactory::RocksDBStorageFactory(const char *dbfile, int dbnum, const char *rgchConfig, size_t cchConfig)
|
||||
{
|
||||
// Get the count of column families in the actual database
|
||||
std::vector<std::string> vecT;
|
||||
@ -51,7 +52,17 @@ RocksDBStorageFactory::RocksDBStorageFactory(const char *dbfile, int dbnum)
|
||||
options.create_missing_column_families = true;
|
||||
rocksdb::DB *db = nullptr;
|
||||
|
||||
|
||||
if (rgchConfig != nullptr)
|
||||
{
|
||||
std::string options_string(rgchConfig, cchConfig);
|
||||
rocksdb::Status status;
|
||||
if (!(status = rocksdb::GetDBOptionsFromString(options, options_string, &options)).ok())
|
||||
{
|
||||
fprintf(stderr, "Failed to parse FLASH options: %s\r\n", status.ToString().c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
options.max_background_compactions = 4;
|
||||
options.max_background_flushes = 2;
|
||||
options.bytes_per_sync = 1048576;
|
||||
|
@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
class IStorageFactory *CreateRocksDBStorageFactory(const char *path, int dbnum);
|
||||
class IStorageFactory *CreateRocksDBStorageFactory(const char *path, int dbnum, const char *rgchConfig, size_t cchConfig);
|
Loading…
x
Reference in New Issue
Block a user