Home

Xids

Xids is a term used in distributed transaction processing to describe transaction identifiers that uniquely identify a global transaction across multiple resource managers. The concept is central to two-phase commit protocols and to transaction managers that coordinate work across databases, message queues, and other resources.

An Xid is typically structured as three components: a formatId, a global transaction identifier (GTRID), and

The purpose of Xids is to provide a globally unique handle that a transaction manager can use

Xids appear in various environments that implement distributed transactions, including Java EE/JTA environments, database transaction managers,

See also XA, two-phase commit, Java Transaction API (JTA), and X/Open.

a
branch
qualifier
(BQUAL).
In
many
implementations,
the
formatId
is
an
integer,
while
the
GTRID
and
BQUAL
are
byte
arrays.
In
the
Java
ecosystem,
the
standard
interface
javax.transaction.xa.Xid
exposes
three
methods:
getFormatId(),
getGlobalTransactionId(),
and
getBranchQualifier().
Practical
limits
in
the
XA
model
place
maximum
lengths
on
the
GTRID
and
BQUAL,
often
around
64
bytes
each,
though
exact
limits
can
vary
by
specification
and
implementation.
to
coordinate
prepare,
commit,
and
rollback
actions
across
all
participating
resource
managers.
Each
participant
tracks
the
Xid
to
associate
its
local
work
with
the
correct
global
transaction
and
to
distinguish
between
different
branches
of
the
same
global
transaction.
and
message-oriented
middleware.
They
can
be
serialized
or
represented
in
different
formats
(hex,
base64,
or
raw
bytes)
depending
on
the
system,
but
the
underlying
idea
remains
the
same:
a
globally
unique
identifier
plus
a
branch
qualifier
to
identify
subtransactions.