morningman commented on code in PR #12124:
URL: https://github.com/apache/doris/pull/12124#discussion_r956585665


##########
be/src/olap/task/engine_checksum_task.cpp:
##########
@@ -54,71 +55,58 @@ Status EngineChecksumTask::_compute_checksum() {
         return Status::OLAPInternalError(OLAP_ERR_TABLE_NOT_FOUND);
     }
 
-    TupleReader reader;
-    TabletReader::ReaderParams reader_params;
-    reader_params.tablet = tablet;
-    reader_params.reader_type = READER_CHECKSUM;
-    reader_params.version = Version(0, _version);
-
-    {
-        std::shared_lock rdlock(tablet->get_header_lock());
-        const RowsetSharedPtr message = tablet->rowset_with_max_version();
-        if (message == nullptr) {
-            LOG(FATAL) << "fail to get latest version. tablet_id=" << 
_tablet_id;
-            return Status::OLAPInternalError(OLAP_ERR_WRITE_PROTOBUF_ERROR);
-        }
-
-        Status acquire_reader_st =
-                tablet->capture_rs_readers(reader_params.version, 
&reader_params.rs_readers);
-        if (acquire_reader_st != Status::OK()) {
-            LOG(WARNING) << "fail to init reader. tablet=" << 
tablet->full_name()
-                         << "res=" << acquire_reader_st;
-            return acquire_reader_st;
-        }
+    std::vector<RowsetSharedPtr> input_rowsets;
+    Version version(0, _version);
+    Status acquire_reader_st = tablet->capture_consistent_rowsets(version, 
&input_rowsets);
+    if (acquire_reader_st != Status::OK()) {
+        LOG(WARNING) << "fail to captute consistent rowsets. tablet=" << 
tablet->full_name()
+                     << "res=" << acquire_reader_st;
+        return acquire_reader_st;
     }
 
-    for (size_t i = 0; i < tablet->tablet_schema()->num_columns(); ++i) {
-        reader_params.return_columns.push_back(i);
-    }
+    vectorized::BlockReader reader;
+    TabletReader::ReaderParams reader_params;
+    vectorized::Block block;
+    RETURN_NOT_OK(TabletReader::init_reader_params_and_create_block(
+            tablet, READER_CHECKSUM, input_rowsets, &reader_params, &block));
 
     res = reader.init(reader_params);
     if (!res.ok()) {
         LOG(WARNING) << "initiate reader fail. res = " << res;
         return res;
     }
 
+    LOG(INFO) << "yyq columns " << reader_params.return_columns.size();
     RowCursor row;
-    std::unique_ptr<MemPool> mem_pool(new MemPool());
-    std::unique_ptr<ObjectPool> agg_object_pool(new ObjectPool());
-    res = row.init(tablet->tablet_schema(), reader_params.return_columns);
+    res = row.init(reader_params.tablet_schema, reader_params.return_columns);

Review Comment:
   This row is no longer used?



##########
be/src/olap/task/engine_checksum_task.cpp:
##########
@@ -54,71 +55,58 @@ Status EngineChecksumTask::_compute_checksum() {
         return Status::OLAPInternalError(OLAP_ERR_TABLE_NOT_FOUND);
     }
 
-    TupleReader reader;
-    TabletReader::ReaderParams reader_params;
-    reader_params.tablet = tablet;
-    reader_params.reader_type = READER_CHECKSUM;
-    reader_params.version = Version(0, _version);
-
-    {
-        std::shared_lock rdlock(tablet->get_header_lock());
-        const RowsetSharedPtr message = tablet->rowset_with_max_version();
-        if (message == nullptr) {
-            LOG(FATAL) << "fail to get latest version. tablet_id=" << 
_tablet_id;
-            return Status::OLAPInternalError(OLAP_ERR_WRITE_PROTOBUF_ERROR);
-        }
-
-        Status acquire_reader_st =
-                tablet->capture_rs_readers(reader_params.version, 
&reader_params.rs_readers);
-        if (acquire_reader_st != Status::OK()) {
-            LOG(WARNING) << "fail to init reader. tablet=" << 
tablet->full_name()
-                         << "res=" << acquire_reader_st;
-            return acquire_reader_st;
-        }
+    std::vector<RowsetSharedPtr> input_rowsets;
+    Version version(0, _version);
+    Status acquire_reader_st = tablet->capture_consistent_rowsets(version, 
&input_rowsets);
+    if (acquire_reader_st != Status::OK()) {
+        LOG(WARNING) << "fail to captute consistent rowsets. tablet=" << 
tablet->full_name()
+                     << "res=" << acquire_reader_st;
+        return acquire_reader_st;
     }
 
-    for (size_t i = 0; i < tablet->tablet_schema()->num_columns(); ++i) {
-        reader_params.return_columns.push_back(i);
-    }
+    vectorized::BlockReader reader;
+    TabletReader::ReaderParams reader_params;
+    vectorized::Block block;
+    RETURN_NOT_OK(TabletReader::init_reader_params_and_create_block(
+            tablet, READER_CHECKSUM, input_rowsets, &reader_params, &block));
 
     res = reader.init(reader_params);
     if (!res.ok()) {
         LOG(WARNING) << "initiate reader fail. res = " << res;
         return res;
     }
 
+    LOG(INFO) << "yyq columns " << reader_params.return_columns.size();

Review Comment:
   remove debug log



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to