This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new f4afcae4528 [case](regression) Stream load 2pc exceptions (#27804)
f4afcae4528 is described below

commit f4afcae4528ddb53dcecafb7bd5c2f1805724f1a
Author: HowardQin <[email protected]>
AuthorDate: Fri Dec 1 22:27:40 2023 +0800

    [case](regression) Stream load 2pc exceptions (#27804)
    
    Co-authored-by: qinhao <[email protected]>
---
 .../stream_load/test_stream_load_properties.out    |  28 ++++++
 .../stream_load/test_stream_load_properties.groovy | 104 ++++++++++++++++++++-
 2 files changed, 128 insertions(+), 4 deletions(-)

diff --git 
a/regression-test/data/load_p0/stream_load/test_stream_load_properties.out 
b/regression-test/data/load_p0/stream_load/test_stream_load_properties.out
index fee86d3e58b..055252d803e 100644
--- a/regression-test/data/load_p0/stream_load/test_stream_load_properties.out
+++ b/regression-test/data/load_p0/stream_load/test_stream_load_properties.out
@@ -336,6 +336,10 @@
 
 -- !sql_merge_type --
 
+-- !sql_2pc_invalid_txnid --
+
+-- !sql_2pc_invalid_operation --
+
 -- !sql_2pc --
 
 -- !sql_2pc_abort --
@@ -362,6 +366,10 @@
 90     2023-08-27      true    22      16456   -1476824962     
-3279894870153540825    8990195191470116763     26651.906       
2.06860148942546E8      -99999999.9     -99999999.9     2022-10-07T03:11:03     
2023-03-18      2023-04-15T00:38:33     T       L       
QW0GQ3GoMtHgxPQOWGfVaveynahNpsNs09siMFA1OtO6QEDBQTdivmGyq7bFzejAqwbbVQQpREAmeLjcFSXLnQuou2KbwYD
 
{"company":"Apple","products":[{"name":"iPhone","price":1000},{"name":"MacBook","price":1500}]}
 true    1       2       3       4       5       6.0     7.0     888888888      
 999999999       2023-08-24      2023-08-24T12:00        2023-08-24      
2023-08-24T12:00        我能吞下玻璃而不伤身体      [...]
 91     2023-08-27      true    90      2465    702240964       
6373830997821598984     305860046137409400      15991.356       
1.599972327386147E9     -99999999.9     \N      2023-04-26T19:31:10     
2023-07-21      \N      2               
B7YKYBYT8w0YC926bZ8Yz1VzyiWw2NWDAiTlEoPVyz9AXGti2Npg1FxWqWk4hEaALw0ZBSuiAIPj41lq36g5QRpPmAjNPK
  {"fruit":"apple","color":"red","qty":5,"price":2.5}     true    1       2     
  3       4       5       6.0     7.0     888888888       999999999       
2023-08-24      2023-08-24T12:00        2023-08-24      2023-08-24T12:00        
我能吞下玻璃而不伤身体     我能吞下玻璃而不伤身体     我能吞下玻璃而不伤身体     \N
 
+-- !sql_2pc_invalid_txnid --
+
+-- !sql_2pc_invalid_operation --
+
 -- !sql_2pc --
 
 -- !sql_2pc_abort --
@@ -388,6 +396,10 @@
 90     2023-08-27      true    22      16456   -1476824962     
-3279894870153540825    8990195191470116763     26651.906       
2.06860148942546E8      -99999999.9     -99999999.9     2022-10-07T03:11:03     
2023-03-18      2023-04-15T00:38:33     T       L       
QW0GQ3GoMtHgxPQOWGfVaveynahNpsNs09siMFA1OtO6QEDBQTdivmGyq7bFzejAqwbbVQQpREAmeLjcFSXLnQuou2KbwYD
 
{"company":"Apple","products":[{"name":"iPhone","price":1000},{"name":"MacBook","price":1500}]}
 true    1       2       3       4       5       6.0     7.0     888888888      
 999999999       2023-08-24      2023-08-24T12:00        2023-08-24      
2023-08-24T12:00        我能吞下玻璃而不伤身体      [...]
 91     2023-08-27      true    90      2465    702240964       
6373830997821598984     305860046137409400      15991.356       
1.599972327386147E9     -99999999.9     \N      2023-04-26T19:31:10     
2023-07-21      \N      2               
B7YKYBYT8w0YC926bZ8Yz1VzyiWw2NWDAiTlEoPVyz9AXGti2Npg1FxWqWk4hEaALw0ZBSuiAIPj41lq36g5QRpPmAjNPK
  {"fruit":"apple","color":"red","qty":5,"price":2.5}     true    1       2     
  3       4       5       6.0     7.0     888888888       999999999       
2023-08-24      2023-08-24T12:00        2023-08-24      2023-08-24T12:00        
我能吞下玻璃而不伤身体     我能吞下玻璃而不伤身体     我能吞下玻璃而不伤身体     \N
 
+-- !sql_2pc_invalid_txnid --
+
+-- !sql_2pc_invalid_operation --
+
 -- !sql_2pc --
 
 -- !sql_2pc_abort --
@@ -414,6 +426,10 @@
 90     2023-08-27      true    22      16456   -1476824962     
-3279894870153540825    8990195191470116763     26651.906       
2.06860148942546E8      -99999999.9     -99999999.9     2022-10-07T03:11:03     
2023-03-18      2023-04-15T00:38:33     T       L       
QW0GQ3GoMtHgxPQOWGfVaveynahNpsNs09siMFA1OtO6QEDBQTdivmGyq7bFzejAqwbbVQQpREAmeLjcFSXLnQuou2KbwYD
 
{"company":"Apple","products":[{"name":"iPhone","price":1000},{"name":"MacBook","price":1500}]}
 true    1       2       3       4       5       6.0     7.0     888888888      
 999999999       2023-08-24      2023-08-24T12:00        2023-08-24      
2023-08-24T12:00        我能吞下玻璃而不伤身体      [...]
 91     2023-08-27      true    90      2465    702240964       
6373830997821598984     305860046137409400      15991.356       
1.599972327386147E9     -99999999.9     \N      2023-04-26T19:31:10     
2023-07-21      \N      2               
B7YKYBYT8w0YC926bZ8Yz1VzyiWw2NWDAiTlEoPVyz9AXGti2Npg1FxWqWk4hEaALw0ZBSuiAIPj41lq36g5QRpPmAjNPK
  {"fruit":"apple","color":"red","qty":5,"price":2.5}     true    1       2     
  3       4       5       6.0     7.0     888888888       999999999       
2023-08-24      2023-08-24T12:00        2023-08-24      2023-08-24T12:00        
我能吞下玻璃而不伤身体     我能吞下玻璃而不伤身体     我能吞下玻璃而不伤身体     \N
 
+-- !sql_2pc_invalid_txnid --
+
+-- !sql_2pc_invalid_operation --
+
 -- !sql_2pc --
 
 -- !sql_2pc_abort --
@@ -440,6 +456,10 @@
 90     2023-08-27      true    22      16456   -1476824962     
-3279894870153540825    8990195191470116763     26651.906       
2.06860148942546E8      -99999999.9     -99999999.9     2022-10-07T03:11:03     
2023-03-18      2023-04-15T00:38:33     T       L       
QW0GQ3GoMtHgxPQOWGfVaveynahNpsNs09siMFA1OtO6QEDBQTdivmGyq7bFzejAqwbbVQQpREAmeLjcFSXLnQuou2KbwYD
 
{"company":"Apple","products":[{"name":"iPhone","price":1000},{"name":"MacBook","price":1500}]}
 \N      \N      \N      true    1       2       3       4       5       6.0    
 7.0     888888888       999999999       2023-08-24      2023-08-24T12:00       
 2023-08-24      2023-08-24T12:00        我能吞 [...]
 91     2023-08-27      true    90      2465    702240964       
6373830997821598984     305860046137409400      15991.356       
1.599972327386147E9     -99999999.9     \N      2023-04-26T19:31:10     
2023-07-21      \N      2               
B7YKYBYT8w0YC926bZ8Yz1VzyiWw2NWDAiTlEoPVyz9AXGti2Npg1FxWqWk4hEaALw0ZBSuiAIPj41lq36g5QRpPmAjNPK
  {"fruit":"apple","color":"red","qty":5,"price":2.5}     \N      \N      \N    
  true    1       2       3       4       5       6.0     7.0     888888888     
  999999999       2023-08-24      2023-08-24T12:00        2023-08-24      
2023-08-24T12:00        我能吞下玻璃而不伤身体     我能吞下玻璃而不伤身体     我能吞下玻璃而不伤身体     \N      
\N      \N      \N
 
+-- !sql_2pc_invalid_txnid --
+
+-- !sql_2pc_invalid_operation --
+
 -- !sql_2pc --
 
 -- !sql_2pc_abort --
@@ -466,6 +486,10 @@
 84     [0, 0, 0, 0, 0, 0]      [-10, -10, -10, -10, -10, -10]  [9493, 9493, 
9493, 9493, 9493, 9493]    [-547874696, -547874696, -547874696, -547874696, 
-547874696, -547874696]        [-115057683458952756, -115057683458952756, 
-115057683458952756, -115057683458952756, -115057683458952756, 
-115057683458952756]  [4473017779279230085, 4473017779279230085, 
4473017779279230085, 4473017779279230085, 4473017779279230085, 
4473017779279230085]  [13718.372, 13718.372, 13718.372, 13718.372, 13718.372] 
[-978213266.02697,  [...]
 88     [1, 1, 1, 1, 1, 1]      [23, 23, 23, 23, 23, 23]        [14833, 14833, 
14833, 14833, 14833, 14833]      [2017339015, 2017339015, 2017339015, 
2017339015, 2017339015, 2017339015]        [7437673973249797930, 
7437673973249797930, 7437673973249797930, 7437673973249797930, 
7437673973249797930, 7437673973249797930]  [-5508026584283164347, 
-5508026584283164347, -5508026584283164347, -5508026584283164347, 
-5508026584283164347, -5508026584283164347]    [-29817.77, -29817.77, 
-29817.77, -29817.77, -29817.77] [-1646754251. [...]
 
+-- !sql_2pc_invalid_txnid --
+
+-- !sql_2pc_invalid_operation --
+
 -- !sql_2pc --
 
 -- !sql_2pc_abort --
@@ -490,6 +514,10 @@
 84     [0, 0, 0, 0, 0, 0]      [-10, -10, -10, -10, -10, -10]  [9493, 9493, 
9493, 9493, 9493, 9493]    [-547874696, -547874696, -547874696, -547874696, 
-547874696, -547874696]        [-115057683458952756, -115057683458952756, 
-115057683458952756, -115057683458952756, -115057683458952756, 
-115057683458952756]  [4473017779279230085, 4473017779279230085, 
4473017779279230085, 4473017779279230085, 4473017779279230085, 
4473017779279230085]  [13718.372, 13718.372, 13718.372, 13718.372, 13718.372] 
[-978213266.02697,  [...]
 88     [1, 1, 1, 1, 1, 1]      [23, 23, 23, 23, 23, 23]        [14833, 14833, 
14833, 14833, 14833, 14833]      [2017339015, 2017339015, 2017339015, 
2017339015, 2017339015, 2017339015]        [7437673973249797930, 
7437673973249797930, 7437673973249797930, 7437673973249797930, 
7437673973249797930, 7437673973249797930]  [-5508026584283164347, 
-5508026584283164347, -5508026584283164347, -5508026584283164347, 
-5508026584283164347, -5508026584283164347]    [-29817.77, -29817.77, 
-29817.77, -29817.77, -29817.77] [-1646754251. [...]
 
+-- !sql_2pc_invalid_txnid --
+
+-- !sql_2pc_invalid_operation --
+
 -- !sql_2pc --
 
 -- !sql_2pc_abort --
diff --git 
a/regression-test/suites/load_p0/stream_load/test_stream_load_properties.groovy 
b/regression-test/suites/load_p0/stream_load/test_stream_load_properties.groovy
index fe0c0eef869..073d464c544 100644
--- 
a/regression-test/suites/load_p0/stream_load/test_stream_load_properties.groovy
+++ 
b/regression-test/suites/load_p0/stream_load/test_stream_load_properties.groovy
@@ -29,6 +29,7 @@ import org.apache.http.protocol.HttpContext;
 import org.apache.http.util.EntityUtils;
 import org.apache.http.client.RedirectStrategy;
 import org.apache.http.impl.client.LaxRedirectStrategy;
+import org.codehaus.groovy.runtime.IOGroovyMethods
 
 suite("test_stream_load_properties", "p0") {
 
@@ -526,6 +527,7 @@ suite("test_stream_load_properties", "p0") {
                             throw new IllegalStateException("Expect backend 
stream load response code is 200, " +
                                     "but meet ${respCode}\nbody: ${body}")
                         }
+                        return body
                     }
                 }
             } catch (Throwable t) {
@@ -541,8 +543,103 @@ suite("test_stream_load_properties", "p0") {
             sql new 
File("""${context.file.parent}/ddl/${tableName}_create.sql""").text
 
             String txnId
+            def tableName1 =  "stream_load_" + tableName
+            // Invalid txn_id 1
             streamLoad {
-                table "stream_load_" + tableName
+                table tableName1
+                set 'column_separator', '|'
+                set 'columns', columns[i]
+                set 'two_phase_commit', 'true'
+                file files[i]
+                time 10000 // limit inflight 10s
+
+                check { result, exception, startTime, endTime ->
+                    if (exception != null) {
+                        throw exception
+                    }
+                    log.info("Stream load result: ${result}".toString())
+                    def json = parseJson(result)
+                    txnId = json.TxnId
+                    assertEquals("success", json.Status.toLowerCase())
+                    assertEquals(20, json.NumberTotalRows)
+                    assertEquals(20, json.NumberLoadedRows)
+                    assertEquals(0, json.NumberFilteredRows)
+                    assertEquals(0, json.NumberUnselectedRows)
+                }
+            }
+            txnId = "ABCxyz"
+            def body = do_streamload_2pc.call(txnId, "commit", tableName1)
+            assertEquals("internal_error", 
parseJson(body).status.toLowerCase())
+            assertTrue(parseJson(body).msg.toLowerCase().contains("stoull"))
+
+            // Invalid txn_id 2
+            streamLoad {
+                table tableName1
+                set 'column_separator', '|'
+                set 'columns', columns[i]
+                set 'two_phase_commit', 'true'
+                file files[i]
+                time 10000 // limit inflight 10s
+
+                check { result, exception, startTime, endTime ->
+                    if (exception != null) {
+                        throw exception
+                    }
+                    log.info("Stream load result: ${result}".toString())
+                    def json = parseJson(result)
+                    txnId = json.TxnId
+                    assertEquals("success", json.Status.toLowerCase())
+                    assertEquals(20, json.NumberTotalRows)
+                    assertEquals(20, json.NumberLoadedRows)
+                    assertEquals(0, json.NumberFilteredRows)
+                    assertEquals(0, json.NumberUnselectedRows)
+                }
+            }
+            txnId += "100ABC"
+            body = do_streamload_2pc.call(txnId, "commit", tableName1)
+            assertEquals("analysis_error", 
parseJson(body).status.toLowerCase())
+            assertTrue(parseJson(body).msg.toLowerCase().contains("not found"))
+
+            if (i <= 3) {
+                qt_sql_2pc_invalid_txnid "select * from ${tableName1} order by 
k00,k01"
+            } else {
+                qt_sql_2pc_invalid_txnid "select * from ${tableName1} order by 
k00"
+            }
+
+            // Operation other than commit or abort
+            streamLoad {
+                table tableName1
+                set 'column_separator', '|'
+                set 'columns', columns[i]
+                set 'two_phase_commit', 'true'
+                file files[i]
+                time 10000 // limit inflight 10s
+
+                check { result, exception, startTime, endTime ->
+                    if (exception != null) {
+                        throw exception
+                    }
+                    log.info("Stream load result: ${result}".toString())
+                    def json = parseJson(result)
+                    txnId = json.TxnId
+                    assertEquals("success", json.Status.toLowerCase())
+                    assertEquals(20, json.NumberTotalRows)
+                    assertEquals(20, json.NumberLoadedRows)
+                    assertEquals(0, json.NumberFilteredRows)
+                    assertEquals(0, json.NumberUnselectedRows)
+                }
+            }
+            body = do_streamload_2pc.call(txnId, "invalidop", tableName1)
+            assertEquals("internal_error", 
parseJson(body).status.toLowerCase())
+            assertTrue(parseJson(body).msg.toLowerCase().contains("transaction 
operation should be 'commit' or 'abort'"))            
+            if (i <= 3) {
+                qt_sql_2pc_invalid_operation "select * from ${tableName1} 
order by k00,k01"
+            } else {
+                qt_sql_2pc_invalid_operation "select * from ${tableName1} 
order by k00"
+            }
+
+            streamLoad {
+                table tableName1
                 set 'column_separator', '|'
                 set 'columns', columns[i]
                 set 'two_phase_commit', 'true'
@@ -564,7 +661,6 @@ suite("test_stream_load_properties", "p0") {
                 }
             }
 
-            def tableName1 =  "stream_load_" + tableName
             if (i <= 3) {
                 qt_sql_2pc "select * from ${tableName1} order by k00,k01"
             } else {
@@ -580,7 +676,7 @@ suite("test_stream_load_properties", "p0") {
             }
 
             streamLoad {
-                table "stream_load_" + tableName
+                table tableName1
                 set 'column_separator', '|'
                 set 'columns', columns[i]
                 set 'two_phase_commit', 'true'
@@ -616,7 +712,7 @@ suite("test_stream_load_properties", "p0") {
                     break
                 }
                 if (count >= 60) {
-                    log.error("stream load commit can not visible for long 
time")
+                    log.error("stream load commit is not visible for long 
time")
                     assertEquals(20, res[0][0])
                     break
                 }


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

Reply via email to