Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: investigate the hibernate test org.hibernate.jpa.test.emops.RemoveTest testUpdatedAndRemove #26799

Closed
BramGruneir opened this issue Jun 18, 2018 · 5 comments
Labels
A-tools-hibernate Issues that pertain to Hibernate integration. C-investigation Further steps needed to qualify. C-label will change.

Comments

@BramGruneir
Copy link
Member

Not sure of the root cause here, but here are the details.

This works when tested directly using two cockroach sql command lines, but the test fails.

create table Music (
  id int4 not null,
  name varchar(255),
  version int4,
  primary key (id)                                                                                                                                                                 );

insert into Music (name, version, id)                                                values ('classical', 0, 1);

transaction 1, open but don't commit it:

begin;
select id, name, version from music where id = 1;

transaction 2, while transaction 1 is still open:

update music set name = 'rap' where id = 1;

back to transaction 1:

delete from music where id = 1;
commit;

It correctly fails with

pq: restart transaction: HandledRetryableTxnError: TransactionRetryError: retry txn (RETRY_WRITE_TOO_OLD): "sql txn" id=0a60e9ee key=/Table/28924/1/1 rw=true pri=0.02814406 iso=SERIALIZABLE stat=PENDING epo=0 ts=1529342542.880056817,1 orig=1529342541.139508328,0 max=1529342541.139508328,0 wto=true rop=false seq=5

However, this completes incorrectly in:
org.hibernate.jpa.test.emops.RemoveTest testUpdatedAndRemove

From what I can tell, it looks like each statement was issued as a single transaction.

@BramGruneir BramGruneir added the A-tools-hibernate Issues that pertain to Hibernate integration. label Jun 18, 2018
@knz knz added the C-investigation Further steps needed to qualify. C-label will change. label Jun 19, 2018
@knz
Copy link
Contributor

knz commented Jun 19, 2018

Can you include a SQL trace of what is received from hibernate in CockroachDB, and in PostgreSQL for comparison? Thanks

@knz
Copy link
Contributor

knz commented Jun 30, 2018

@BramGruneir This issue is improperly qualified. It does neither state what is the deviation (difference between expected behavior and actual behavior) nor what action items should be carried out.

Unless you provide either (preferably both), we can't do anything with this.

@knz knz added the X-unactionable This was closed because it was unactionable. label Jun 30, 2018
@BramGruneir
Copy link
Member Author

BramGruneir commented Jul 2, 2018

The expected and actual behaviours are spelled out in the top issue.
The 2nd transaction should fail and it doesn't, because each statement was issued as a single transaction.

More investigation is required here.

@BramGruneir BramGruneir removed the X-unactionable This was closed because it was unactionable. label Jul 2, 2018
@knz
Copy link
Contributor

knz commented Jul 2, 2018

Then the title of the issue is wrong. I am renaming.

@knz knz changed the title sql: hibernate does not handle transactions correctly sql: investigate the hibernate test org.hibernate.jpa.test.emops.RemoveTest testUpdatedAndRemove Jul 2, 2018
@rafiss
Copy link
Collaborator

rafiss commented Jul 10, 2020

This test has been passing in Hibernate

@rafiss rafiss closed this as completed Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tools-hibernate Issues that pertain to Hibernate integration. C-investigation Further steps needed to qualify. C-label will change.
Projects
None yet
Development

No branches or pull requests

3 participants