platoneko commented on code in PR #31055:
URL: https://github.com/apache/doris/pull/31055#discussion_r1494003957


##########
be/src/olap/schema_change.cpp:
##########
@@ -624,18 +604,16 @@ Result<std::pair<RowsetSharedPtr, PendingRowsetGuard>> 
VSchemaChangeWithSorting:
     } else {
         rowset_writer = std::move(result).value();
     }

Review Comment:
   必须要在写 rowset 之前就加入 pending rowset 中,不然可能在写的过程中被 gc 掉



##########
be/src/olap/schema_change.h:
##########
@@ -226,72 +232,96 @@ class VSchemaChangeWithSorting : public SchemaChange {
     std::unique_ptr<MemTracker> _mem_tracker;
 };
 
-class SchemaChangeHandler {
+// @breif schema change with sorting
+class VLocalSchemaChangeWithSorting : public VBaseSchemaChangeWithSorting {

Review Comment:
   
   ```suggestion
   class VLocalSchemaChangeWithSorting final : public 
VBaseSchemaChangeWithSorting {
   ```



##########
be/src/olap/schema_change.h:
##########
@@ -196,26 +197,31 @@ class VSchemaChangeDirectly : public SchemaChange {
     const BlockChanger& _changer;
 };
 
-// @breif schema change with sorting
-class VSchemaChangeWithSorting : public SchemaChange {
+class VBaseSchemaChangeWithSorting : public SchemaChange {
 public:
-    VSchemaChangeWithSorting(const BlockChanger& changer, size_t 
memory_limitation);
-    ~VSchemaChangeWithSorting() override = default;
+    VBaseSchemaChangeWithSorting(const BlockChanger& changer, size_t 
memory_limitation);
+    ~VBaseSchemaChangeWithSorting() override = default;
 
-private:
     Status _inner_process(RowsetReaderSharedPtr rowset_reader, RowsetWriter* 
rowset_writer,
-                          TabletSharedPtr new_tablet, TabletSchemaSPtr 
base_tablet_schema,
+                          BaseTabletSPtr new_tablet, TabletSchemaSPtr 
base_tablet_schema,
                           TabletSchemaSPtr new_tablet_schema) override;
 
-    Result<std::pair<RowsetSharedPtr, PendingRowsetGuard>> _internal_sorting(
+    virtual Result<RowsetSharedPtr> _internal_sorting(
             const std::vector<std::unique_ptr<vectorized::Block>>& blocks,
             const Version& temp_delta_versions, int64_t newest_write_timestamp,
-            TabletSharedPtr new_tablet, RowsetTypePB new_rowset_type,
+            BaseTabletSPtr new_tablet, RowsetTypePB new_rowset_type,
             SegmentsOverlapPB segments_overlap, TabletSchemaSPtr 
new_tablet_schema);
 
     Status _external_sorting(std::vector<RowsetSharedPtr>& src_rowsets, 
RowsetWriter* rowset_writer,
-                             TabletSharedPtr new_tablet, TabletSchemaSPtr 
new_tablet_schema);
+                             BaseTabletSPtr new_tablet, TabletSchemaSPtr 
new_tablet_schema);
 
+protected:
+    // for external sorting
+    // src_rowsets to store the rowset generated by internal sorting
+    std::vector<RowsetSharedPtr> _src_rowsets;
+    std::vector<PendingRowsetGuard> _pending_rs_guards; // just for local 
schema change

Review Comment:
   这两个如果cloud没用到就放进 `VLocalSchemaChangeWithSorting` 里面吧



##########
be/src/olap/schema_change.h:
##########
@@ -196,26 +197,31 @@ class VSchemaChangeDirectly : public SchemaChange {
     const BlockChanger& _changer;
 };
 
-// @breif schema change with sorting
-class VSchemaChangeWithSorting : public SchemaChange {
+class VBaseSchemaChangeWithSorting : public SchemaChange {

Review Comment:
   
   ```suggestion
   class VBaseSchemaChangeWithSorting final : public SchemaChange {
   ```



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to