github-actions[bot] commented on code in PR #26712:
URL: https://github.com/apache/doris/pull/26712#discussion_r1388020311


##########
be/src/olap/txn_manager.cpp:
##########
@@ -98,6 +98,17 @@ Status TxnManager::prepare_txn(TPartitionId partition_id, 
TTransactionId transac
     std::lock_guard<std::shared_mutex> 
txn_wrlock(_get_txn_map_lock(transaction_id));
     txn_tablet_map_t& txn_tablet_map = _get_txn_tablet_map(transaction_id);
 
+    DBUG_EXECUTE_IF("TxnManager.prepare_txn_random_failed", {
+        if (rand() % 100 < (100 * dp->param("percent", 0.5))) {

Review Comment:
   warning: 0.5 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
           if (rand() % 100 < (100 * dp->param("percent", 0.5))) {
                                                          ^
   ```
   



##########
be/src/olap/txn_manager.cpp:
##########
@@ -251,11 +262,16 @@
                 key.first, key.second, tablet_info.to_string());
     }
 
-    DBUG_EXECUTE_IF(
-            "TxnManager.commit_txn_random_failed",
-            if (rand() % 100 < (100 * dp->param("percent", 0.5))) {
-                return Status::InternalError("debug commit txn random failed");
-            });
+    DBUG_EXECUTE_IF("TxnManager.commit_txn_random_failed", {
+        if (rand() % 100 < (100 * dp->param("percent", 0.5))) {

Review Comment:
   warning: 0.5 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
           if (rand() % 100 < (100 * dp->param("percent", 0.5))) {
                                                          ^
   ```
   



##########
be/src/olap/task/engine_publish_version_task.cpp:
##########
@@ -91,6 +92,17 @@ Status EnginePublishVersionTask::finish() {
     int64_t transaction_id = _publish_version_req.transaction_id;
     OlapStopWatch watch;
     VLOG_NOTICE << "begin to process publish version. transaction_id=" << 
transaction_id;
+    DBUG_EXECUTE_IF("EnginePublishVersionTask.finish", {
+        if (rand() % 100 < (100 * dp->param("percent", 0.5))) {

Review Comment:
   warning: 0.5 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
           if (rand() % 100 < (100 * dp->param("percent", 0.5))) {
                                                          ^
   ```
   



##########
be/src/olap/txn_manager.cpp:
##########
@@ -309,6 +325,17 @@
     if (!is_recovery) {
         Status save_status = RowsetMetaManager::save(meta, tablet_uid, 
rowset_ptr->rowset_id(),
                                                      
rowset_ptr->rowset_meta()->get_rowset_pb());
+        DBUG_EXECUTE_IF("TxnManager.RowsetMetaManager::save", {
+            if (rand() % 100 < (100 * dp->param("percent", 0.5))) {

Review Comment:
   warning: 0.5 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
               if (rand() % 100 < (100 * dp->param("percent", 0.5))) {
                                                              ^
   ```
   



##########
be/src/olap/txn_manager.cpp:
##########
@@ -382,13 +409,36 @@
                 "tablet={}",
                 partition_id, transaction_id, tablet_info.to_string());
     }
+    
DBUG_EXECUTE_IF("TxnManager.publish_txn_random_failed_before_save_rs_meta", {
+        if (rand() % 100 < (100 * dp->param("percent", 0.5))) {

Review Comment:
   warning: 0.5 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
           if (rand() % 100 < (100 * dp->param("percent", 0.5))) {
                                                          ^
   ```
   



##########
be/src/olap/txn_manager.cpp:
##########
@@ -382,13 +409,36 @@
                 "tablet={}",
                 partition_id, transaction_id, tablet_info.to_string());
     }
+    
DBUG_EXECUTE_IF("TxnManager.publish_txn_random_failed_before_save_rs_meta", {
+        if (rand() % 100 < (100 * dp->param("percent", 0.5))) {
+            
LOG_WARNING("TxnManager.publish_txn_random_failed_before_save_rs_meta random 
failed");
+            return Status::InternalError("debug publish txn before save rs 
meta random failed");
+        }
+        if (auto wait = dp->param<int>("wait", 0); wait > 0) {
+            
LOG_WARNING("TxnManager.publish_txn_random_failed_before_save_rs_meta")
+                    .tag("wait ms", wait);
+            std::this_thread::sleep_for(std::chrono::milliseconds(wait));
+        }
+    });
 
     /// Step 2: make rowset visible
     // save meta need access disk, it maybe very slow, so that it is not in 
global txn lock
     // it is under a single txn lock
     // TODO(ygl): rowset is already set version here, memory is changed, if 
save failed
     // it maybe a fatal error
     rowset->make_visible(version);
+
+    DBUG_EXECUTE_IF("TxnManager.publish_txn_random_failed_after_save_rs_meta", 
{
+        if (rand() % 100 < (100 * dp->param("percent", 0.5))) {

Review Comment:
   warning: 0.5 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
           if (rand() % 100 < (100 * dp->param("percent", 0.5))) {
                                                          ^
   ```
   



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