summaryrefslogtreecommitdiff
path: root/storage/ndb/src/kernel/blocks/OptNR.txt
blob: 17e9a62bb0e6018cd2d6876d6e3866d2d6e2d1b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
*** Copy thread

  Scan rowids with GCP > starting nodes GCP
  Cases for different ROWID combinations

RI  Primary     Starting    Result
1   A           A           Update A
2   B           B*          Delete B* + Insert B
3   C           C*          Delete C* + Delete C + Insert C
                C
4   Deleted     D           Delete D
5   E           Deleted     Insert E
6   F           Deleted     Delete F + Insert F
                F
7   Deleted     Deleted     Update GCP

*** Ordinary operations
Op           Starting        Result
Insert A@1   A@1             Update A
Insert A@1   A@2             Delete A@2, Insert A@1
Insert A@1   1 busy, A@2     Delete 1, Delete A@2, Insert A@1
Insert A@1   1 busy          Delete 1, Insert A@1

Delete A@1   A@1             Delete A@1
Delete A@1   else            noop

Update A@1   A@1             Update A
Update A@1   else            noop

***

Rationale:

If copy has passed rowid, 
  then no ordinary operation should be a noop

If copy has not passed, 
  then it's ok to do a noop as copy will get there sooner or later

Copy may not end up in lock queue, as no lock is held on primary.
  therefore ordinary ops must be noops when rowid missmatch

When not scanning in rowid order (e.g. disk order) one must
1 make a second pass in rowid order
  - finding deletes and inserts (as 2)
2 mark all inserts "earlier" than current scan pos
  so they will be found during second pass

Note: Dealloc is performed first on backup then on primary