You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by "liwei225 (via GitHub)" <gi...@apache.org> on 2023/10/20 08:08:00 UTC

[I] jdbc request always set autocommit=1 [jmeter]

liwei225 opened a new issue, #6090:
URL: https://github.com/apache/jmeter/issues/6090

   ### Expected behavior
   
   fix bug
   
   ### Actual behavior
   
   jdbc request always set autocommit=1
   
   ### Steps to reproduce the problem
   
   i wanna test transaction on mysql 8.0.20 .
   however, after opening a transaction, the next jdbc request always sets autocommit=1
   <img width="934" alt="image" src="https://github.com/apache/jmeter/assets/22341888/e5a4ff4d-ec3b-4b9d-983b-52e934ef587a">
   
   <img width="728" alt="image" src="https://github.com/apache/jmeter/assets/22341888/c29f048c-673a-414a-9098-ac95ed150700">
   
   <img width="681" alt="image" src="https://github.com/apache/jmeter/assets/22341888/296969a6-1a30-431c-aa67-52aac08682ef">
   
   <img width="770" alt="image" src="https://github.com/apache/jmeter/assets/22341888/e108ca49-f7a2-430f-8e1a-5faf0fa20308">
   
   
   mysql general_log:
   
   2023-10-20T08:02:11.701987Z        23 Query     SET autocommit=0
   
   after 5 sec ,i found next jdbc request[select_1] send [ set autocommit=1] before select statement
   
   2023-10-20T08:02:16.721626Z        23 Query     SET autocommit=1
   2023-10-20T08:02:16.741564Z        23 Query     SELECT @@session.transaction_isolation
   2023-10-20T08:02:16.744943Z        23 Query     SELECT @@session.transaction_isolation
   2023-10-20T08:02:16.750466Z        23 Query     select * from t1 limit 10
   2023-10-20T08:02:21.770572Z        23 Query     SELECT @@session.transaction_isolation
   2023-10-20T08:02:21.779301Z        23 Query     SELECT @@session.transaction_isolation
   2023-10-20T08:02:21.782025Z        23 Query     select * from t1 limit 10
   2023-10-20T08:02:26.800593Z        23 Query     SELECT @@session.transaction_isolation
   2023-10-20T08:02:26.811092Z        23 Query     SELECT @@session.transaction_isolation
   2023-10-20T08:02:26.829268Z        23 Quit
   
   ### JMeter Version
   
   5.6.2
   
   ### Java Version
   
   openjdk 17.0.2 2022-01-18
   
   ### OS Version
   
   macos


-- 
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: dev-unsubscribe@jmeter.apache.org.apache.org

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


Re: [I] jdbc request always set autocommit=1 [jmeter]

Posted by "FSchumacher (via GitHub)" <gi...@apache.org>.
FSchumacher commented on issue #6090:
URL: https://github.com/apache/jmeter/issues/6090#issuecomment-1775515848

   Have you tried to set `autocommit` to `false` in the JDBC Connection Configuration settings dialog above?


-- 
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: dev-unsubscribe@jmeter.apache.org

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


Re: [I] jdbc request always set autocommit=1 [jmeter]

Posted by "FSchumacher (via GitHub)" <gi...@apache.org>.
FSchumacher commented on issue #6090:
URL: https://github.com/apache/jmeter/issues/6090#issuecomment-1779477182

   Can you be more verbose here? What is not working and what did you do? (The first example you gave, had not set autocommit to off)


-- 
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: dev-unsubscribe@jmeter.apache.org

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


Re: [I] jdbc request always set autocommit=1 [jmeter]

Posted by "liwei225 (via GitHub)" <gi...@apache.org>.
liwei225 commented on issue #6090:
URL: https://github.com/apache/jmeter/issues/6090#issuecomment-1776392894

   @FSchumacher 
   yes, this is the only way to achieve transaction testing.
   but  it seems that jdbc request is not working as expected.


-- 
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: dev-unsubscribe@jmeter.apache.org

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


Re: [I] jdbc request always set autocommit=1 [jmeter]

Posted by "liwei225 (via GitHub)" <gi...@apache.org>.
liwei225 commented on issue #6090:
URL: https://github.com/apache/jmeter/issues/6090#issuecomment-1780446422

   @FSchumacher 
   For example, I would like to use two groups of transaction controllers within the same test plan, with one group using manual control for commit and the other using automatic commit.
   
   tran 1 should control by manual.
   tran 2 should inherit jdbc connection configuretion[autocommit = true]
   
   
   <img width="926" alt="image" src="https://github.com/apache/jmeter/assets/22341888/b02ac510-8f45-48c0-b0d0-e3552ced65dd">
   
    jdbc request supports set autocommit, but in the test plan, it cannot affect the next jdbc request autocommit state. 
    In other words, it seems that the query type AutoCommit(false) has no practical use anymore.
   <img width="872" alt="image" src="https://github.com/apache/jmeter/assets/22341888/0f0bf5b6-f069-4dbc-9c72-ee1a86b8da9d">
   
   


-- 
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: dev-unsubscribe@jmeter.apache.org

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


Re: [I] jdbc request always set autocommit=1 [jmeter]

Posted by "FSchumacher (via GitHub)" <gi...@apache.org>.
FSchumacher commented on issue #6090:
URL: https://github.com/apache/jmeter/issues/6090#issuecomment-1781784483

   Well, I think I know, what happens. We set the default autocommit value on the database pool. The pool initializes every connection we borrow from it with that value. When we set (default) autocommit to true and use the sampler autocommit (false), we set the autocommit flag for the borrowed connection, which immediately gets returned (with autocommit false). The next borrow operation re-sets the autocommit status to the default one.
   To work around this behaviour, you can use a JSR 223 Sampler which sets the default value for autocommit to `null`. That will keep the autocommit status on the connections through their entire lifetime.
   Note, that you will still have to set it for every connection the pool contains.
   The script for a database pool named `db` would look like
   ```groovy
   def dataSource = vars.getObject("db").configuredDataSource
   
   dataSource.defaultAutoCommit = null
   dataSource.autoCommitOnReturn = false
   ```
   This script should be the called before any other JDBC Sampler.
   I believe the JDBC Connection Config element should allow for `null`(or empty) value for the default autocommit value.


-- 
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: dev-unsubscribe@jmeter.apache.org

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