Snapshot cloning

Registered by Alexey Kopytov

Implement ability to make a clone of a snapshot created by START TRANSACTION WITH CONSISTENT SNAPSHOT in another session.

Syntax:

START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION session_id;

Blueprint information

Status:
Complete
Approver:
Alexey Kopytov
Priority:
High
Drafter:
Alexey Kopytov
Direction:
Approved
Assignee:
Alexey Kopytov
Definition:
Approved
Series goal:
Accepted for 5.6
Implementation:
Implemented
Milestone target:
milestone icon 5.6.17-66.0
Started by
Alexey Kopytov
Completed by
Laurynas Biveinis

Sprints

Whiteboard

The patch extends START TRANSACTION WITH CONSISTENT SNAPSHOT with the
optional FROM SESSION clause:

START TRANSACTION WITH CONSISTENT SNAPSHOT FROM SESSION <session_id>;

When specified, all participating storage engines and binary log instead
of creating a new snapshot of data (or binary log coordinates), create a
copy of the snapshot which has been created by an active transaction in
the specified session. session_id is the session identifier reported in
the Id column of SHOW PROCESSLIST. The CONNECTION_ID() function returns
the identifier of the current session.

Currently snapshot cloning is only supported by XtraDB and the binary
log. As with the regular START TRANSACTION WITH CONSISTENT SNAPSHOT,
snapshot clones can only be created with the REPEATABLE READ isolation
level.

For XtraDB, a transaction with a cloned snapshot will only see data
visible or changed by the donor transaction. That is, the cloned
transaction will see no changes committed by transactions that started
after the donor transaction, not even changes made by itself. Note that
in case of chained cloning the donor transaction is the first one in the
chain. For example, if transaction A is cloned into transaction B, which
is in turn cloned into transaction C, the latter will have read view
from transaction A (i.e. the donor transaction). Therefore, it will see
changes made by transaction A, but not by transaction B.

For binary log, cloning means that Binlog_snapshot_file and
Binlog_snapshot_position variables implemented in
https://blueprints.launchpad.net/percona-server/+spec/enhancements-for-start-transaction-with-consistent
will always have the same values for both the cloned and the donor
transaction.

New server variables
--------------------

have_snapshot_cloning

This is a server variable implemented to help other utilities detect
if the server supports the FROM SESSION extension. When available, the
snapshot cloning feature and the syntax extension to START TRANSACTION
WITH CONSISTENT SNAPSHOT are supported by the server, and the variable
value is always YES.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.