@@ -151,6 +151,7 @@ suite("txn_insert_inject_case", "nonConcurrent") {
151
151
}
152
152
153
153
// 2. commit failed
154
+ sql """ truncate table ${ table} _0 """
154
155
def dbName = " regression_test_insert_p0"
155
156
def url = getServerPrepareJdbcUrl(context. config. jdbcUrl, dbName). replace(" &useServerPrepStmts=true" , " " ) + " &useLocalSessionState=true"
156
157
logger. info(" url: ${ url} " )
@@ -174,7 +175,7 @@ suite("txn_insert_inject_case", "nonConcurrent") {
174
175
statement. execute(" commit" )
175
176
assertTrue (false , " commit should fail" )
176
177
} catch (Exception e) {
177
- logger. error (" commit failed" , e);
178
+ logger. info (" commit failed " + e . getMessage())
178
179
}
179
180
} finally {
180
181
GetDebugPoint (). disableDebugPointForAllFEs(' DatabaseTransactionMgr.commitTransaction.failed' )
@@ -185,4 +186,37 @@ suite("txn_insert_inject_case", "nonConcurrent") {
185
186
assertEquals (1 , txn_info. size())
186
187
assertEquals (" ABORTED" , txn_info[0 ]. get(" TransactionStatus" ))
187
188
assertTrue (txn_info[0 ]. get(" Reason" ). contains(" DebugPoint: DatabaseTransactionMgr.commitTransaction.failed" ))
189
+
190
+ // 3. one txn publish failed
191
+ sql """ truncate table ${ table} _0 """
192
+ txn_id = 0
193
+ try (Connection conn = DriverManager . getConnection(url, context. config. jdbcUser, context. config. jdbcPassword);
194
+ Statement statement = conn. createStatement()) {
195
+ statement. execute(" begin" )
196
+ statement. execute(" insert into ${ table} _0 select * from ${ table} _1;" )
197
+ txn_id = get_txn_id_from_server_info((((StatementImpl ) statement). results). getServerInfo())
198
+ GetDebugPoint (). enableDebugPointForAllFEs(' PublishVersionDaemon.genPublishTask.failed' , [txnId :txn_id])
199
+ statement. execute(" insert into ${ table} _0 select * from ${ table} _2;" )
200
+ statement. execute(" commit" )
201
+
202
+ sql """ insert into ${ table} _0 values(100, 2.2, "abc", [], [])"""
203
+ sql """ insert into ${ table} _1 values(101, 2.2, "abc", [], [])"""
204
+ sql """ insert into ${ table} _2 values(102, 2.2, "abc", [], [])"""
205
+ order_qt_select2 """ select * from ${ table} _0"""
206
+ order_qt_select3 """ select * from ${ table} _1"""
207
+ order_qt_select4 """ select * from ${ table} _2"""
208
+ } finally {
209
+ GetDebugPoint (). disableDebugPointForAllFEs(' PublishVersionDaemon.genPublishTask.failed' )
210
+ def rowCount = 0
211
+ for (int i = 0 ; i < 20 ; i++ ) {
212
+ def result = sql " select count(*) from ${ table} _0"
213
+ logger. info(" rowCount: " + result + " , retry: " + i)
214
+ rowCount = result[0 ][0 ]
215
+ if (rowCount >= 7 ) {
216
+ break
217
+ }
218
+ sleep(1000 )
219
+ }
220
+ assertEquals (7 , rowCount)
221
+ }
188
222
}
0 commit comments