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

ISPN-1525: Different transactions using same dummy XIDs #646

Closed
wants to merge 1 commit into from

Conversation

maniksurtani
Copy link
Member

Random rnd = new Random();
rnd.nextBytes(globalTransactionId);
rnd.nextBytes(branchQualifier);
initialize(globalTransactionId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manik, a UUID is 128 bits, and globalTransactionId is 64 and branchQualifier is 64. Wouldn't it be easier to create a single UUID and give the first 64 bits to the global transaction id and the other 64 bits to the branch qualifier?

The way you have it now, you're not taking full advantage of the 128 bits (you're taking only 64 bits of a UUID and giving it to a one of the instance variables) and so this leaves a gap, albeit small, for duplicates, doesn't it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I use a separate UUID for globalTransactionId and a separate one for branchQualifier.

UUIDs are 128 bits and the XID components are 64 bytes each. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups, my bad.

Btw, just remembered the pain of debugging this. We really need hex representation for byte[].

Quickly hacked this: https://gist.github.com/1370843 - creating a separate jira....

@galderz galderz closed this Nov 16, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants