@@ -64,8 +64,7 @@ Status RedisHashes::Open(const StorageOptions& storage_options, const std::strin
6464 column_families.emplace_back (rocksdb::kDefaultColumnFamilyName , meta_cf_ops);
6565 // Data CF
6666 column_families.emplace_back (" data_cf" , data_cf_ops);
67- s = rocksdb::DB::Open (db_ops, db_path, column_families, &handles_, &db_);
68- return s;
67+ return rocksdb::DB::Open (db_ops, db_path, column_families, &handles_, &db_);
6968}
7069
7170Status RedisHashes::CompactRange (const rocksdb::Slice* begin, const rocksdb::Slice* end, const ColumnFamilyType& type) {
@@ -424,8 +423,8 @@ Status RedisHashes::HIncrby(const Slice& key, const Slice& field, int64_t value,
424423 UpdateSpecificKeyStatistics (key.ToString (), statistic);
425424 if (s.ok ()) {
426425 int32_t current_count = 1 ;
427- s = db_-> Get (default_read_options_, handles_[ 0 ], key, &meta_value);
428- if (s. ok () ) {
426+
427+ if (meta_value. size () > 0 ) {
429428 ParsedHashesMetaValue parsed_hashes_meta_value (&meta_value);
430429 current_count = parsed_hashes_meta_value.count ();
431430 }
@@ -507,8 +506,7 @@ Status RedisHashes::HIncrbyfloat(const Slice& key, const Slice& field, const Sli
507506 UpdateSpecificKeyStatistics (key.ToString (), statistic);
508507 if (s.ok ()) {
509508 int32_t current_count = 1 ;
510- s = db_->Get (default_read_options_, handles_[0 ], key, &meta_value);
511- if (s.ok ()) {
509+ if (meta_value.size () > 0 ) {
512510 ParsedHashesMetaValue parsed_hashes_meta_value (&meta_value);
513511 current_count = parsed_hashes_meta_value.count ();
514512 }
@@ -679,9 +677,8 @@ Status RedisHashes::HMSet(const Slice& key, const std::vector<FieldValue>& fvs)
679677 s = db_->Write (default_write_options_, &batch);
680678 UpdateSpecificKeyStatistics (key.ToString (), statistic);
681679 if (s.ok ()) {
682- int32_t current_count = 1 ;
683- s = db_->Get (default_read_options_, handles_[0 ], key, &meta_value);
684- if (s.ok ()) {
680+ int32_t current_count = 0 ;
681+ if (s.ok () && meta_value.size () > 0 ) {
685682 ParsedHashesMetaValue parsed_hashes_meta_value (&meta_value);
686683 current_count = parsed_hashes_meta_value.count ();
687684 }
@@ -802,8 +799,7 @@ Status RedisHashes::HSetnx(const Slice& key, const Slice& field, const Slice& va
802799 if (s.ok ()) {
803800 int32_t current_count = 1 ;
804801 if (*ret == 0 ) {
805- s = db_->Get (default_read_options_, handles_[0 ], key, &meta_value);
806- if (s.ok ()) {
802+ if (meta_value.size () > 0 ) {
807803 ParsedHashesMetaValue parsed_hashes_meta_value (&meta_value);
808804 current_count = parsed_hashes_meta_value.count ();
809805 }
0 commit comments