]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.cc
import quincy beta 17.1.0
[ceph.git] / ceph / src / rocksdb / utilities / write_batch_with_index / write_batch_with_index_internal.cc
index 8c1222f21621e721f17780e5b261a509688e7df3..de6fc48de09ecc69f17007b7ea65eb599f09291d 100644 (file)
@@ -13,6 +13,7 @@
 #include "rocksdb/comparator.h"
 #include "rocksdb/db.h"
 #include "rocksdb/utilities/write_batch_with_index.h"
+#include "util/cast_util.h"
 #include "util/coding.h"
 #include "util/string_util.h"
 
@@ -44,6 +45,9 @@ Status ReadableWriteBatch::GetEntryFromDataOffset(size_t data_offset,
   uint32_t column_family;
   Status s = ReadRecordFromWriteBatch(&input, &tag, &column_family, Key, value,
                                       blob, xid);
+  if (!s.ok()) {
+    return s;
+  }
 
   switch (tag) {
     case kTypeColumnFamilyValue:
@@ -249,7 +253,8 @@ WriteBatchWithIndexInternal::Result WriteBatchWithIndexInternal::GetFromBatch(
         const MergeOperator* merge_operator;
 
         if (column_family != nullptr) {
-          auto cfh = reinterpret_cast<ColumnFamilyHandleImpl*>(column_family);
+          auto cfh =
+              static_cast_with_check<ColumnFamilyHandleImpl>(column_family);
           merge_operator = cfh->cfd()->ioptions()->merge_operator;
         } else {
           *s = Status::InvalidArgument("Must provide a column_family");