summaryrefslogtreecommitdiff
path: root/storage/ndb/src/kernel/blocks/dbdict/DictLock.txt
blob: 72e23ed15a512a4377ed7b52f96fa31372e5f45b (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Lock master DICT against schema operations

Implementation
--------------

[ see comments in Dbdict.hpp ]

Use case: Node startup INR / NR
-------------------------------

Master DICT (like any block) keeps list of alive nodes (c_aliveNodes).
These are participants in schema ops.

(1) c_aliveNodes is initialized when DICT starts
    in sp3 in READ_NODESCONF from CNTR

(2) when slave node fails (in any sp of the slave node)
    it is removed from c_aliveNodes in NODE_FAILREP

(3) when slave starts, it is added to c_aliveNodes
    in sp4 of the starting node in INCL_NODEREQ

Slave DIH locks master DICT in sp2 and releases the lock when started.
Based on the constraints:

- the lock is taken when master DICT is known
  DIH reads this in sp2 in READ_NODESCONF

- the lock is taken before (3)

- the lock is taken before copying starts and held until it is done
  in sp4 DIH meta, DICT meta, tuple data

- on INR in sp2 in START_PERMREQ the LCP info of the slave is erased
  in all DIH in invalidateNodeLCP() - not safe under schema ops

Signals:

All but DICT_LOCK are standard v5.0 signals.
s=starting node, m=master, a=all participants, l=local block.

* sp2 - DICT_LOCK and START_PERM

DIH/s
    DICT_LOCK_REQ
        DICT/m
    DICT_LOCK_CONF
DIH/s
    START_PERMREQ
        DIH/m
            START_INFOREQ
                DIH/a
                    invalidateNodeLCP() if INR
                DIH/a
            START_INFOCONF
        DIH/m
    START_PERMCONF
DIH/s

* sp4 - START_ME (copy metadata, no changes)

DIH/s
    START_MEREQ
        DIH/m
            COPY_TABREQ
                DIH/s
            COPY_TABCONF
        DIH/m
            DICTSTARTREQ
                DICT/s
                    GET_SCHEMA_INFOREQ
                        DICT/m
                    SCHEMA_INFO
                DICT/s
            DICTSTARTCONF
        DIH/m
            INCL_NODEREQ
                DIH/a
                    INCL_NODEREQ
                        ANY/l
                    INCL_NODECONF
                DIH/a
            INCL_NODECONF
        DIH/m
    START_MECONF
DIH/s

* (copy data, omitted)

* SL_STARTED - release DICT lock

CNTR/s
    NODE_START_REP
        DIH/s
            DICT_UNLOCK_ORD
                DICT/m

# vim: set et sw=4: