PragmaTwice commented on code in PR #2332:
URL: https://github.com/apache/kvrocks/pull/2332#discussion_r1670614710


##########
src/storage/storage.cc:
##########
@@ -604,16 +610,19 @@ rocksdb::Status Storage::Get(const rocksdb::ReadOptions 
&options, rocksdb::Colum
   return s;
 }
 
-rocksdb::Status Storage::Get(const rocksdb::ReadOptions &options, const 
rocksdb::Slice &key,
+rocksdb::Status Storage::Get(engine::Context &ctx, const rocksdb::ReadOptions 
&options, const rocksdb::Slice &key,
                              rocksdb::PinnableSlice *value) {
-  return Get(options, db_->DefaultColumnFamily(), key, value);
+  return Get(ctx, options, db_->DefaultColumnFamily(), key, value);
 }
 
-rocksdb::Status Storage::Get(const rocksdb::ReadOptions &options, 
rocksdb::ColumnFamilyHandle *column_family,
-                             const rocksdb::Slice &key, rocksdb::PinnableSlice 
*value) {
+rocksdb::Status Storage::Get(engine::Context &ctx, const rocksdb::ReadOptions 
&options,
+                             rocksdb::ColumnFamilyHandle *column_family, const 
rocksdb::Slice &key,
+                             rocksdb::PinnableSlice *value) {
   rocksdb::Status s;
   if (is_txn_mode_ && txn_write_batch_->GetWriteBatch()->Count() > 0) {
     s = txn_write_batch_->GetFromBatchAndDB(db_.get(), options, column_family, 
key, value);
+  } else if (ctx.batch) {
+    s = ctx.batch->GetFromBatchAndDB(db_.get(), options, column_family, key, 
value);
   } else {
     s = db_->Get(options, column_family, key, value);
   }

Review Comment:
   > Many APIs originally had the ReadOptions parameter. Adding another Context 
parameter might overlap with ReadOptions in functionality, so consider whether 
these two parameters should be merged. For example, it might be necessary to 
use both the batch of Context and the complete ReadOptions settings (not just 
Snapshot). In order to understand everyone's thoughts, I have not modified it 
directly. If you think it should be merged, please provide suggestions.
   
   Sorry I've checked your note now.
   
   I think it's better to merge these two parameter.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to