summaryrefslogtreecommitdiffstats
path: root/usr.sbin/afs/src/doc/prog-disco.texi
blob: 4b2a6fe8869d1afb5670025bffcb89faf022f9d7 (plain) (blame)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
@c Copyright (c) 2002 Kungliga Tekniska H�gskolan
@c (Royal Institute of Technology, Stockholm, Sweden).
@c All rights reserved.

@c $arla: prog-disco.texi,v 1.1 2002/05/27 13:08:31 lha Exp $

@cindex Disconected operation

@chapter Disco with arla

Disconnected operation of arla.

@section The Log

The binary log is written to a file. All entries are of variable size.
A entry is never removed from the log @pxref{Log entry optimization}.

@subsection One log entry

One log entry consists of a log header with magic cookie, opcode,
checksum, and length. The entry is is always 4 byte aligned in the
logfile.  The checksum is a simple one, its just to verify that for
data corruption hasn't occured and to make sure the entry is a valid
one.

@subsection Disconnected vs connected nodes

A FCacheNode is either a @dfn{disconnected node} or a @dfn{connected
node}. The later means that the node was created when arla was in
connected mode and thus (potentially) exist on the file server.

A disconnected node on the other hand was created when is disconnected
operation. A disconnected node always have one or more entries in the
log.

@subsection Log entry offset

The offset of the entry, a unsigned 32 bit number, is called
@dfn{disco_id}. Its stored in the FCacheNode so it can be updated when
there is a operation on this node. All nodes for a FCacheEntry are
single linked list (from the newest log entry to the oldest), the
optimizer uses this to modify all previous entries from a FCacheNode.

A FCacheNode with disco_id equal to 0 is a connected node that there
have been no disconnected operation made on.

The first entry in the log is a nop entry to make sure not a
log-offset that is for a ``real'' entry.

The limit of number of entries in the log are 2^32 / the size of the
largest entry since the offset is a 32 bit number.

@c @subsection Dump log / Backup of log
@c 
@c It should be possible to extract a dump of the current state of
@c disconnected operation (all adding operations that is). This is to
@c make a backup of all changes before reitegration.

@section Log entry optimization
@anchor{Log entry optimization}

To try to preserve bandwith when reinterating there are dependencies
between entries. First we try to avoid storing data to the fileserver
that was never meant to got there. For example a file that was created
and then removed in disconnected mode, ie @code{DISCO_HEADER_NOP} is
set in the flags field in the header.

@subsection Removal operations

When a node is removed and the node is a disconnected node, the all
previous entries are optizmied away by setting a flags in their entry
headers. This make this entry/nodes be ignored by the reintergration
code and never commited to the fileserver.

@subsection Moveing a disconnected node

If a disconnected node is moved, it will be created in the target
directory instead of first being created and then moved.

@subsection Storestatus and storedata

Also, all entries for one node storestate/storestatus are compressed
to one createnode (and if needed storedata).

@section data storage

@subsection common data types

  fid - VenusFid equivalent
  storestatus - AFSStoreStatus equivalent

@enumerate

@item
@code{nop}

  needs to be smaller or equal in size then the rest

  data storage:
    header
    flags
    fid

@item
@code{storedata}

  (truncation is a storedata)

  data storage:
    header
    fid
    storestatus
    size

@item
@code{storestatus}

  data storage:
    header
    fid
    storestatus

@item
@code{createfile}

  data storage:
    header
    parentfid
    fid
    storestatus
    name[AFSNAMEMAX]

@item
@code{createsymlink}

  data storage:
    header
    parentfid
    fid
    storestatus
    name[AFSNAMEMAX]
    targetname[AFSNAMEMAX]

@item
@code{createlink}

  data storage:
    header
    parentfid
    fid
    storestatus
    name[AFSNAMEMAX]
    targetfid

@item
@code{unlink}

  data storage:
    header
    parentfid
    fid /* dup info */
    name[AFSNAMEMAX]

@item
@code{createdir}

  data storage:
    header
    parentfid
    fid /* dup info */
    storestatus
    name[AFSNAMEMAX]

@item
@code{removedir}

  data storage:
    header
    parentfid
    fid /* dup info */
    name[AFSNAMEMAX]

@end enumerate

@section reintegration

@subsection Cook-book

@enumerate

@item

make sure first entry in the log is a nop entry

@item

if nop entry or @code{DISCO_HEADER_NOP} is set, continue to next

@item

the parent fid is transformed to a connected fid (if needed)
  it this failes, we are unhappy and save this node for collision
  recovery

@item

the fid is transformed to a connected fid (if needed)
  it this failes, we are unhappy and save this node for collision
  recovery

@item

operation is performed

@item

if there is change on a fid 

@enumerate

@item

update kernelhandle

@item

update fcachehandle

@item

update directory fid for this name (if needed)

@item 

transformed fids are stored in the transformation table

@end enumerate

@end enumerate