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

Incorrect limbo transaction numbers [JDBC266] #313

Closed
firebird-automations opened this issue Aug 12, 2012 · 15 comments
Closed

Incorrect limbo transaction numbers [JDBC266] #313

firebird-automations opened this issue Aug 12, 2012 · 15 comments

Comments

@firebird-automations
Copy link

Submitted by: fabianobonin (fabianobonin)

The code below:

FBMaintenanceManager mm = new FBMaintenanceManager("PURE_JAVA");
mm.setHost("xxxx");
mm.setPort(3050);
mm.setDatabase("xxxx");
mm.setUser("sysdba");
mm.setPassword("xxxx");
mm.setLogger(System.out);
mm.listLimboTransactions();

produces this output:

1089469460

While the command below, executed in the same database:

gfix -list xxxx:xxxx -user sysdba -pass xxxx

produces this output:

Transaction 4255740 is in limbo.
Multidatabase transaction:
Host Site: REPLIC-ES
Transaction 4255740
has been prepared.
Remote Site: <removed>
Database Path: <removed>
Host Site: REPLIC-ES
Transaction 4966552
has been rolled back.
Remote Site: <removed>
Database Path: <removed>
Automated recovery would rollback this transaction.

Note that transaction numbers are different...

This is probably an hex conversion problem.

The number returned by jaybird (1089469460) in hex is 40EFFC14.
The number returned by gfix (4255740) in hex is 40EFFC.

So i presume jaybird is taking an extra byte from somewhere.

Fabiano

Commits: f8ddbde e0b2203 cf2d897 75862c0

@firebird-automations
Copy link
Author

Commented by: Roman Rokytskyy (rrokytskyy)

Which FB version do you use? The transaction number is decoded directly from the internal format stored in the database, so most likely the format was changed between the versions...

@firebird-automations
Copy link
Author

Commented by: fabianobonin (fabianobonin)

Using Firebird 2.5.1 here.

I presume Jaybird retrives the transaction number decoding RDB$TRANSACTIONS.RDB$TRANSACTION_DESCRIPTION.
Why is it doing that instead of taking it from RDB$TRANSACTIONS.RDB$TRANSACTION_ID?

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Jaybird retrieves this from the servicemanager, it does not query the RDB$TRANSACTIONS table.

I looked at the code and I do think the way it is decoding looks a bit weird:
- It will always restart a decode if it reads 0x13 (isc_spb_single_tra_id),
- it uses 0x00 as an end of transaction_id marker, which doesn't seem to be correct
- and as 0x14 is also isc_spb_multi_tra_id I suspect it is starting to read the next transaction info block.

It also looks like it is only capable of reading single transactions, not multi database transactions.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Version: Jaybird 2.2 [ 10053 ]

Version: Jaybird 2.1.6 [ 10285 ]

Fix Version: Jaybird 2.3 [ 10440 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 2.2.1 [ 10474 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Removed Jaybird 2.2.1 from fix versions, essentially this has always been broken.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 2.2.1 [ 10474 ] =>

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

assignee: Roman Rokytskyy [ rrokytskyy ] => Mark Rotteveel [ avalanche1979 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Committed fix to trunk, I would like to add a test that covers multi-site transactions, but I haven't found a way (yet) to create those using Jaybird. For now all existing tests pass.

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

To do: backport fix to Jaybird 2.2.2

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 2.2.2 [ 10480 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Committed backport to 2.2 branch.

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Resolved, created subtask to add multi-site transactions to tests

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment