Skip to content

Commit

Permalink
modify case
Browse files Browse the repository at this point in the history
  • Loading branch information
mymeiyi committed May 15, 2024
1 parent 1b694f3 commit 4c9df64
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,20 @@ suite("txn_insert_concurrent_insert") {
def url = getServerPrepareJdbcUrl(context.config.jdbcUrl, dbName).replace("&useServerPrepStmts=true", "") + "&useLocalSessionState=true"
logger.info("url: ${url}")

def sqls = [
"begin",
"insert into ${tableName}_0 select * from ${tableName}_1 where L_ORDERKEY < 30000;",
"insert into ${tableName}_1 select * from ${tableName}_2 where L_ORDERKEY > 500000;",
"insert into ${tableName}_0 select * from ${tableName}_2 where L_ORDERKEY < 30000;",
"commit"
]
def txn_insert = { ->
try (Connection conn = DriverManager.getConnection(url, context.config.jdbcUser, context.config.jdbcPassword);
Statement stmt = conn.createStatement()) {
stmt.execute("begin")
stmt.execute("insert into ${tableName}_0 select * from ${tableName}_1 where L_ORDERKEY < 30000;")
stmt.execute("insert into ${tableName}_1 select * from ${tableName}_2 where L_ORDERKEY > 500000;")
stmt.execute("insert into ${tableName}_0 select * from ${tableName}_2 where L_ORDERKEY < 30000;")
stmt.execute("commit")
for (def sql : sqls) {
logger.info(Thread.currentThread().getName() + " execute sql: " + sql)
stmt.execute(sql)
}
logger.info("finish txn insert for " + Thread.currentThread().getName())
} catch (Throwable e) {
logger.error("txn insert failed", e)
Expand Down

0 comments on commit 4c9df64

Please sign in to comment.