You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "mymeiyi (via GitHub)" <gi...@apache.org> on 2024/09/26 11:07:12 UTC

[PR] [improve](txn insert) make sub transactions visible [doris]

mymeiyi opened a new pull request, #41362:
URL: https://github.com/apache/doris/pull/41362

   (no comment)


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2449278104

   run p0


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2469751889

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2422410829

   run p0


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2408334627

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #41362:
URL: https://github.com/apache/doris/pull/41362#discussion_r1778652147


##########
fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java:
##########
@@ -802,13 +802,27 @@ private void addScanRangeLocations(Partition partition,
             paloRange.setVersion(visibleVersionStr);
             paloRange.setVersionHash("");
             paloRange.setTabletId(tabletId);
+            if (ConnectContext.get().isTxnModel()) {
+                paloRange.setSubTxnIds(
+                        ConnectContext.get().getTxnEntry().getTabletSubTxnIds(olapTable.getId(), tablet));
+                LOG.info("table={}, partition={}, tablet={}, sub txn ids={}", olapTable.getId(), partition.getId(),
+                        tablet.getId(), paloRange.getSubTxnIds());
+            }
 

Review Comment:
   We should assure that select in txn are forward to master too.



-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow commented on code in PR #41362:
URL: https://github.com/apache/doris/pull/41362#discussion_r1794613107


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PruneEmptyPartition.java:
##########
@@ -18,30 +18,59 @@
 package org.apache.doris.nereids.rules.rewrite;
 
 import org.apache.doris.catalog.OlapTable;
+import org.apache.doris.catalog.Partition;
 import org.apache.doris.nereids.rules.Rule;
 import org.apache.doris.nereids.rules.RuleType;
 import org.apache.doris.nereids.trees.plans.logical.LogicalEmptyRelation;
 import org.apache.doris.nereids.trees.plans.logical.LogicalOlapScan;
 import org.apache.doris.qe.ConnectContext;
 
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
 import java.util.List;
 
 /**
  * Used to prune empty partition.
  */
 public class PruneEmptyPartition extends OneRewriteRuleFactory {
+    public static final Logger LOG = LogManager.getLogger(PruneEmptyPartition.class);
 
     @Override
     public Rule build() {
         return logicalOlapScan().thenApply(ctx -> {
             LogicalOlapScan scan = ctx.root;
             OlapTable table = scan.getTable();
             List<Long> ids = table.selectNonEmptyPartitionIds(scan.getSelectedPartitionIds());
+            addPartitionsForTxnLoad(scan.getSelectedPartitionIds(), ids, table, scan.getSelectedIndexId());

Review Comment:
   why add this, could u add some comment to explain? i think we should not do txn things here, maybe we could find another better way to do it



-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2376652470

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #41362:
URL: https://github.com/apache/doris/pull/41362#discussion_r1836736750


##########
fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java:
##########
@@ -1743,6 +1745,9 @@ public void setEnableLeftZigZag(boolean enableLeftZigZag) {
     @VariableMgr.VarAttr(name = GROUP_COMMIT, needForward = true)
     public String groupCommit = "off_mode";
 
+    @VariableMgr.VarAttr(name = ENABLE_QUERY_IN_TRANSACTION_LOAD, needForward = true)
+    public boolean enableQueryInTransactionLoad = false;

Review Comment:
   enable_transaction_write_visibility is a better name.



-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #41362:
URL: https://github.com/apache/doris/pull/41362#discussion_r1778652147


##########
fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java:
##########
@@ -802,13 +802,27 @@ private void addScanRangeLocations(Partition partition,
             paloRange.setVersion(visibleVersionStr);
             paloRange.setVersionHash("");
             paloRange.setTabletId(tabletId);
+            if (ConnectContext.get().isTxnModel()) {
+                paloRange.setSubTxnIds(
+                        ConnectContext.get().getTxnEntry().getTabletSubTxnIds(olapTable.getId(), tablet));
+                LOG.info("table={}, partition={}, tablet={}, sub txn ids={}", olapTable.getId(), partition.getId(),
+                        tablet.getId(), paloRange.getSubTxnIds());
+            }
 

Review Comment:
   We should assure that select in txn is forwarded to master too. 



-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #41362:
URL: https://github.com/apache/doris/pull/41362#discussion_r1778655188


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PruneEmptyPartition.java:
##########
@@ -18,30 +18,59 @@
 package org.apache.doris.nereids.rules.rewrite;
 
 import org.apache.doris.catalog.OlapTable;
+import org.apache.doris.catalog.Partition;
 import org.apache.doris.nereids.rules.Rule;
 import org.apache.doris.nereids.rules.RuleType;
 import org.apache.doris.nereids.trees.plans.logical.LogicalEmptyRelation;
 import org.apache.doris.nereids.trees.plans.logical.LogicalOlapScan;
 import org.apache.doris.qe.ConnectContext;
 
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
 import java.util.List;
 
 /**
  * Used to prune empty partition.
  */
 public class PruneEmptyPartition extends OneRewriteRuleFactory {
+    public static final Logger LOG = LogManager.getLogger(PruneEmptyPartition.class);
 
     @Override
     public Rule build() {
         return logicalOlapScan().thenApply(ctx -> {
             LogicalOlapScan scan = ctx.root;
             OlapTable table = scan.getTable();
             List<Long> ids = table.selectNonEmptyPartitionIds(scan.getSelectedPartitionIds());
+            addPartitionsForTxnLoad(scan.getSelectedPartitionIds(), ids, table, scan.getSelectedIndexId());
             if (ids.isEmpty()) {
                 return new LogicalEmptyRelation(ConnectContext.get().getStatementContext().getNextRelationId(),
                         scan.getOutput());
             }
             return scan.withSelectedPartitionIds(ids);
         }).toRule(RuleType.PRUNE_EMPTY_PARTITION);
     }
+
+    private void addPartitionsForTxnLoad(List<Long> selectedPartitions, List<Long> nonEmptyPartitions,
+            OlapTable table, long indexId) {
+        if (!ConnectContext.get().isTxnModel()) {
+            return;
+        }
+        for (Long selectedPartitionId : selectedPartitions) {
+            if (nonEmptyPartitions.contains(selectedPartitionId)) {
+                continue;
+            }
+            Partition partition = table.getPartition(selectedPartitionId);
+            if (partition == null) {
+                continue;
+            }
+            // TODO if partition version is -1 and the operatiob is delete, can skip this partition
+            if (!ConnectContext.get().getTxnEntry().getPartitionSubTxnIds(table.getId(), partition, indexId)
+                    .isEmpty()) {
+                nonEmptyPartitions.add(selectedPartitionId);
+            }
+        }
+        LOG.info("add partition for txn load, table: {}, selected partitions: {}, non empty partitions: {}",
+                table.getId(), selectedPartitions, nonEmptyPartitions);
+    }

Review Comment:
   Make sure there is a case to test the logic.



-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #41362:
URL: https://github.com/apache/doris/pull/41362#discussion_r1778696929


##########
be/src/cloud/cloud_tablet.cpp:
##########
@@ -108,6 +108,44 @@ Status CloudTablet::capture_rs_readers(const Version& spec_version,
     return capture_rs_readers_unlocked(version_path, rs_splits);
 }
 
+Status CloudTablet::capture_sub_txn_rs_readers(int64_t version,
+                                               const std::vector<int64_t>& sub_txn_ids,
+                                               std::vector<RowSetSplits>* rs_splits) {
+    LOG(INFO) << "capture_sub_txn_rs_readers for partition=" << partition_id()
+              << ", tablet_id=" << tablet_id() << ", version=" << version
+              << ", sub_txn_ids.size=" << sub_txn_ids.size();
+    std::vector<std::shared_ptr<Rowset>> rowsets;
+    RETURN_IF_ERROR(_engine.meta_mgr().get_tmp_rowset(tablet_schema(), index_id(), tablet_id(),
+                                                      sub_txn_ids, rowsets));
+    DCHECK(rowsets.size() == sub_txn_ids.size())
+            << " sub_txn_id size=" << sub_txn_ids.size() << ", rowset size=" << rowsets.size()
+            << ", partition_id=" << partition_id() << ", tablet=" << tablet_id();
+    for (int i = 0; i < rowsets.size(); ++i) {
+        auto& rowset = rowsets[i];
+        DCHECK(rowset != nullptr) << " rowset is nullptr for sub_txn_id=" << sub_txn_ids[i]
+                                  << ", partition_id=" << partition_id()
+                                  << ", tablet=" << tablet_id();
+        // see CloudMetaMgr::sync_tablet_rowsets, GetRowsetRequest
+        int64_t tmp_version = version + i + 1;
+        LOG(INFO) << "sub_txn_id=" << sub_txn_ids[i] << ", partition_id=" << partition_id()
+                  << ", tablet=" << tablet_id() << ", set tmp version=" << tmp_version;
+        rowset->set_version(Version(tmp_version, tmp_version));
+        if (rowset->rowset_meta()->has_delete_predicate()) {
+            rowset->rowset_meta()->mutable_delete_predicate()->set_version(tmp_version);
+        }
+        if (rowset != nullptr) {
+            RowsetReaderSharedPtr rs_reader;
+            auto res = rowset->create_reader(&rs_reader);
+            if (!res.ok()) {
+                return Status::Error<ErrorCode::CAPTURE_ROWSET_READER_ERROR>(
+                        "failed to create reader for rowset:{}", rowset->rowset_id().to_string());
+            }
+            rs_splits->emplace_back(std::move(rs_reader));
+        }

Review Comment:
   some duplicate code in Tablet and CloudTablet.



-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2408398356

   TeamCity be ut coverage result:
    Function Coverage: 37.39% (9659/25834) 
    Line Coverage: 28.64% (80131/279747)
    Region Coverage: 28.07% (41435/147608)
    Branch Coverage: 24.67% (21103/85526)
    Coverage Report: http://coverage.selectdb-in.cc/coverage/e4fe4482ba7182ab619af8fb1fe75db39aac9762_e4fe4482ba7182ab619af8fb1fe75db39aac9762/report/index.html


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #41362:
URL: https://github.com/apache/doris/pull/41362#discussion_r1838178552


##########
cloud/src/meta-service/meta_service.cpp:
##########
@@ -1418,6 +1418,108 @@ static bool try_fetch_and_parse_schema(Transaction* txn, RowsetMetaCloudPB& rows
     return true;
 }
 
+void MetaServiceImpl::get_tmp_rowset(::google::protobuf::RpcController* controller,

Review Comment:
   warning: function 'get_tmp_rowset' exceeds recommended size/complexity thresholds [readability-function-size]
   ```cpp
   void MetaServiceImpl::get_tmp_rowset(::google::protobuf::RpcController* controller,
                         ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **cloud/src/meta-service/meta_service.cpp:1420:** 97 lines including whitespace and comments (threshold 80)
   ```cpp
   void MetaServiceImpl::get_tmp_rowset(::google::protobuf::RpcController* controller,
                         ^
   ```
   
   </details>
   



-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2449046897

   TeamCity be ut coverage result:
    Function Coverage: 37.92% (9850/25978) 
    Line Coverage: 29.17% (82053/281274)
    Region Coverage: 28.44% (42347/148918)
    Branch Coverage: 25.02% (21517/86014)
    Coverage Report: http://coverage.selectdb-in.cc/coverage/26b0fdc8ea349ff089d07e1bb2b715aa59b661c8_26b0fdc8ea349ff089d07e1bb2b715aa59b661c8/report/index.html


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2434546947

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2453722160

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2463638805

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2470636616

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2408468093

   TeamCity be ut coverage result:
    Function Coverage: 37.39% (9666/25851) 
    Line Coverage: 28.63% (80163/279967)
    Region Coverage: 28.07% (41446/147658)
    Branch Coverage: 24.69% (21111/85516)
    Coverage Report: http://coverage.selectdb-in.cc/coverage/f8e33feb8616c0b5954510d3f1a49ffbaba50b91_f8e33feb8616c0b5954510d3f1a49ffbaba50b91/report/index.html


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #41362:
URL: https://github.com/apache/doris/pull/41362#discussion_r1778712359


##########
fe/fe-core/src/main/java/org/apache/doris/transaction/TransactionEntry.java:
##########
@@ -534,4 +532,82 @@ private TTxnLoadInfo getTxnLoadInfo() {
     private Set<Long> getTableIds() {
         return subTransactionStates.stream().map(s -> s.getTable().getId()).collect(Collectors.toSet());
     }
+
+    public List<Long> getPartitionSubTxnIds(long tableId, Partition partition, long indexId) {
+        List<Long> subTxnIds = new ArrayList<>();
+        MaterializedIndex index = partition.getIndex(indexId);
+        if (index == null) {
+            LOG.error("index={} not found in table={}, partition={}", indexId, tableId, partition.getId());
+            return subTxnIds;
+        }
+        for (SubTransactionState subTransactionState : subTransactionStates) {
+            if (subTransactionState.getTable().getId() != tableId) {
+                continue;
+            }
+            for (TTabletCommitInfo tabletCommitInfo : subTransactionState.getTabletCommitInfos()) {
+                if (index.getTablet(tabletCommitInfo.getTabletId()) != null) {
+                    subTxnIds.add(subTransactionState.getSubTransactionId());
+                    break;
+                }
+            }
+        }
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("table_id={}, partition_id={}, sub_txn_ids={}", tableId, partition.getId(), subTxnIds);
+        }
+        return subTxnIds;

Review Comment:
   Here, we could generate duplicated sub txnids. I am not sure what is impact.



-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2378494786

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #41362:
URL: https://github.com/apache/doris/pull/41362#discussion_r1797541896


##########
be/src/olap/tablet_reader.cpp:
##########
@@ -207,8 +207,12 @@ Status TabletReader::_capture_rs_readers(const ReaderParams& read_params) {
         }
         if (_tablet_schema->keys_type() == UNIQUE_KEYS &&
             _tablet->enable_unique_key_merge_on_write()) {
-            // unique keys with merge on write, no need to merge sort keys in rowset
-            need_ordered_result = false;
+            if (read_params.query_mow_in_mor) {
+                need_ordered_result = true;

Review Comment:
   warning: redundant boolean literal in conditional assignment [readability-simplify-boolean-expr]
   ```cpp
                   need_ordered_result = true;
                                         ^
   ```
   



##########
be/src/olap/base_tablet.cpp:
##########
@@ -128,6 +128,42 @@ BaseTablet::~BaseTablet() {
     g_total_tablet_num << -1;
 }
 
+Status BaseTablet::capture_sub_txn_rs_readers(int64_t version,

Review Comment:
   warning: method 'capture_sub_txn_rs_readers' can be made const [readability-make-member-function-const]
   
   be/src/olap/base_tablet.cpp:132:
   ```diff
   -                                               std::vector<RowSetSplits>* rs_splits) {
   +                                               std::vector<RowSetSplits>* rs_splits) const {
   ```
   



##########
be/src/vec/olap/vcollect_iterator.cpp:
##########
@@ -71,7 +71,11 @@ void VCollectIterator::init(TabletReader* reader, bool ori_data_overlapping, boo
         (_reader->_direct_mode || _reader->_tablet->keys_type() == KeysType::DUP_KEYS ||
          (_reader->_tablet->keys_type() == KeysType::UNIQUE_KEYS &&
           _reader->_tablet->enable_unique_key_merge_on_write()))) {
-        _merge = false;
+        if (_reader->_reader_context.query_mow_in_mor) {
+            _merge = true;

Review Comment:
   warning: redundant boolean literal in conditional assignment [readability-simplify-boolean-expr]
   
   be/src/vec/olap/vcollect_iterator.cpp:73:
   ```diff
   -         if (_reader->_reader_context.query_mow_in_mor) {
   -             _merge = true;
   -         } else {
   -             _merge = false;
   -         }
   +         _merge = static_cast<bool>(_reader->_reader_context.query_mow_in_mor);
   ```
   



##########
cloud/src/meta-service/meta_service.cpp:
##########
@@ -1410,6 +1410,108 @@
     return true;
 }
 
+void MetaServiceImpl::get_tmp_rowset(::google::protobuf::RpcController* controller,
+                                     const GetTmpRowsetRequest* request,
+                                     GetTmpRowsetResponse* response,
+                                     ::google::protobuf::Closure* done) {
+    RPC_PREPROCESS(get_tmp_rowset);
+    instance_id = get_instance_id(resource_mgr_, request->cloud_unique_id());
+    if (instance_id.empty()) {
+        code = MetaServiceCode::INVALID_ARGUMENT;
+        msg = "empty instance_id";
+        LOG(INFO) << msg << ", cloud_unique_id=" << request->cloud_unique_id();
+        return;
+    }
+    RPC_RATE_LIMIT(get_tmp_rowset)
+    if (!request->has_index_id()) {
+        code = MetaServiceCode::INVALID_ARGUMENT;
+        msg = "empty index id";
+        return;
+    }
+    if (!request->has_tablet_id()) {
+        code = MetaServiceCode::INVALID_ARGUMENT;
+        msg = "empty tablet id";
+        return;
+    }
+    if (request->txn_ids().empty()) {
+        code = MetaServiceCode::INVALID_ARGUMENT;
+        msg = "empty txn ids";
+        return;
+    }
+    std::unique_ptr<Transaction> txn;
+    TxnErrorCode err = txn_kv_->create_txn(&txn);
+    if (err != TxnErrorCode::TXN_OK) {
+        code = cast_as<ErrCategory::CREATE>(err);
+        msg = "failed to create txn";
+        return;
+    }
+    std::vector<std::string> tmp_rowset_keys;
+    std::vector<std::optional<std::string>> tmp_rowset_values;
+    tmp_rowset_keys.reserve(request->txn_ids().size());
+    tmp_rowset_values.reserve(request->txn_ids().size());
+    int64_t tablet_id = request->tablet_id();
+    int64_t index_id = request->index_id();
+    // TODO avoid too many txn ids, should limit in fe
+    for (const auto& txn_id : request->txn_ids()) {
+        tmp_rowset_keys.push_back(meta_rowset_tmp_key({instance_id, txn_id, tablet_id}));
+    }
+    err = txn->batch_get(&tmp_rowset_values, tmp_rowset_keys);
+    if (err != TxnErrorCode::TXN_OK) {
+        code = cast_as<ErrCategory::READ>(err);
+        ss << "failed to batch get tmp rowset, instance_id=" << instance_id
+           << " tablet_id=" << tablet_id << " err=" << err;
+        msg = ss.str();
+        LOG(WARNING) << msg;
+        return;
+    }
+    // get referenced schema
+    std::unordered_map<int32_t, doris::TabletSchemaCloudPB*> version_to_schema;
+    for (size_t i = 0; i < tmp_rowset_keys.size(); ++i) {
+        if (!tmp_rowset_values[i].has_value()) [[unlikely]] {
+            code = MetaServiceCode::KV_TXN_GET_ERR;
+            ss << "failed to get tmp rowset, err=not found, instance_id=" << instance_id
+               << " tablet_id=" << tablet_id << " txn_id=" << request->txn_ids(i)
+               << " key=" << hex(tmp_rowset_keys[i]);
+            msg = ss.str();
+            LOG(WARNING) << msg;
+            return;
+        }
+        auto rowset_meta = response->add_rowset_meta();
+        if (!rowset_meta->ParseFromArray(tmp_rowset_values[i]->data(),
+                                         tmp_rowset_values[i]->size())) {
+            code = MetaServiceCode::PROTOBUF_PARSE_ERR;
+            ss << "malformed rowset meta value, instance_id=" << instance_id
+               << " tablet_id=" << tablet_id << " txn_id=" << request->txn_ids(i)
+               << " key=" << hex(tmp_rowset_keys[i]);
+            msg = ss.str();
+            LOG(WARNING) << msg;
+            return;
+        }
+        // set tablet schema
+        if (rowset_meta->has_tablet_schema()) continue;

Review Comment:
   warning: statement should be inside braces [readability-braces-around-statements]
   
   ```suggestion
           if (rowset_meta->has_tablet_schema()) { continue;
   }
   ```
   



##########
cloud/src/meta-service/meta_service.cpp:
##########
@@ -1410,6 +1410,108 @@ static bool try_fetch_and_parse_schema(Transaction* txn, RowsetMetaCloudPB& rows
     return true;
 }
 
+void MetaServiceImpl::get_tmp_rowset(::google::protobuf::RpcController* controller,

Review Comment:
   warning: function 'get_tmp_rowset' exceeds recommended size/complexity thresholds [readability-function-size]
   ```cpp
   void MetaServiceImpl::get_tmp_rowset(::google::protobuf::RpcController* controller,
                         ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **cloud/src/meta-service/meta_service.cpp:1412:** 97 lines including whitespace and comments (threshold 80)
   ```cpp
   void MetaServiceImpl::get_tmp_rowset(::google::protobuf::RpcController* controller,
                         ^
   ```
   
   </details>
   



-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2448969094

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2484838475

   PR approved by anyone and no changes requested.


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2440439517

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2908186519

   We're closing this PR because it hasn't been updated in a while.
   This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
   If you'd like to revive this PR, please reopen it and feel free a maintainer to remove the Stale tag!


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2378715324

   TeamCity be ut coverage result:
    Function Coverage: 37.29% (9627/25815) 
    Line Coverage: 28.68% (79665/277737)
    Region Coverage: 28.12% (41191/146504)
    Branch Coverage: 24.74% (20973/84788)
    Coverage Report: http://coverage.selectdb-in.cc/coverage/7646c207b62a29bf04a45757bfe5eef2e8e9489b_7646c207b62a29bf04a45757bfe5eef2e8e9489b/report/index.html


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2421783040

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2472845591

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2499589720

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2408432294

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #41362: [improve](txn insert) make sub transactions visible
URL: https://github.com/apache/doris/pull/41362


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #41362:
URL: https://github.com/apache/doris/pull/41362#discussion_r1778640366


##########
fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java:
##########
@@ -1743,6 +1745,9 @@ public void setEnableLeftZigZag(boolean enableLeftZigZag) {
     @VariableMgr.VarAttr(name = GROUP_COMMIT, needForward = true)
     public String groupCommit = "off_mode";
 
+    @VariableMgr.VarAttr(name = ENABLE_QUERY_IN_TRANSACTION_LOAD, needForward = true)
+    public boolean enableQueryInTransactionLoad = false;

Review Comment:
   default should be true.



-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2463749782

   TeamCity be ut coverage result:
    Function Coverage: 37.89% (9864/26031) 
    Line Coverage: 29.06% (82069/282456)
    Region Coverage: 28.27% (42266/149485)
    Branch Coverage: 24.85% (21436/86278)
    Coverage Report: http://coverage.selectdb-in.cc/coverage/21597e29e7b140083f2e25ca1a8834c3a9ba5716_21597e29e7b140083f2e25ca1a8834c3a9ba5716/report/index.html


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2422017345

   TeamCity be ut coverage result:
    Function Coverage: 37.46% (9710/25921) 
    Line Coverage: 28.72% (80614/280707)
    Region Coverage: 28.17% (41735/148137)
    Branch Coverage: 24.74% (21211/85722)
    Coverage Report: http://coverage.selectdb-in.cc/coverage/971d4c6fef45e50422acaf77faaf262f32d16f0c_971d4c6fef45e50422acaf77faaf262f32d16f0c/report/index.html


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2434098261

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2434237800

   TeamCity be ut coverage result:
    Function Coverage: 37.46% (9710/25918) 
    Line Coverage: 28.72% (80516/280373)
    Region Coverage: 28.14% (41625/147895)
    Branch Coverage: 24.71% (21144/85570)
    Coverage Report: http://coverage.selectdb-in.cc/coverage/2894e21f07fb4f1b53ba685d0dffc594472efc61_2894e21f07fb4f1b53ba685d0dffc594472efc61/report/index.html


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2499704580

   TeamCity be ut coverage result:
    Function Coverage: 38.36% (9979/26012) 
    Line Coverage: 29.44% (83499/283601)
    Region Coverage: 28.59% (42981/150345)
    Branch Coverage: 25.19% (21829/86662)
    Coverage Report: http://coverage.selectdb-in.cc/coverage/836fd8c62ec2ec4bbcdb614fc8d8d085d66cd834_836fd8c62ec2ec4bbcdb614fc8d8d085d66cd834/report/index.html


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2376894388

   TeamCity be ut coverage result:
    Function Coverage: 37.31% (9635/25827) 
    Line Coverage: 28.70% (79715/277800)
    Region Coverage: 28.12% (41217/146573)
    Branch Coverage: 24.75% (20989/84804)
    Coverage Report: http://coverage.selectdb-in.cc/coverage/468f4a1ee092489aeb84d542f4c98fb7d4593b82_468f4a1ee092489aeb84d542f4c98fb7d4593b82/report/index.html


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #41362:
URL: https://github.com/apache/doris/pull/41362#discussion_r1778695195


##########
be/src/olap/tablet.cpp:
##########
@@ -938,6 +938,38 @@ Status Tablet::capture_rs_readers(const Version& spec_version, std::vector<RowSe
     return Status::OK();
 }
 
+Status Tablet::capture_sub_txn_rs_readers(int64_t version, const std::vector<int64_t>& sub_txn_ids,
+                                          std::vector<RowSetSplits>* rs_splits) {
+    LOG(INFO) << "capture_sub_txn_rs_readers for partition=" << partition_id()
+              << ", tablet_id=" << tablet_id() << ", version=" << version
+              << ", sub_txn_ids.size=" << sub_txn_ids.size();
+    for (int i = 0; i < sub_txn_ids.size(); ++i) {
+        auto sub_txn_id = sub_txn_ids[i];
+        auto rowset = _engine.txn_manager()->get_tablet_rowset(tablet_id(), tablet_uid(),
+                                                               partition_id(), sub_txn_id);
+        DCHECK(rowset != nullptr) << " rowset is nullptr for sub_txn_id=" << sub_txn_ids[i]
+                                  << ", partition_id=" << partition_id()
+                                  << ", tablet=" << tablet_id();
+        int64_t tmp_version = version + i + 1;

Review Comment:
   version has already been added in prallel_scanner_builder _build_scanners_by_rowid.



-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #41362:
URL: https://github.com/apache/doris/pull/41362#discussion_r1833623986


##########
be/src/olap/base_tablet.cpp:
##########
@@ -129,6 +129,42 @@ BaseTablet::~BaseTablet() {
     g_total_tablet_num << -1;
 }
 
+Status BaseTablet::capture_sub_txn_rs_readers(int64_t version,

Review Comment:
   warning: method 'capture_sub_txn_rs_readers' can be made const [readability-make-member-function-const]
   
   be/src/olap/base_tablet.cpp:133:
   ```diff
   -                                               std::vector<RowSetSplits>* rs_splits) {
   +                                               std::vector<RowSetSplits>* rs_splits) const {
   ```
   



-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2484838424

   PR approved by at least one committer and no changes requested.


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2453799809

   TeamCity be ut coverage result:
    Function Coverage: 37.80% (9818/25972) 
    Line Coverage: 28.95% (81558/281685)
    Region Coverage: 28.23% (42126/149214)
    Branch Coverage: 24.81% (21373/86142)
    Coverage Report: http://coverage.selectdb-in.cc/coverage/ee8e7345872a92faf689d92b91b4e07122f36afc_ee8e7345872a92faf689d92b91b4e07122f36afc/report/index.html


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2434602667

   TeamCity be ut coverage result:
    Function Coverage: 37.46% (9709/25918) 
    Line Coverage: 28.73% (80541/280377)
    Region Coverage: 28.14% (41624/147904)
    Branch Coverage: 24.72% (21151/85574)
    Coverage Report: http://coverage.selectdb-in.cc/coverage/c7af08ad30dea59a38fe21cf5c60e5ec603f97d4_c7af08ad30dea59a38fe21cf5c60e5ec603f97d4/report/index.html


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2440548312

   TeamCity be ut coverage result:
    Function Coverage: 37.45% (9716/25941) 
    Line Coverage: 28.73% (80610/280601)
    Region Coverage: 28.15% (41671/148056)
    Branch Coverage: 24.71% (21174/85696)
    Coverage Report: http://coverage.selectdb-in.cc/coverage/ac6be0182b94a68d63f970c74e7bc11e7ccdb4fb_ac6be0182b94a68d63f970c74e7bc11e7ccdb4fb/report/index.html


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2376638651

   Thank you for your contribution to Apache Doris.
   Don't know what should be done next? See [How to process your PR](https://cwiki.apache.org/confluence/display/DORIS/How+to+process+your+PR)
   
   Since 2024-03-18, the Document has been moved to [doris-website](https://github.com/apache/doris-website).
   See [Doris Document](https://cwiki.apache.org/confluence/display/DORIS/Doris+Document).


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #41362:
URL: https://github.com/apache/doris/pull/41362#discussion_r1778658006


##########
cloud/src/meta-service/meta_service.cpp:
##########
@@ -1410,6 +1410,108 @@ static bool try_fetch_and_parse_schema(Transaction* txn, RowsetMetaCloudPB& rows
     return true;
 }
 
+void MetaServiceImpl::get_tmp_rowset(::google::protobuf::RpcController* controller,
+                                     const GetTmpRowsetRequest* request,
+                                     GetTmpRowsetResponse* response,
+                                     ::google::protobuf::Closure* done) {
+    RPC_PREPROCESS(get_tmp_rowset);
+    instance_id = get_instance_id(resource_mgr_, request->cloud_unique_id());
+    if (instance_id.empty()) {
+        code = MetaServiceCode::INVALID_ARGUMENT;
+        msg = "empty instance_id";
+        LOG(INFO) << msg << ", cloud_unique_id=" << request->cloud_unique_id();
+        return;
+    }
+    RPC_RATE_LIMIT(get_tmp_rowset)
+    if (!request->has_index_id()) {
+        code = MetaServiceCode::INVALID_ARGUMENT;
+        msg = "empty index id";
+        return;
+    }
+    if (!request->has_tablet_id()) {
+        code = MetaServiceCode::INVALID_ARGUMENT;
+        msg = "empty tablet id";
+        return;
+    }
+    if (request->txn_ids().empty()) {
+        code = MetaServiceCode::INVALID_ARGUMENT;
+        msg = "empty txn ids";
+        return;
+    }
+    std::unique_ptr<Transaction> txn;
+    TxnErrorCode err = txn_kv_->create_txn(&txn);
+    if (err != TxnErrorCode::TXN_OK) {
+        code = cast_as<ErrCategory::CREATE>(err);
+        msg = "failed to create txn";
+        return;
+    }
+    std::vector<std::string> tmp_rowset_keys;
+    std::vector<std::optional<std::string>> tmp_rowset_values;
+    tmp_rowset_keys.reserve(request->txn_ids().size());
+    tmp_rowset_values.reserve(request->txn_ids().size());
+    int64_t tablet_id = request->tablet_id();
+    int64_t index_id = request->index_id();
+    // TODO avoid too many txn ids, should limit in fe
+    for (const auto& txn_id : request->txn_ids()) {
+        tmp_rowset_keys.push_back(meta_rowset_tmp_key({instance_id, txn_id, tablet_id}));
+    }
+    err = txn->batch_get(&tmp_rowset_values, tmp_rowset_keys);
+    if (err != TxnErrorCode::TXN_OK) {
+        code = cast_as<ErrCategory::READ>(err);
+        ss << "failed to batch get tmp rowset, instance_id=" << instance_id
+           << " tablet_id=" << tablet_id << " err=" << err;
+        msg = ss.str();
+        LOG(WARNING) << msg;
+        return;
+    }
+    // get referenced schema
+    std::unordered_map<int32_t, doris::TabletSchemaCloudPB*> version_to_schema;
+    for (size_t i = 0; i < tmp_rowset_keys.size(); ++i) {
+        if (!tmp_rowset_values[i].has_value()) [[unlikely]] {
+            code = MetaServiceCode::KV_TXN_GET_ERR;
+            ss << "failed to get tmp rowset, err=not found, instance_id=" << instance_id
+               << " tablet_id=" << tablet_id << " txn_id=" << request->txn_ids(i)
+               << " key=" << hex(tmp_rowset_keys[i]);
+            msg = ss.str();
+            LOG(WARNING) << msg;
+            return;
+        }
+        auto rowset_meta = response->add_rowset_meta();
+        if (!rowset_meta->ParseFromArray(tmp_rowset_values[i]->data(),
+                                         tmp_rowset_values[i]->size())) {
+            code = MetaServiceCode::PROTOBUF_PARSE_ERR;
+            ss << "malformed rowset meta value, instance_id=" << instance_id
+               << " tablet_id=" << tablet_id << " txn_id=" << request->txn_ids(i)
+               << " key=" << hex(tmp_rowset_keys[i]);
+            msg = ss.str();
+            LOG(WARNING) << msg;
+            return;
+        }
+        // set tablet schema
+        if (rowset_meta->has_tablet_schema()) continue;
+        if (!rowset_meta->has_schema_version()) {
+            code = MetaServiceCode::INVALID_ARGUMENT;
+            ss << "rowset_meta must have either schema or schema_version, instance_id="
+               << instance_id << " tablet_id=" << tablet_id << " txn_id=" << request->txn_ids(i)
+               << " key=" << hex(tmp_rowset_keys[i]);
+            msg = ss.str();
+            LOG(WARNING) << msg;
+            return;
+        }
+        if (auto it = version_to_schema.find(rowset_meta->schema_version());
+            it != version_to_schema.end()) {
+            rowset_meta->mutable_tablet_schema()->CopyFrom(*it->second);
+        } else {
+            auto key = meta_schema_key({instance_id, index_id, rowset_meta->schema_version()});
+            if (!try_fetch_and_parse_schema(txn.get(), *rowset_meta, key, code, msg)) {
+                return;
+            }
+            version_to_schema.emplace(rowset_meta->schema_version(),
+                                      rowset_meta->mutable_tablet_schema());
+        }
+    }

Review Comment:
   We should limit number of subTxns in a txn, otherwise, if 10k subtransactions, maybe there is a pressure attach for ms here.



-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2499531153

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "mymeiyi (via GitHub)" <gi...@apache.org>.
mymeiyi commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2499588139

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on PR #41362:
URL: https://github.com/apache/doris/pull/41362#issuecomment-2468249469

   run buildall


-- 
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-unsubscribe@doris.apache.org

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


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


Re: [PR] [improve](txn insert) make sub transactions visible [doris]

Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring commented on code in PR #41362:
URL: https://github.com/apache/doris/pull/41362#discussion_r1836742066


##########
be/src/olap/tablet.cpp:
##########
@@ -955,6 +955,20 @@ Status Tablet::capture_rs_readers(const Version& spec_version, std::vector<RowSe
     return Status::OK();
 }
 
+Status Tablet::capture_sub_txn_rowsets(const std::vector<int64_t>& sub_txn_ids,
+                                       std::vector<RowsetSharedPtr>* rowsets) {
+    for (int i = 0; i < sub_txn_ids.size(); ++i) {
+        auto sub_txn_id = sub_txn_ids[i];
+        auto rowset = _engine.txn_manager()->get_tablet_rowset(tablet_id(), tablet_uid(),
+                                                               partition_id(), sub_txn_id);

Review Comment:
   handle nullptr here to avoid that a bug resulting in a core dump.



-- 
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-unsubscribe@doris.apache.org

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


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