2016-02-10 00:12:00 +01:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2017-07-16 01:03:42 +02:00
|
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
|
|
// (found in the LICENSE.Apache file in the root directory).
|
Remove ldb HexToString method's usage of sscanf
Summary:
Fix hex2String performance issues by removing sscanf dependency.
Also fixed some edge case handling (odd length, bad input).
Test Plan: Created a test file which called old and new implementation, and validated results are the same. I'll paste results in the phabricator diff.
Reviewers: igor, rven, anthony, IslamAbdelRahman, kradhakrishnan, yhchiang, sdong
Reviewed By: sdong
Subscribers: thatsafunnyname, leveldb, dhruba
Differential Revision: https://reviews.facebook.net/D46785
2015-09-23 23:25:46 +02:00
|
|
|
//
|
2015-10-15 19:51:00 +02:00
|
|
|
#ifndef ROCKSDB_LITE
|
|
|
|
|
2016-05-07 01:09:09 +02:00
|
|
|
#include "rocksdb/utilities/ldb_cmd.h"
|
Introduce a new storage specific Env API (#5761)
Summary:
The current Env API encompasses both storage/file operations, as well as OS related operations. Most of the APIs return a Status, which does not have enough metadata about an error, such as whether its retry-able or not, scope (i.e fault domain) of the error etc., that may be required in order to properly handle a storage error. The file APIs also do not provide enough control over the IO SLA, such as timeout, prioritization, hinting about placement and redundancy etc.
This PR separates out the file/storage APIs from Env into a new FileSystem class. The APIs are updated to return an IOStatus with metadata about the error, as well as to take an IOOptions structure as input in order to allow more control over the IO.
The user can set both ```options.env``` and ```options.file_system``` to specify that RocksDB should use the former for OS related operations and the latter for storage operations. Internally, a ```CompositeEnvWrapper``` has been introduced that inherits from ```Env``` and redirects individual methods to either an ```Env``` implementation or the ```FileSystem``` as appropriate. When options are sanitized during ```DB::Open```, ```options.env``` is replaced with a newly allocated ```CompositeEnvWrapper``` instance if both env and file_system have been specified. This way, the rest of the RocksDB code can continue to function as before.
This PR also ports PosixEnv to the new API by splitting it into two - PosixEnv and PosixFileSystem. PosixEnv is defined as a sub-class of CompositeEnvWrapper, and threading/time functions are overridden with Posix specific implementations in order to avoid an extra level of indirection.
The ```CompositeEnvWrapper``` translates ```IOStatus``` return code to ```Status```, and sets the severity to ```kSoftError``` if the io_status is retryable. The error handling code in RocksDB can then recover the DB automatically.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5761
Differential Revision: D18868376
Pulled By: anand1976
fbshipit-source-id: 39efe18a162ea746fabac6360ff529baba48486f
2019-12-13 23:47:08 +01:00
|
|
|
#include "env/composite_env_wrapper.h"
|
2019-10-09 04:17:39 +02:00
|
|
|
#include "port/stack_trace.h"
|
2019-08-16 01:59:42 +02:00
|
|
|
#include "test_util/sync_point.h"
|
2019-05-30 20:21:38 +02:00
|
|
|
#include "test_util/testharness.h"
|
Remove ldb HexToString method's usage of sscanf
Summary:
Fix hex2String performance issues by removing sscanf dependency.
Also fixed some edge case handling (odd length, bad input).
Test Plan: Created a test file which called old and new implementation, and validated results are the same. I'll paste results in the phabricator diff.
Reviewers: igor, rven, anthony, IslamAbdelRahman, kradhakrishnan, yhchiang, sdong
Reviewed By: sdong
Subscribers: thatsafunnyname, leveldb, dhruba
Differential Revision: https://reviews.facebook.net/D46785
2015-09-23 23:25:46 +02:00
|
|
|
|
2016-05-07 01:09:09 +02:00
|
|
|
using std::string;
|
|
|
|
using std::vector;
|
|
|
|
using std::map;
|
|
|
|
|
2019-01-03 20:11:09 +01:00
|
|
|
namespace rocksdb {
|
|
|
|
|
2019-10-09 04:17:39 +02:00
|
|
|
class LdbCmdTest : public testing::Test {
|
|
|
|
public:
|
|
|
|
LdbCmdTest() : testing::Test() {}
|
|
|
|
|
|
|
|
Env* TryLoadCustomOrDefaultEnv() {
|
|
|
|
const char* test_env_uri = getenv("TEST_ENV_URI");
|
|
|
|
if (!test_env_uri) {
|
|
|
|
return Env::Default();
|
|
|
|
}
|
|
|
|
Env* env = Env::Default();
|
|
|
|
Env::LoadEnv(test_env_uri, &env, &env_guard_);
|
|
|
|
return env;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::shared_ptr<Env> env_guard_;
|
|
|
|
};
|
Remove ldb HexToString method's usage of sscanf
Summary:
Fix hex2String performance issues by removing sscanf dependency.
Also fixed some edge case handling (odd length, bad input).
Test Plan: Created a test file which called old and new implementation, and validated results are the same. I'll paste results in the phabricator diff.
Reviewers: igor, rven, anthony, IslamAbdelRahman, kradhakrishnan, yhchiang, sdong
Reviewed By: sdong
Subscribers: thatsafunnyname, leveldb, dhruba
Differential Revision: https://reviews.facebook.net/D46785
2015-09-23 23:25:46 +02:00
|
|
|
|
|
|
|
TEST_F(LdbCmdTest, HexToString) {
|
|
|
|
// map input to expected outputs.
|
2016-03-30 06:25:12 +02:00
|
|
|
// odd number of "hex" half bytes doesn't make sense
|
Remove ldb HexToString method's usage of sscanf
Summary:
Fix hex2String performance issues by removing sscanf dependency.
Also fixed some edge case handling (odd length, bad input).
Test Plan: Created a test file which called old and new implementation, and validated results are the same. I'll paste results in the phabricator diff.
Reviewers: igor, rven, anthony, IslamAbdelRahman, kradhakrishnan, yhchiang, sdong
Reviewed By: sdong
Subscribers: thatsafunnyname, leveldb, dhruba
Differential Revision: https://reviews.facebook.net/D46785
2015-09-23 23:25:46 +02:00
|
|
|
map<string, vector<int>> inputMap = {
|
2016-03-30 06:25:12 +02:00
|
|
|
{"0x07", {7}}, {"0x5050", {80, 80}}, {"0xFF", {-1}},
|
|
|
|
{"0x1234", {18, 52}}, {"0xaaAbAC", {-86, -85, -84}}, {"0x1203", {18, 3}},
|
Remove ldb HexToString method's usage of sscanf
Summary:
Fix hex2String performance issues by removing sscanf dependency.
Also fixed some edge case handling (odd length, bad input).
Test Plan: Created a test file which called old and new implementation, and validated results are the same. I'll paste results in the phabricator diff.
Reviewers: igor, rven, anthony, IslamAbdelRahman, kradhakrishnan, yhchiang, sdong
Reviewed By: sdong
Subscribers: thatsafunnyname, leveldb, dhruba
Differential Revision: https://reviews.facebook.net/D46785
2015-09-23 23:25:46 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
for (const auto& inPair : inputMap) {
|
|
|
|
auto actual = rocksdb::LDBCommand::HexToString(inPair.first);
|
|
|
|
auto expected = inPair.second;
|
|
|
|
for (unsigned int i = 0; i < actual.length(); i++) {
|
2016-12-12 23:32:55 +01:00
|
|
|
EXPECT_EQ(expected[i], static_cast<int>((signed char) actual[i]));
|
Remove ldb HexToString method's usage of sscanf
Summary:
Fix hex2String performance issues by removing sscanf dependency.
Also fixed some edge case handling (odd length, bad input).
Test Plan: Created a test file which called old and new implementation, and validated results are the same. I'll paste results in the phabricator diff.
Reviewers: igor, rven, anthony, IslamAbdelRahman, kradhakrishnan, yhchiang, sdong
Reviewed By: sdong
Subscribers: thatsafunnyname, leveldb, dhruba
Differential Revision: https://reviews.facebook.net/D46785
2015-09-23 23:25:46 +02:00
|
|
|
}
|
2016-03-30 06:25:12 +02:00
|
|
|
auto reverse = rocksdb::LDBCommand::StringToHex(actual);
|
2016-04-12 04:21:00 +02:00
|
|
|
EXPECT_STRCASEEQ(inPair.first.c_str(), reverse.c_str());
|
Remove ldb HexToString method's usage of sscanf
Summary:
Fix hex2String performance issues by removing sscanf dependency.
Also fixed some edge case handling (odd length, bad input).
Test Plan: Created a test file which called old and new implementation, and validated results are the same. I'll paste results in the phabricator diff.
Reviewers: igor, rven, anthony, IslamAbdelRahman, kradhakrishnan, yhchiang, sdong
Reviewed By: sdong
Subscribers: thatsafunnyname, leveldb, dhruba
Differential Revision: https://reviews.facebook.net/D46785
2015-09-23 23:25:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(LdbCmdTest, HexToStringBadInputs) {
|
|
|
|
const vector<string> badInputs = {
|
2016-03-30 06:25:12 +02:00
|
|
|
"0xZZ", "123", "0xx5", "0x111G", "0x123", "Ox12", "0xT", "0x1Q1",
|
Remove ldb HexToString method's usage of sscanf
Summary:
Fix hex2String performance issues by removing sscanf dependency.
Also fixed some edge case handling (odd length, bad input).
Test Plan: Created a test file which called old and new implementation, and validated results are the same. I'll paste results in the phabricator diff.
Reviewers: igor, rven, anthony, IslamAbdelRahman, kradhakrishnan, yhchiang, sdong
Reviewed By: sdong
Subscribers: thatsafunnyname, leveldb, dhruba
Differential Revision: https://reviews.facebook.net/D46785
2015-09-23 23:25:46 +02:00
|
|
|
};
|
|
|
|
for (const auto badInput : badInputs) {
|
|
|
|
try {
|
|
|
|
rocksdb::LDBCommand::HexToString(badInput);
|
|
|
|
std::cerr << "Should fail on bad hex value: " << badInput << "\n";
|
|
|
|
FAIL();
|
|
|
|
} catch (...) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-03 20:11:09 +01:00
|
|
|
TEST_F(LdbCmdTest, MemEnv) {
|
2019-10-09 04:17:39 +02:00
|
|
|
Env* base_env = TryLoadCustomOrDefaultEnv();
|
|
|
|
std::unique_ptr<Env> env(NewMemEnv(base_env));
|
2019-01-03 20:11:09 +01:00
|
|
|
Options opts;
|
|
|
|
opts.env = env.get();
|
|
|
|
opts.create_if_missing = true;
|
|
|
|
|
Introduce a new storage specific Env API (#5761)
Summary:
The current Env API encompasses both storage/file operations, as well as OS related operations. Most of the APIs return a Status, which does not have enough metadata about an error, such as whether its retry-able or not, scope (i.e fault domain) of the error etc., that may be required in order to properly handle a storage error. The file APIs also do not provide enough control over the IO SLA, such as timeout, prioritization, hinting about placement and redundancy etc.
This PR separates out the file/storage APIs from Env into a new FileSystem class. The APIs are updated to return an IOStatus with metadata about the error, as well as to take an IOOptions structure as input in order to allow more control over the IO.
The user can set both ```options.env``` and ```options.file_system``` to specify that RocksDB should use the former for OS related operations and the latter for storage operations. Internally, a ```CompositeEnvWrapper``` has been introduced that inherits from ```Env``` and redirects individual methods to either an ```Env``` implementation or the ```FileSystem``` as appropriate. When options are sanitized during ```DB::Open```, ```options.env``` is replaced with a newly allocated ```CompositeEnvWrapper``` instance if both env and file_system have been specified. This way, the rest of the RocksDB code can continue to function as before.
This PR also ports PosixEnv to the new API by splitting it into two - PosixEnv and PosixFileSystem. PosixEnv is defined as a sub-class of CompositeEnvWrapper, and threading/time functions are overridden with Posix specific implementations in order to avoid an extra level of indirection.
The ```CompositeEnvWrapper``` translates ```IOStatus``` return code to ```Status```, and sets the severity to ```kSoftError``` if the io_status is retryable. The error handling code in RocksDB can then recover the DB automatically.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5761
Differential Revision: D18868376
Pulled By: anand1976
fbshipit-source-id: 39efe18a162ea746fabac6360ff529baba48486f
2019-12-13 23:47:08 +01:00
|
|
|
opts.file_system.reset(new LegacyFileSystemWrapper(opts.env));
|
|
|
|
|
2019-01-03 20:11:09 +01:00
|
|
|
DB* db = nullptr;
|
|
|
|
std::string dbname = test::TmpDir();
|
|
|
|
ASSERT_OK(DB::Open(opts, dbname, &db));
|
|
|
|
|
|
|
|
WriteOptions wopts;
|
|
|
|
for (int i = 0; i < 100; i++) {
|
|
|
|
char buf[16];
|
|
|
|
snprintf(buf, sizeof(buf), "%08d", i);
|
|
|
|
ASSERT_OK(db->Put(wopts, buf, buf));
|
|
|
|
}
|
|
|
|
FlushOptions fopts;
|
|
|
|
fopts.wait = true;
|
|
|
|
ASSERT_OK(db->Flush(fopts));
|
|
|
|
|
|
|
|
delete db;
|
|
|
|
|
|
|
|
char arg1[] = "./ldb";
|
|
|
|
char arg2[1024];
|
|
|
|
snprintf(arg2, sizeof(arg2), "--db=%s", dbname.c_str());
|
|
|
|
char arg3[] = "dump_live_files";
|
|
|
|
char* argv[] = {arg1, arg2, arg3};
|
|
|
|
|
2019-08-16 01:59:42 +02:00
|
|
|
ASSERT_EQ(0,
|
|
|
|
LDBCommandRunner::RunCommand(3, argv, opts, LDBOptions(), nullptr));
|
2019-01-03 20:11:09 +01:00
|
|
|
}
|
|
|
|
|
2019-03-25 21:19:25 +01:00
|
|
|
TEST_F(LdbCmdTest, OptionParsing) {
|
|
|
|
// test parsing flags
|
2019-10-09 04:17:39 +02:00
|
|
|
Options opts;
|
|
|
|
opts.env = TryLoadCustomOrDefaultEnv();
|
2019-03-25 21:19:25 +01:00
|
|
|
{
|
|
|
|
std::vector<std::string> args;
|
|
|
|
args.push_back("scan");
|
|
|
|
args.push_back("--ttl");
|
|
|
|
args.push_back("--timestamp");
|
|
|
|
LDBCommand* command = rocksdb::LDBCommand::InitFromCmdLineArgs(
|
2019-10-09 04:17:39 +02:00
|
|
|
args, opts, LDBOptions(), nullptr);
|
2019-03-25 21:19:25 +01:00
|
|
|
const std::vector<std::string> flags = command->TEST_GetFlags();
|
|
|
|
EXPECT_EQ(flags.size(), 2);
|
|
|
|
EXPECT_EQ(flags[0], "ttl");
|
|
|
|
EXPECT_EQ(flags[1], "timestamp");
|
|
|
|
delete command;
|
|
|
|
}
|
|
|
|
// test parsing options which contains equal sign in the option value
|
|
|
|
{
|
|
|
|
std::vector<std::string> args;
|
|
|
|
args.push_back("scan");
|
|
|
|
args.push_back("--db=/dev/shm/ldbtest/");
|
|
|
|
args.push_back(
|
|
|
|
"--from='abcd/efg/hijk/lmn/"
|
|
|
|
"opq:__rst.uvw.xyz?a=3+4+bcd+efghi&jk=lm_no&pq=rst-0&uv=wx-8&yz=a&bcd_"
|
|
|
|
"ef=gh.ijk'");
|
|
|
|
LDBCommand* command = rocksdb::LDBCommand::InitFromCmdLineArgs(
|
2019-10-09 04:17:39 +02:00
|
|
|
args, opts, LDBOptions(), nullptr);
|
2019-03-25 21:19:25 +01:00
|
|
|
const std::map<std::string, std::string> option_map =
|
|
|
|
command->TEST_GetOptionMap();
|
|
|
|
EXPECT_EQ(option_map.at("db"), "/dev/shm/ldbtest/");
|
|
|
|
EXPECT_EQ(option_map.at("from"),
|
|
|
|
"'abcd/efg/hijk/lmn/"
|
|
|
|
"opq:__rst.uvw.xyz?a=3+4+bcd+efghi&jk=lm_no&pq=rst-0&uv=wx-8&yz="
|
|
|
|
"a&bcd_ef=gh.ijk'");
|
|
|
|
delete command;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-16 01:59:42 +02:00
|
|
|
TEST_F(LdbCmdTest, ListFileTombstone) {
|
2019-10-09 04:17:39 +02:00
|
|
|
Env* base_env = TryLoadCustomOrDefaultEnv();
|
|
|
|
std::unique_ptr<Env> env(NewMemEnv(base_env));
|
2019-08-16 01:59:42 +02:00
|
|
|
Options opts;
|
|
|
|
opts.env = env.get();
|
|
|
|
opts.create_if_missing = true;
|
|
|
|
|
|
|
|
DB* db = nullptr;
|
|
|
|
std::string dbname = test::TmpDir();
|
|
|
|
ASSERT_OK(DB::Open(opts, dbname, &db));
|
|
|
|
|
|
|
|
WriteOptions wopts;
|
|
|
|
ASSERT_OK(db->Put(wopts, "foo", "1"));
|
|
|
|
ASSERT_OK(db->Put(wopts, "bar", "2"));
|
|
|
|
|
|
|
|
FlushOptions fopts;
|
|
|
|
fopts.wait = true;
|
|
|
|
ASSERT_OK(db->Flush(fopts));
|
|
|
|
|
|
|
|
ASSERT_OK(db->DeleteRange(wopts, db->DefaultColumnFamily(), "foo", "foo2"));
|
|
|
|
ASSERT_OK(db->DeleteRange(wopts, db->DefaultColumnFamily(), "bar", "foo2"));
|
|
|
|
ASSERT_OK(db->Flush(fopts));
|
|
|
|
|
|
|
|
delete db;
|
|
|
|
|
|
|
|
{
|
|
|
|
char arg1[] = "./ldb";
|
|
|
|
char arg2[1024];
|
|
|
|
snprintf(arg2, sizeof(arg2), "--db=%s", dbname.c_str());
|
|
|
|
char arg3[] = "list_file_range_deletes";
|
|
|
|
char* argv[] = {arg1, arg2, arg3};
|
|
|
|
|
|
|
|
rocksdb::SyncPoint::GetInstance()->SetCallBack(
|
|
|
|
"ListFileRangeDeletesCommand::DoCommand:BeforePrint", [&](void* arg) {
|
|
|
|
std::string* out_str = reinterpret_cast<std::string*>(arg);
|
|
|
|
|
|
|
|
// Count number of tombstones printed
|
|
|
|
int num_tb = 0;
|
|
|
|
const std::string kFingerprintStr = "start: ";
|
|
|
|
auto offset = out_str->find(kFingerprintStr);
|
|
|
|
while (offset != std::string::npos) {
|
|
|
|
num_tb++;
|
|
|
|
offset =
|
|
|
|
out_str->find(kFingerprintStr, offset + kFingerprintStr.size());
|
|
|
|
}
|
|
|
|
EXPECT_EQ(2, num_tb);
|
|
|
|
});
|
|
|
|
rocksdb::SyncPoint::GetInstance()->EnableProcessing();
|
|
|
|
|
|
|
|
ASSERT_EQ(
|
|
|
|
0, LDBCommandRunner::RunCommand(3, argv, opts, LDBOptions(), nullptr));
|
|
|
|
|
|
|
|
rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks();
|
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test the case of limiting tombstones
|
|
|
|
{
|
|
|
|
char arg1[] = "./ldb";
|
|
|
|
char arg2[1024];
|
|
|
|
snprintf(arg2, sizeof(arg2), "--db=%s", dbname.c_str());
|
|
|
|
char arg3[] = "list_file_range_deletes";
|
|
|
|
char arg4[] = "--max_keys=1";
|
|
|
|
char* argv[] = {arg1, arg2, arg3, arg4};
|
|
|
|
|
|
|
|
rocksdb::SyncPoint::GetInstance()->SetCallBack(
|
|
|
|
"ListFileRangeDeletesCommand::DoCommand:BeforePrint", [&](void* arg) {
|
|
|
|
std::string* out_str = reinterpret_cast<std::string*>(arg);
|
|
|
|
|
|
|
|
// Count number of tombstones printed
|
|
|
|
int num_tb = 0;
|
|
|
|
const std::string kFingerprintStr = "start: ";
|
|
|
|
auto offset = out_str->find(kFingerprintStr);
|
|
|
|
while (offset != std::string::npos) {
|
|
|
|
num_tb++;
|
|
|
|
offset =
|
|
|
|
out_str->find(kFingerprintStr, offset + kFingerprintStr.size());
|
|
|
|
}
|
|
|
|
EXPECT_EQ(1, num_tb);
|
|
|
|
});
|
|
|
|
rocksdb::SyncPoint::GetInstance()->EnableProcessing();
|
|
|
|
|
|
|
|
ASSERT_EQ(
|
|
|
|
0, LDBCommandRunner::RunCommand(4, argv, opts, LDBOptions(), nullptr));
|
|
|
|
|
|
|
|
rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks();
|
|
|
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing();
|
|
|
|
}
|
|
|
|
}
|
2019-01-03 20:11:09 +01:00
|
|
|
} // namespace rocksdb
|
|
|
|
|
2019-10-09 04:17:39 +02:00
|
|
|
#ifdef ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
|
|
extern "C" {
|
|
|
|
void RegisterCustomObjects(int argc, char** argv);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
void RegisterCustomObjects(int /*argc*/, char** /*argv*/) {}
|
|
|
|
#endif // !ROCKSDB_UNITTESTS_WITH_CUSTOM_OBJECTS_FROM_STATIC_LIBS
|
|
|
|
|
Remove ldb HexToString method's usage of sscanf
Summary:
Fix hex2String performance issues by removing sscanf dependency.
Also fixed some edge case handling (odd length, bad input).
Test Plan: Created a test file which called old and new implementation, and validated results are the same. I'll paste results in the phabricator diff.
Reviewers: igor, rven, anthony, IslamAbdelRahman, kradhakrishnan, yhchiang, sdong
Reviewed By: sdong
Subscribers: thatsafunnyname, leveldb, dhruba
Differential Revision: https://reviews.facebook.net/D46785
2015-09-23 23:25:46 +02:00
|
|
|
int main(int argc, char** argv) {
|
2019-10-09 04:17:39 +02:00
|
|
|
rocksdb::port::InstallStackTraceHandler();
|
Remove ldb HexToString method's usage of sscanf
Summary:
Fix hex2String performance issues by removing sscanf dependency.
Also fixed some edge case handling (odd length, bad input).
Test Plan: Created a test file which called old and new implementation, and validated results are the same. I'll paste results in the phabricator diff.
Reviewers: igor, rven, anthony, IslamAbdelRahman, kradhakrishnan, yhchiang, sdong
Reviewed By: sdong
Subscribers: thatsafunnyname, leveldb, dhruba
Differential Revision: https://reviews.facebook.net/D46785
2015-09-23 23:25:46 +02:00
|
|
|
::testing::InitGoogleTest(&argc, argv);
|
2019-10-09 04:17:39 +02:00
|
|
|
RegisterCustomObjects(argc, argv);
|
Remove ldb HexToString method's usage of sscanf
Summary:
Fix hex2String performance issues by removing sscanf dependency.
Also fixed some edge case handling (odd length, bad input).
Test Plan: Created a test file which called old and new implementation, and validated results are the same. I'll paste results in the phabricator diff.
Reviewers: igor, rven, anthony, IslamAbdelRahman, kradhakrishnan, yhchiang, sdong
Reviewed By: sdong
Subscribers: thatsafunnyname, leveldb, dhruba
Differential Revision: https://reviews.facebook.net/D46785
2015-09-23 23:25:46 +02:00
|
|
|
return RUN_ALL_TESTS();
|
|
|
|
}
|
2015-10-15 19:51:00 +02:00
|
|
|
#else
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2018-04-16 02:19:57 +02:00
|
|
|
int main(int /*argc*/, char** /*argv*/) {
|
2015-10-15 19:51:00 +02:00
|
|
|
fprintf(stderr, "SKIPPED as LDBCommand is not supported in ROCKSDB_LITE\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // ROCKSDB_LITE
|