@ -122,7 +122,7 @@ void DumpSstFile(Options options, std::string filename, bool output_hex,
void DumpBlobFile ( const std : : string & filename , bool is_key_hex ,
void DumpBlobFile ( const std : : string & filename , bool is_key_hex ,
bool is_value_hex , bool dump_uncompressed_blobs ) ;
bool is_value_hex , bool dump_uncompressed_blobs ) ;
} ;
} ; // namespace
LDBCommand * LDBCommand : : InitFromCmdLineArgs (
LDBCommand * LDBCommand : : InitFromCmdLineArgs (
int argc , char const * const * argv , const Options & options ,
int argc , char const * const * argv , const Options & options ,
@ -165,7 +165,7 @@ LDBCommand* LDBCommand::InitFromCmdLineArgs(
const std : : string OPTION_PREFIX = " -- " ;
const std : : string OPTION_PREFIX = " -- " ;
for ( const auto & arg : args ) {
for ( const auto & arg : args ) {
if ( arg [ 0 ] = = ' - ' & & arg [ 1 ] = = ' - ' ) {
if ( arg [ 0 ] = = ' - ' & & arg [ 1 ] = = ' - ' ) {
std : : vector < std : : string > splits = StringSplit ( arg , ' = ' ) ;
std : : vector < std : : string > splits = StringSplit ( arg , ' = ' ) ;
// --option_name=option_value
// --option_name=option_value
if ( splits . size ( ) = = 2 ) {
if ( splits . size ( ) = = 2 ) {
@ -295,8 +295,7 @@ LDBCommand* LDBCommand::SelectCommand(const ParsedParams& parsed_params) {
parsed_params . flags ) ;
parsed_params . flags ) ;
} else if ( parsed_params . cmd = = CheckPointCommand : : Name ( ) ) {
} else if ( parsed_params . cmd = = CheckPointCommand : : Name ( ) ) {
return new CheckPointCommand ( parsed_params . cmd_params ,
return new CheckPointCommand ( parsed_params . cmd_params ,
parsed_params . option_map ,
parsed_params . option_map , parsed_params . flags ) ;
parsed_params . flags ) ;
} else if ( parsed_params . cmd = = RepairCommand : : Name ( ) ) {
} else if ( parsed_params . cmd = = RepairCommand : : Name ( ) ) {
return new RepairCommand ( parsed_params . cmd_params , parsed_params . option_map ,
return new RepairCommand ( parsed_params . cmd_params , parsed_params . option_map ,
parsed_params . flags ) ;
parsed_params . flags ) ;
@ -884,7 +883,7 @@ void LDBCommand::OverrideBaseCFOptions(ColumnFamilyOptions* cf_opts) {
int write_buffer_size ;
int write_buffer_size ;
if ( ParseIntOption ( option_map_ , ARG_WRITE_BUFFER_SIZE , write_buffer_size ,
if ( ParseIntOption ( option_map_ , ARG_WRITE_BUFFER_SIZE , write_buffer_size ,
exec_state_ ) ) {
exec_state_ ) ) {
if ( write_buffer_size > 0 ) {
if ( write_buffer_size > 0 ) {
cf_opts - > write_buffer_size = write_buffer_size ;
cf_opts - > write_buffer_size = write_buffer_size ;
} else {
} else {
@ -1284,7 +1283,7 @@ void DBLoaderCommand::DoCommand() {
} else if ( 0 = = line . find ( " Created bg thread 0x " ) ) {
} else if ( 0 = = line . find ( " Created bg thread 0x " ) ) {
// ignore this line
// ignore this line
} else {
} else {
bad_lines + + ;
bad_lines + + ;
}
}
}
}
@ -1373,7 +1372,6 @@ ManifestDumpCommand::ManifestDumpCommand(
}
}
void ManifestDumpCommand : : DoCommand ( ) {
void ManifestDumpCommand : : DoCommand ( ) {
std : : string manifestfile ;
std : : string manifestfile ;
if ( ! path_ . empty ( ) ) {
if ( ! path_ . empty ( ) ) {
@ -1730,7 +1728,7 @@ void IncBucketCounts(std::vector<uint64_t>& bucket_counts, int ttl_start,
( void ) num_buckets ;
( void ) num_buckets ;
# endif
# endif
assert ( time_range > 0 & & timekv > = ttl_start & & bucket_size > 0 & &
assert ( time_range > 0 & & timekv > = ttl_start & & bucket_size > 0 & &
timekv < ( ttl_start + time_range ) & & num_buckets > 1 ) ;
timekv < ( ttl_start + time_range ) & & num_buckets > 1 ) ;
int bucket = ( timekv - ttl_start ) / bucket_size ;
int bucket = ( timekv - ttl_start ) / bucket_size ;
bucket_counts [ bucket ] + + ;
bucket_counts [ bucket ] + + ;
}
}
@ -1739,7 +1737,7 @@ void PrintBucketCounts(const std::vector<uint64_t>& bucket_counts,
int ttl_start , int ttl_end , int bucket_size ,
int ttl_start , int ttl_end , int bucket_size ,
int num_buckets ) {
int num_buckets ) {
int time_point = ttl_start ;
int time_point = ttl_start ;
for ( int i = 0 ; i < num_buckets - 1 ; i + + , time_point + = bucket_size ) {
for ( int i = 0 ; i < num_buckets - 1 ; i + + , time_point + = bucket_size ) {
fprintf ( stdout , " Keys in range %s to %s : %lu \n " ,
fprintf ( stdout , " Keys in range %s to %s : %lu \n " ,
TimeToHumanString ( time_point ) . c_str ( ) ,
TimeToHumanString ( time_point ) . c_str ( ) ,
TimeToHumanString ( time_point + bucket_size ) . c_str ( ) ,
TimeToHumanString ( time_point + bucket_size ) . c_str ( ) ,
@ -1784,10 +1782,10 @@ InternalDumpCommand::InternalDumpCommand(
if ( itr ! = options . end ( ) ) {
if ( itr ! = options . end ( ) ) {
delim_ = itr - > second ;
delim_ = itr - > second ;
count_delim_ = true ;
count_delim_ = true ;
// fprintf(stdout,"delim = %c\n",delim_[0]);
// fprintf(stdout,"delim = %c\n",delim_[0]);
} else {
} else {
count_delim_ = IsFlagPresent ( flags , ARG_COUNT_DELIM ) ;
count_delim_ = IsFlagPresent ( flags , ARG_COUNT_DELIM ) ;
delim_ = " . " ;
delim_ = " . " ;
}
}
print_stats_ = IsFlagPresent ( flags , ARG_STATS ) ;
print_stats_ = IsFlagPresent ( flags , ARG_STATS ) ;
@ -1841,8 +1839,8 @@ void InternalDumpCommand::DoCommand() {
}
}
std : : string rtype1 , rtype2 , row , val ;
std : : string rtype1 , rtype2 , row , val ;
rtype2 = " " ;
rtype2 = " " ;
uint64_t c = 0 ;
uint64_t c = 0 ;
uint64_t s1 = 0 , s2 = 0 ;
uint64_t s1 = 0 , s2 = 0 ;
long long count = 0 ;
long long count = 0 ;
for ( auto & key_version : key_versions ) {
for ( auto & key_version : key_versions ) {
@ -1857,25 +1855,24 @@ void InternalDumpCommand::DoCommand() {
int k ;
int k ;
if ( count_delim_ ) {
if ( count_delim_ ) {
rtype1 = " " ;
rtype1 = " " ;
s1 = 0 ;
s1 = 0 ;
row = ikey . Encode ( ) . ToString ( ) ;
row = ikey . Encode ( ) . ToString ( ) ;
val = key_version . value ;
val = key_version . value ;
for ( k = 0 ; row [ k ] ! = ' \x01 ' & & row [ k ] ! = ' \0 ' ; k + + )
for ( k = 0 ; row [ k ] ! = ' \x01 ' & & row [ k ] ! = ' \0 ' ; k + + ) s1 + + ;
s1 + + ;
for ( k = 0 ; val [ k ] ! = ' \x01 ' & & val [ k ] ! = ' \0 ' ; k + + ) s1 + + ;
for ( k = 0 ; val [ k ] ! = ' \x01 ' & & val [ k ] ! = ' \0 ' ; k + + )
for ( int j = 0 ; row [ j ] ! = delim_ [ 0 ] & & row [ j ] ! = ' \0 ' & & row [ j ] ! = ' \x01 ' ;
s1 + + ;
j + + )
for ( int j = 0 ; row [ j ] ! = delim_ [ 0 ] & & row [ j ] ! = ' \0 ' & & row [ j ] ! = ' \x01 ' ; j + + )
rtype1 + = row [ j ] ;
rtype1 + = row [ j ] ;
if ( rtype2 . compare ( " " ) & & rtype2 . compare ( rtype1 ) ! = 0 ) {
if ( rtype2 . compare ( " " ) & & rtype2 . compare ( rtype1 ) ! = 0 ) {
fprintf ( stdout , " %s => count:% " PRIu64 " \t size:% " PRIu64 " \n " ,
fprintf ( stdout , " %s => count:% " PRIu64 " \t size:% " PRIu64 " \n " ,
rtype2 . c_str ( ) , c , s2 ) ;
rtype2 . c_str ( ) , c , s2 ) ;
c = 1 ;
c = 1 ;
s2 = s1 ;
s2 = s1 ;
rtype2 = rtype1 ;
rtype2 = rtype1 ;
} else {
} else {
c + + ;
c + + ;
s2 + = s1 ;
s2 + = s1 ;
rtype2 = rtype1 ;
rtype2 = rtype1 ;
}
}
}
}
@ -1901,7 +1898,7 @@ void InternalDumpCommand::DoCommand() {
// Terminate if maximum number of keys have been dumped
// Terminate if maximum number of keys have been dumped
if ( max_keys_ > 0 & & count > = max_keys_ ) break ;
if ( max_keys_ > 0 & & count > = max_keys_ ) break ;
}
}
if ( count_delim_ ) {
if ( count_delim_ ) {
fprintf ( stdout , " %s => count:% " PRIu64 " \t size:% " PRIu64 " \n " ,
fprintf ( stdout , " %s => count:% " PRIu64 " \t size:% " PRIu64 " \n " ,
rtype2 . c_str ( ) , c , s2 ) ;
rtype2 . c_str ( ) , c , s2 ) ;
} else {
} else {
@ -1966,7 +1963,7 @@ DBDumperCommand::DBDumperCommand(
count_delim_ = true ;
count_delim_ = true ;
} else {
} else {
count_delim_ = IsFlagPresent ( flags , ARG_COUNT_DELIM ) ;
count_delim_ = IsFlagPresent ( flags , ARG_COUNT_DELIM ) ;
delim_ = " . " ;
delim_ = " . " ;
}
}
print_stats_ = IsFlagPresent ( flags , ARG_STATS ) ;
print_stats_ = IsFlagPresent ( flags , ARG_STATS ) ;
@ -2114,13 +2111,13 @@ void DBDumperCommand::DoDumpCommand() {
int bucket_size ;
int bucket_size ;
if ( ! ParseIntOption ( option_map_ , ARG_TTL_BUCKET , bucket_size , exec_state_ ) | |
if ( ! ParseIntOption ( option_map_ , ARG_TTL_BUCKET , bucket_size , exec_state_ ) | |
bucket_size < = 0 ) {
bucket_size < = 0 ) {
bucket_size = time_range ; // Will have just 1 bucket by default
bucket_size = time_range ; // Will have just 1 bucket by default
}
}
//cretaing variables for row count of each type
// cretaing variables for row count of each type
std : : string rtype1 , rtype2 , row , val ;
std : : string rtype1 , rtype2 , row , val ;
rtype2 = " " ;
rtype2 = " " ;
uint64_t c = 0 ;
uint64_t c = 0 ;
uint64_t s1 = 0 , s2 = 0 ;
uint64_t s1 = 0 , s2 = 0 ;
// At this point, bucket_size=0 => time_range=0
// At this point, bucket_size=0 => time_range=0
int num_buckets = ( bucket_size > = time_range )
int num_buckets = ( bucket_size > = time_range )
@ -2138,11 +2135,9 @@ void DBDumperCommand::DoDumpCommand() {
for ( ; iter - > Valid ( ) ; iter - > Next ( ) ) {
for ( ; iter - > Valid ( ) ; iter - > Next ( ) ) {
int rawtime = 0 ;
int rawtime = 0 ;
// If end marker was specified, we stop before it
// If end marker was specified, we stop before it
if ( ! null_to_ & & ( iter - > key ( ) . ToString ( ) > = to_ ) )
if ( ! null_to_ & & ( iter - > key ( ) . ToString ( ) > = to_ ) ) break ;
break ;
// Terminate if maximum number of keys have been dumped
// Terminate if maximum number of keys have been dumped
if ( max_keys = = 0 )
if ( max_keys = = 0 ) break ;
break ;
if ( is_db_ttl_ ) {
if ( is_db_ttl_ ) {
TtlIterator * it_ttl = static_cast_with_check < TtlIterator > ( iter ) ;
TtlIterator * it_ttl = static_cast_with_check < TtlIterator > ( iter ) ;
rawtime = it_ttl - > ttl_timestamp ( ) ;
rawtime = it_ttl - > ttl_timestamp ( ) ;
@ -2162,21 +2157,20 @@ void DBDumperCommand::DoDumpCommand() {
rtype1 = " " ;
rtype1 = " " ;
row = iter - > key ( ) . ToString ( ) ;
row = iter - > key ( ) . ToString ( ) ;
val = iter - > value ( ) . ToString ( ) ;
val = iter - > value ( ) . ToString ( ) ;
s1 = row . size ( ) + val . size ( ) ;
s1 = row . size ( ) + val . size ( ) ;
for ( int j = 0 ; row [ j ] ! = delim_ [ 0 ] & & row [ j ] ! = ' \0 ' ; j + + )
for ( int j = 0 ; row [ j ] ! = delim_ [ 0 ] & & row [ j ] ! = ' \0 ' ; j + + )
rtype1 + = row [ j ] ;
rtype1 + = row [ j ] ;
if ( rtype2 . compare ( " " ) & & rtype2 . compare ( rtype1 ) ! = 0 ) {
if ( rtype2 . compare ( " " ) & & rtype2 . compare ( rtype1 ) ! = 0 ) {
fprintf ( stdout , " %s => count:% " PRIu64 " \t size:% " PRIu64 " \n " ,
fprintf ( stdout , " %s => count:% " PRIu64 " \t size:% " PRIu64 " \n " ,
rtype2 . c_str ( ) , c , s2 ) ;
rtype2 . c_str ( ) , c , s2 ) ;
c = 1 ;
c = 1 ;
s2 = s1 ;
s2 = s1 ;
rtype2 = rtype1 ;
rtype2 = rtype1 ;
} else {
} else {
c + + ;
c + + ;
s2 + = s1 ;
s2 + = s1 ;
rtype2 = rtype1 ;
rtype2 = rtype1 ;
}
}
}
}
if ( count_only_ ) {
if ( count_only_ ) {
@ -2197,7 +2191,7 @@ void DBDumperCommand::DoDumpCommand() {
if ( num_buckets > 1 & & is_db_ttl_ ) {
if ( num_buckets > 1 & & is_db_ttl_ ) {
PrintBucketCounts ( bucket_counts , ttl_start , ttl_end , bucket_size ,
PrintBucketCounts ( bucket_counts , ttl_start , ttl_end , bucket_size ,
num_buckets ) ;
num_buckets ) ;
} else if ( count_delim_ ) {
} else if ( count_delim_ ) {
fprintf ( stdout , " %s => count:% " PRIu64 " \t size:% " PRIu64 " \n " ,
fprintf ( stdout , " %s => count:% " PRIu64 " \t size:% " PRIu64 " \n " ,
rtype2 . c_str ( ) , c , s2 ) ;
rtype2 . c_str ( ) , c , s2 ) ;
} else {
} else {
@ -2228,7 +2222,7 @@ ReduceDBLevelsCommand::ReduceDBLevelsCommand(
ParseIntOption ( option_map_ , ARG_NEW_LEVELS , new_levels_ , exec_state_ ) ;
ParseIntOption ( option_map_ , ARG_NEW_LEVELS , new_levels_ , exec_state_ ) ;
print_old_levels_ = IsFlagPresent ( flags , ARG_PRINT_OLD_LEVELS ) ;
print_old_levels_ = IsFlagPresent ( flags , ARG_PRINT_OLD_LEVELS ) ;
if ( new_levels_ < = 0 ) {
if ( new_levels_ < = 0 ) {
exec_state_ = LDBCommandExecuteResult : : Failed (
exec_state_ = LDBCommandExecuteResult : : Failed (
" Use -- " + ARG_NEW_LEVELS + " to specify a new level number \n " ) ;
" Use -- " + ARG_NEW_LEVELS + " to specify a new level number \n " ) ;
}
}
@ -2240,7 +2234,7 @@ std::vector<std::string> ReduceDBLevelsCommand::PrepareArgs(
ret . push_back ( " reduce_levels " ) ;
ret . push_back ( " reduce_levels " ) ;
ret . push_back ( " -- " + ARG_DB + " = " + db_path ) ;
ret . push_back ( " -- " + ARG_DB + " = " + db_path ) ;
ret . push_back ( " -- " + ARG_NEW_LEVELS + " = " + std : : to_string ( new_levels ) ) ;
ret . push_back ( " -- " + ARG_NEW_LEVELS + " = " + std : : to_string ( new_levels ) ) ;
if ( print_old_level ) {
if ( print_old_level ) {
ret . push_back ( " -- " + ARG_PRINT_OLD_LEVELS ) ;
ret . push_back ( " -- " + ARG_PRINT_OLD_LEVELS ) ;
}
}
return ret ;
return ret ;
@ -2265,8 +2259,7 @@ void ReduceDBLevelsCommand::OverrideBaseCFOptions(
cf_opts - > max_bytes_for_level_multiplier = 1 ;
cf_opts - > max_bytes_for_level_multiplier = 1 ;
}
}
Status ReduceDBLevelsCommand : : GetOldNumOfLevels ( Options & opt ,
Status ReduceDBLevelsCommand : : GetOldNumOfLevels ( Options & opt , int * levels ) {
int * levels ) {
ImmutableDBOptions db_options ( opt ) ;
ImmutableDBOptions db_options ( opt ) ;
EnvOptions soptions ;
EnvOptions soptions ;
std : : shared_ptr < Cache > tc (
std : : shared_ptr < Cache > tc (
@ -2364,9 +2357,9 @@ ChangeCompactionStyleCommand::ChangeCompactionStyleCommand(
old_compaction_style_ ( - 1 ) ,
old_compaction_style_ ( - 1 ) ,
new_compaction_style_ ( - 1 ) {
new_compaction_style_ ( - 1 ) {
ParseIntOption ( option_map_ , ARG_OLD_COMPACTION_STYLE , old_compaction_style_ ,
ParseIntOption ( option_map_ , ARG_OLD_COMPACTION_STYLE , old_compaction_style_ ,
exec_state_ ) ;
exec_state_ ) ;
if ( old_compaction_style_ ! = kCompactionStyleLevel & &
if ( old_compaction_style_ ! = kCompactionStyleLevel & &
old_compaction_style_ ! = kCompactionStyleUniversal ) {
old_compaction_style_ ! = kCompactionStyleUniversal ) {
exec_state_ = LDBCommandExecuteResult : : Failed (
exec_state_ = LDBCommandExecuteResult : : Failed (
" Use -- " + ARG_OLD_COMPACTION_STYLE + " to specify old compaction " +
" Use -- " + ARG_OLD_COMPACTION_STYLE + " to specify old compaction " +
" style. Check ldb help for proper compaction style value. \n " ) ;
" style. Check ldb help for proper compaction style value. \n " ) ;
@ -2374,9 +2367,9 @@ ChangeCompactionStyleCommand::ChangeCompactionStyleCommand(
}
}
ParseIntOption ( option_map_ , ARG_NEW_COMPACTION_STYLE , new_compaction_style_ ,
ParseIntOption ( option_map_ , ARG_NEW_COMPACTION_STYLE , new_compaction_style_ ,
exec_state_ ) ;
exec_state_ ) ;
if ( new_compaction_style_ ! = kCompactionStyleLevel & &
if ( new_compaction_style_ ! = kCompactionStyleLevel & &
new_compaction_style_ ! = kCompactionStyleUniversal ) {
new_compaction_style_ ! = kCompactionStyleUniversal ) {
exec_state_ = LDBCommandExecuteResult : : Failed (
exec_state_ = LDBCommandExecuteResult : : Failed (
" Use -- " + ARG_NEW_COMPACTION_STYLE + " to specify new compaction " +
" Use -- " + ARG_NEW_COMPACTION_STYLE + " to specify new compaction " +
" style. Check ldb help for proper compaction style value. \n " ) ;
" style. Check ldb help for proper compaction style value. \n " ) ;
@ -2716,7 +2709,6 @@ WALDumperCommand::WALDumperCommand(
wal_file_ = itr - > second ;
wal_file_ = itr - > second ;
}
}
print_header_ = IsFlagPresent ( flags , ARG_PRINT_HEADER ) ;
print_header_ = IsFlagPresent ( flags , ARG_PRINT_HEADER ) ;
print_values_ = IsFlagPresent ( flags , ARG_PRINT_VALUE ) ;
print_values_ = IsFlagPresent ( flags , ARG_PRINT_VALUE ) ;
is_write_committed_ = ParseBooleanOption ( options , ARG_WRITE_COMMITTED , true ) ;
is_write_committed_ = ParseBooleanOption ( options , ARG_WRITE_COMMITTED , true ) ;
@ -2779,7 +2771,7 @@ void GetCommand::DoCommand() {
Status st = db_ - > Get ( ReadOptions ( ) , GetCfHandle ( ) , key_ , & value ) ;
Status st = db_ - > Get ( ReadOptions ( ) , GetCfHandle ( ) , key_ , & value ) ;
if ( st . ok ( ) ) {
if ( st . ok ( ) ) {
fprintf ( stdout , " %s \n " ,
fprintf ( stdout , " %s \n " ,
( is_value_hex_ ? StringToHex ( value ) : value ) . c_str ( ) ) ;
( is_value_hex_ ? StringToHex ( value ) : value ) . c_str ( ) ) ;
} else {
} else {
std : : stringstream oss ;
std : : stringstream oss ;
oss < < " Get failed: " < < st . ToString ( ) ;
oss < < " Get failed: " < < st . ToString ( ) ;
@ -3017,9 +3009,9 @@ void ScanCommand::DoCommand() {
TimeToHumanString ( ttl_start ) . c_str ( ) ,
TimeToHumanString ( ttl_start ) . c_str ( ) ,
TimeToHumanString ( ttl_end ) . c_str ( ) ) ;
TimeToHumanString ( ttl_end ) . c_str ( ) ) ;
}
}
for ( ;
for ( ;
it - > Valid ( ) & & ( ! end_key_specified_ | | it - > key ( ) . ToString ( ) < end_key_ ) ;
it - > Valid ( ) & & ( ! end_key_specified_ | | it - > key ( ) . ToString ( ) < end_key_ ) ;
it - > Next ( ) ) {
it - > Next ( ) ) {
if ( is_db_ttl_ ) {
if ( is_db_ttl_ ) {
TtlIterator * it_ttl = static_cast_with_check < TtlIterator > ( it ) ;
TtlIterator * it_ttl = static_cast_with_check < TtlIterator > ( it ) ;
int rawtime = it_ttl - > ttl_timestamp ( ) ;
int rawtime = it_ttl - > ttl_timestamp ( ) ;
@ -3253,8 +3245,9 @@ void DBQuerierCommand::Help(std::string& ret) {
ret . append ( DBQuerierCommand : : Name ( ) ) ;
ret . append ( DBQuerierCommand : : Name ( ) ) ;
ret . append ( " [-- " + ARG_TTL + " ] " ) ;
ret . append ( " [-- " + ARG_TTL + " ] " ) ;
ret . append ( " \n " ) ;
ret . append ( " \n " ) ;
ret . append ( " Starts a REPL shell. Type help for list of available "
ret . append (
" commands. " ) ;
" Starts a REPL shell. Type help for list of available "
" commands. " ) ;
ret . append ( " \n " ) ;
ret . append ( " \n " ) ;
}
}
@ -3281,7 +3274,7 @@ void DBQuerierCommand::DoCommand() {
if ( pos2 = = std : : string : : npos ) {
if ( pos2 = = std : : string : : npos ) {
break ;
break ;
}
}
tokens . push_back ( line . substr ( pos , pos2 - pos ) ) ;
tokens . push_back ( line . substr ( pos , pos2 - pos ) ) ;
pos = pos2 + 1 ;
pos = pos2 + 1 ;
}
}
tokens . push_back ( line . substr ( pos ) ) ;
tokens . push_back ( line . substr ( pos ) ) ;
@ -3315,8 +3308,8 @@ void DBQuerierCommand::DoCommand() {
key = ( is_key_hex_ ? HexToString ( tokens [ 1 ] ) : tokens [ 1 ] ) ;
key = ( is_key_hex_ ? HexToString ( tokens [ 1 ] ) : tokens [ 1 ] ) ;
s = db_ - > Get ( read_options , GetCfHandle ( ) , Slice ( key ) , & value ) ;
s = db_ - > Get ( read_options , GetCfHandle ( ) , Slice ( key ) , & value ) ;
if ( s . ok ( ) ) {
if ( s . ok ( ) ) {
fprintf ( stdout , " %s \n " , PrintKeyValue ( key , value ,
fprintf ( stdout , " %s \n " ,
is_key_hex_ , is_value_hex_ ) . c_str ( ) ) ;
PrintKeyValue ( key , value , is_key_hex_ , is_value_hex_ ) . c_str ( ) ) ;
} else {
} else {
if ( s . IsNotFound ( ) ) {
if ( s . IsNotFound ( ) ) {
fprintf ( stdout , " Not found %s \n " , tokens [ 1 ] . c_str ( ) ) ;
fprintf ( stdout , " Not found %s \n " , tokens [ 1 ] . c_str ( ) ) ;