-
Notifications
You must be signed in to change notification settings - Fork 1
/
fsimage.proto
333 lines (303 loc) · 9.38 KB
/
fsimage.proto
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
option java_package = "org.apache.hadoop.hdfs.server.namenode";
option java_outer_classname = "FsImageProto";
package hadoop.hdfs.fsimage;
import "hdfs.proto";
import "acl.proto";
import "xattr.proto";
/**
* This file defines the on-disk layout of the file system image. The
* layout is defined by the following EBNF grammar, in which angle
* brackets mark protobuf definitions. (e.g., <FileSummary>)
*
* FILE := MAGIC SECTION* <FileSummary> FileSummaryLength
* MAGIC := 'HDFSIMG1'
* SECTION := <NameSystemSection> | ...
* FileSummaryLength := 4 byte int
*
* Some notes:
*
* The codec field in FileSummary describes the compression codec used
* for all sections. The fileheader is always uncompressed.
*
* All protobuf messages are serialized in delimited form, which means
* that there always will be an integer indicates the size of the
* protobuf message.
*
*/
message FileSummary {
// The version of the above EBNF grammars.
required uint32 ondiskVersion = 1;
// layoutVersion describes which features are available in the
// FSImage.
required uint32 layoutVersion = 2;
optional string codec = 3;
// index for each section
message Section {
optional string name = 1;
optional uint64 length = 2;
optional uint64 offset = 3;
}
repeated Section sections = 4;
}
/**
* Name: NS_INFO
*/
message NameSystemSection {
optional uint32 namespaceId = 1;
optional uint64 genstampV1 = 2;
optional uint64 genstampV2 = 3;
optional uint64 genstampV1Limit = 4;
optional uint64 lastAllocatedBlockId = 5;
optional uint64 transactionId = 6;
optional uint64 rollingUpgradeStartTime = 7;
}
/**
* Permission is serialized as a 64-bit long. [0:24):[25:48):[48:64) (in Big Endian).
* The first and the second parts are the string ids of the user and
* group name, and the last 16 bits are the permission bits.
*
* Name: INODE
*/
message INodeSection {
/**
* under-construction feature for INodeFile
*/
message FileUnderConstructionFeature {
optional string clientName = 1;
optional string clientMachine = 2;
}
message AclFeatureProto {
/**
* An ACL entry is represented by a 32-bit integer in Big Endian
* format. The bits can be divided in four segments:
* [0:2) || [2:26) || [26:27) || [27:29) || [29:32)
*
* [0:2) -- reserved for futute uses.
* [2:26) -- the name of the entry, which is an ID that points to a
* string in the StringTableSection.
* [26:27) -- the scope of the entry (AclEntryScopeProto)
* [27:29) -- the type of the entry (AclEntryTypeProto)
* [29:32) -- the permission of the entry (FsActionProto)
*
*/
repeated fixed32 entries = 2 [packed = true];
}
message XAttrCompactProto {
/**
*
* [0:2) -- the namespace of XAttr (XAttrNamespaceProto)
* [2:26) -- the name of the entry, which is an ID that points to a
* string in the StringTableSection.
* [26:27) -- namespace extension. Originally there were only 4 namespaces
* so only 2 bits were needed. At that time, this bit was reserved. When a
* 5th namespace was created (raw) this bit became used as a 3rd namespace
* bit.
* [27:32) -- reserved for future uses.
*/
required fixed32 name = 1;
optional bytes value = 2;
}
message XAttrFeatureProto {
repeated XAttrCompactProto xAttrs = 1;
}
message INodeFile {
optional uint32 replication = 1;
optional uint64 modificationTime = 2;
optional uint64 accessTime = 3;
optional uint64 preferredBlockSize = 4;
optional fixed64 permission = 5;
repeated BlockProto blocks = 6;
optional FileUnderConstructionFeature fileUC = 7;
optional AclFeatureProto acl = 8;
optional XAttrFeatureProto xAttrs = 9;
}
message INodeDirectory {
optional uint64 modificationTime = 1;
// namespace quota
optional uint64 nsQuota = 2;
// diskspace quota
optional uint64 dsQuota = 3;
optional fixed64 permission = 4;
optional AclFeatureProto acl = 5;
optional XAttrFeatureProto xAttrs = 6;
}
message INodeSymlink {
optional fixed64 permission = 1;
optional bytes target = 2;
optional uint64 modificationTime = 3;
optional uint64 accessTime = 4;
}
message INode {
enum Type {
FILE = 1;
DIRECTORY = 2;
SYMLINK = 3;
};
required Type type = 1;
required uint64 id = 2;
optional bytes name = 3;
optional INodeFile file = 4;
optional INodeDirectory directory = 5;
optional INodeSymlink symlink = 6;
}
optional uint64 lastInodeId = 1;
optional uint64 numInodes = 2;
// repeated INodes..
}
/**
* This section records information about under-construction files for
* reconstructing the lease map.
* NAME: FILES_UNDERCONSTRUCTION
*/
message FilesUnderConstructionSection {
message FileUnderConstructionEntry {
optional uint64 inodeId = 1;
optional string fullPath = 2;
}
// repeated FileUnderConstructionEntry...
}
/**
* This section records the children of each directories
* NAME: INODE_DIR
*/
message INodeDirectorySection {
/**
* A single DirEntry needs to fit in the default PB max message size of
* 64MB. Please be careful when adding more fields to a DirEntry!
*/
message DirEntry {
optional uint64 parent = 1;
// children that are not reference nodes
repeated uint64 children = 2 [packed = true];
// children that are reference nodes, each element is a reference node id
repeated uint32 refChildren = 3 [packed = true];
}
// repeated DirEntry, ended at the boundary of the section.
}
message INodeReferenceSection {
message INodeReference {
// id of the referred inode
optional uint64 referredId = 1;
// local name recorded in WithName
optional bytes name = 2;
// recorded in DstReference
optional uint32 dstSnapshotId = 3;
// recorded in WithName
optional uint32 lastSnapshotId = 4;
}
// repeated INodeReference...
}
/**
* This section records the information about snapshot
* NAME: SNAPSHOT
*/
message SnapshotSection {
message Snapshot {
optional uint32 snapshotId = 1;
// Snapshot root
optional INodeSection.INode root = 2;
}
optional uint32 snapshotCounter = 1;
repeated uint64 snapshottableDir = 2 [packed = true];
// total number of snapshots
optional uint32 numSnapshots = 3;
// repeated Snapshot...
}
/**
* This section records information about snapshot diffs
* NAME: SNAPSHOT_DIFF
*/
message SnapshotDiffSection {
message CreatedListEntry {
optional bytes name = 1;
}
message DirectoryDiff {
optional uint32 snapshotId = 1;
optional uint32 childrenSize = 2;
optional bool isSnapshotRoot = 3;
optional bytes name = 4;
optional INodeSection.INodeDirectory snapshotCopy = 5;
optional uint32 createdListSize = 6;
repeated uint64 deletedINode = 7 [packed = true]; // id of deleted inodes
// id of reference nodes in the deleted list
repeated uint32 deletedINodeRef = 8 [packed = true];
// repeated CreatedListEntry (size is specified by createdListSize)
}
message FileDiff {
optional uint32 snapshotId = 1;
optional uint64 fileSize = 2;
optional bytes name = 3;
optional INodeSection.INodeFile snapshotCopy = 4;
}
message DiffEntry {
enum Type {
FILEDIFF = 1;
DIRECTORYDIFF = 2;
}
required Type type = 1;
optional uint64 inodeId = 2;
optional uint32 numOfDiff = 3;
// repeated DirectoryDiff or FileDiff
}
// repeated DiffEntry
}
/**
* This section maps string to id
* NAME: STRING_TABLE
*/
message StringTableSection {
message Entry {
optional uint32 id = 1;
optional string str = 2;
}
optional uint32 numEntry = 1;
// repeated Entry
}
message SecretManagerSection {
message DelegationKey {
optional uint32 id = 1;
optional uint64 expiryDate = 2;
optional bytes key = 3;
}
message PersistToken {
optional uint32 version = 1;
optional string owner = 2;
optional string renewer = 3;
optional string realUser = 4;
optional uint64 issueDate = 5;
optional uint64 maxDate = 6;
optional uint32 sequenceNumber = 7;
optional uint32 masterKeyId = 8;
optional uint64 expiryDate = 9;
}
optional uint32 currentId = 1;
optional uint32 tokenSequenceNumber = 2;
optional uint32 numKeys = 3;
optional uint32 numTokens = 4;
// repeated DelegationKey keys
// repeated PersistToken tokens
}
message CacheManagerSection {
required uint64 nextDirectiveId = 1;
required uint32 numPools = 2;
required uint32 numDirectives = 3;
// repeated CachePoolInfoProto pools
// repeated CacheDirectiveInfoProto directives
}