Project

General

Profile

Rados - multi-object transaction support » History » Version 16

Li Wang, 06/15/2015 11:56 AM

1 1 Li Wang
h1. Multi-object transaction support
2 2 Li Wang
3
*Summary*
4
This is for multi-object transaction support.
5
6
*Owners*
7
8
Li Wang (Ubuntukylin)
9 3 Li Wang
Yunchuan Wen (Ubuntukylin)
10 2 Li Wang
Name
11
12
*Interested Parties*
13
If you are interested in contributing to this blueprint, or want to be a "speaker" during the Summit session, list your name here.
14
Name (Affiliation)
15
Name (Affiliation)
16
Name
17
18
*Current Status*
19
Please describe the current status of Ceph as it relates to this blueprint.  Is there something that this replaces?  Are there current features that are related?
20
21
*Detailed Description*
22 8 Li Wang
23
Algorithm
24
25 1 Li Wang
(1) Allow client to define the following struct, 
26
struct MultiObjectTransaction {
27 8 Li Wang
> map<hobject_t, ObjectWriteOperation> object_ops;
28
> hobject_t master;
29 1 Li Wang
};
30 7 Li Wang
based on this, client could send a group of ops through MOSDOp to the PG coressponding to master object, call it MASTER
31 5 Li Wang
32 7 Li Wang
(2) Master receive MOSDOp from client, extract ObjectWriteOperations by PGs, and send them to corresponding PGs, call them SLAVE
33 1 Li Wang
34 7 Li Wang
(3) SLAVE receive MOSDOp from MASTER, if there are pending conventional single-object transactions with operations on the same object, wait until them finished; If there are pending multi-object transactions with the operations on the same object, return EAGAIN (we can not wait here, otherwise may dead lock, see http://article.gmane.org/gmane.comp.file-systems.ceph.devel/23783); Otherwise, contruct the transaction in the conventional way, return MASTER PG PREPARE_ACK, if error occured, for example, a 'read-then-comparation' failed, return MASTER error
35 1 Li Wang
36 6 Li Wang
(4) If MASTER receive error from SLAVE, it send ROLLBACK to all SLAVES, cancel the transaction, return client error
37
38
(5) MASTER collect all PREPARE_ACK, send SLAVES PREPARE_COMMIT
39
40
(6) SLAVE receive PREPARE_COMMIT from MASTER, write pending transaction into PG metadata, return MASTER PREPARE_COMMIT_ACK
41
42 7 Li Wang
(7) MASTER collect all PREPARE_COMMIT_ACK, construct a transaction, including a write to PG metadata to indicat the transaction COMMITTING, and the writes operations on its own data objects, submit the transaction to ObjectStore, then return client ACK, enable client to return from write operation, and send SLAVES COMMIT 
43 6 Li Wang
44 7 Li Wang
(8) SLAVE receive COMMIT, submit the pending transaction to ObjectStore, after the transaction finished (written to the real objects), delete the transaction from PG metadata, return MASTER COMMIT_ACK
45 6 Li Wang
46 1 Li Wang
(9) MASTER collect COMMIT_ACK, return client COMMIT, to indicate the transaction has been really finished, enable client to do read, delete the transaction from the PG metadata
47 6 Li Wang
48 8 Li Wang
Error Process
49 1 Li Wang
50 8 Li Wang
(1) SLAVE down
51 14 Li Wang
MASTER could be aware of SLAVE down by OSDMAP, and start a super-peering (inter-PG peering, in constrast to intra-PG peering) to ask SLAVE's state after the SLAVE PG has returned to active-and-clean by conventional peering, and process according to the following different situations,
52 11 Li Wang
> (a) No transaction found in SLAVE's PG metadata
53
> > (1) If MASTER not in COMMITTING, MASTER resend SLAVE MOSDOp, let SLAVE restart from Step (3) as described above;
54
> > (2) If MASTER in COMMITTING, that imply SLAVE has finished Step (6), and finished the submittion of transaction from PG metadata to its ultimate location, then MASTER do nothing
55
> (b) Transaction found in SLAVE's PG metadata
56
> >  (1) MASTER send SLAVE COMMIT, let SLAVE restart from Step (8)
57 14 Li Wang
on the other hand, when SLAVE recover from down, if it found transaction in its PG metadata, then it will also start a super-peering to ask MASTER's state, and process according to the following different situations,
58
> (a) MASTER know nothing about the transaction, which imply that MASTER has just also recovered from down, and lost all the in memory transaction informations, then SLAVE rollback;
59 11 Li Wang
> (b) MASTER know this transaction, then MASTER will direct SLAVE to finish the transaction as described above
60 5 Li Wang
61 13 Li Wang
(2) MASTER down
62 14 Li Wang
SLAVE could be aware of MASTER down by OSDMAP, and start a super-peering to ask MASTER's state after MASTER PG returned to active-and-clean, and process according to the following different situations,
63
> (a) MASTER know nothing about the transaction, imply MASTER has lost all its in memory transaction informations, SLAVE rollback;
64
> (b) MASTER in COMMITTING, then SLAVE restart from Step (8)
65 15 Li Wang
When MASTER recover from down, and found there exists transaction in COMMITTING, then start super-peering to all SLAVES, ask their state, and process according to the following different situations,
66 13 Li Wang
> (a) no transaction found in SLAVE's PG metadata, imply SLAVE has done, do nothing;
67
> (b) transaction found in SLAVE's PG metadata, send SLAVE COMMIT, let SLAVE restart from Step (8) 
68
69 16 Li Wang
Others
70
71
(a) A flag could be introduced, to decide whether need a special PREPARE_COMMIT step (step 3), this step is meant to do a fast deadlock and read-and-comparasion check, if it is not desirable, then Step 3 and 6 could be coalcesed, and Step 5 and 7 could be coalesced, but this has no impact on error process described above
72
73
(b) For Step 8, we could make use of Metadata-only-Journal mode to speedup the write from PG metadata to ultimate location
74 2 Li Wang
75
*Work items*
76
This section should contain a list of work tasks created by this blueprint.  Please include engineering tasks as well as related build/release and documentation work.  If this blueprint requires cleanup of deprecated features, please list those tasks as well.
77
78
*Coding tasks*
79
Task 1
80
Task 2
81
Task 3
82
83
*Build / release tasks*
84
Task 1
85
Task 2
86
Task 3
87
88
*Documentation tasks*
89
Task 1
90
Task 2
91
Task 3
92
93
*Deprecation tasks*
94
Task 1
95
Task 2
96
Task 3