You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/design/NSFSGlacierStorageClass.md
+25-26Lines changed: 25 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -15,31 +15,30 @@ There are 3 primary flows of concern and this document will discuss all 3 of the
15
15
2. Restore object that are uploaded to `GLACIER` storage class (API: `RestoreObject`).
16
16
3. Copy objects where source is an object stored in `GLACIER` (API: `PutObject`).
17
17
18
-
### WAL
19
-
Important component of all the flows is the write ahead log (WAL). NooBaa has a `SimpleWAL` which as name states
20
-
is extremely simple in some senses. It does not deal with fsync issues, partial writes, holes, etc. rather just
21
-
appends data seperated by a new line character.
18
+
### Persistent Log
19
+
Important component of all the flows is the Persistent Log. NooBaa has a `PersistentLogger` is extremely simple in some senses.
20
+
It does not deal with fsync issues, partial writes, holes, etc. rather just appends data seperated by a new line character.
22
21
23
-
`SimpleWAL` features:
22
+
`PersistentLogger` features:
24
23
1. Exposes an `append` method which adds data to the file.
25
-
2. Can perform auto rotation of the file which makes sure that a single WAL is never too huge for the
26
-
WAL consumer to consume.
27
-
3. Exposes a `process` method which allows "safe" iteration on the previous WAL files.
24
+
2. Can perform auto rotation of the file which makes sure that a single log is never too huge for the
25
+
log consumer to consume.
26
+
3. Exposes a `process_inactive` method which allows "safe" iteration on the previous log files.
28
27
4. Tries to make sure that no data loss happens due to process level races.
29
28
30
29
#### Races which are handled by the current implementation
31
-
1.`n` processes open the WAL file while a "consumer" swoops and tries to process the file affectively losing the
30
+
1.`n` processes open the log file while a "consumer" swoops and tries to process the file affectively losing the
32
31
current writes (due to processing partially written file and ultimately invoking `unlink` on the file) - This isn't
33
-
possible as `process` method makes sure that it doesn't iterate over the "current active file".
34
-
2.`k` processes out of `n` (such that `k < n`) open the WAL while a "consumer" swoops and tries to process the
35
-
file affectively losing the current writes (due to unliking the file others hold reference to) - Although `process`
32
+
possible as `process_inactive` method makes sure that it doesn't iterate over the "current active file".
33
+
2.`k` processes out of `n` (such that `k < n`) open the peristent log while a "consumer" swoops and tries to process the
34
+
file affectively losing the current writes (due to unliking the file others hold reference to) - Although `process_inactive`
36
35
method will not protect against this as technically "current active file" is a different file but this is still **not**
37
36
possible as the "consumer" need to have an "EXCLUSIVE" lock on the files before it can process the file this makes sure
38
37
that for as long as any process is writing on the file, the "consumer" cannot consume the file and will block.
39
-
3.`k` processes out of `n` (such that `k < n`) open the WAL but before the NSFS process could get a "SHARED" lock on
38
+
3.`k` processes out of `n` (such that `k < n`) open the peristent log but before the NSFS process could get a "SHARED" lock on
40
39
the file the "consumer" process swoops in and process the files and then issues `unlink` on the file. The unlink will
41
40
not delete the file as `k` processes have open FD to the file but as soon as those processes will be done writing to
42
-
it and will close the FD, the file will be deleted which will result in lost writes - This isn't possible as `SimpleWAL`
41
+
it and will close the FD, the file will be deleted which will result in lost writes - This isn't possible as `PersistentLogger`
43
42
does not allow writing to a file till it can get a lock on the file and ensure that there are `> 0` links to the file.
44
43
If there are no links then it tries to open file the again assuming that the consumer has issued `unlink` on the file
45
44
it holds the FD to.
@@ -66,7 +65,7 @@ which manages the actual movements of the file.
66
65
2. NooBaa rejects the request if NooBaa isn't configured to support the given storage class. This is **not** enabled
67
66
by default and needs to be enabled via `config-local.js` by setting `config.NSFS_GLACIER_ENABLED = true` and `config.NSFS_GLACIER_LOGS_ENABLED = true`.
68
67
3. NooBaa will set the storage class to `GLACIER` by setting `user.storage_class` extended attribute.
69
-
4. NooBaa creates a simple WAL (Write Ahead Log) and appends the filename to the log file.
68
+
4. NooBaa creates a persistent log and appends the filename to the log file.
70
69
5. Completes the upload.
71
70
72
71
Once the upload is complete, the file sits on the disk till the second process kicks in and actually does the movement
2. The command will first acquire an "EXCLUSIVE" lock so as to ensure that only one tape management command is running at once.
81
80
3. Once the process has the lock it will start to iterate over the potentially currently inactive files.
82
-
4. Before processing a WAL file, the proceess will get an "EXCLUSIVE" lock to the file ensuring that it is indeed the only
81
+
4. Before processing a log file, the proceess will get an "EXCLUSIVE" lock to the file ensuring that it is indeed the only
83
82
process processing the file.
84
-
5. It will read the WAL one line at a time and will ensure the following:
83
+
5. It will read the log one line at a time and will ensure the following:
85
84
1. The file still exists.
86
85
2. The file is still has `GLACIER` storage class. (This is can happen if the user uploads another object with `STANDARD`
87
86
storage class).
88
87
3. The file doesn't have any of the `RestoreObject` extended attributes. This is to ensure that if the file was marked
89
88
for restoration as soon as it was uploaded then we don't perform the migration at all. This is to avoid unnecessary
90
89
work and also make sure that we don't end up racing with ourselves.
91
-
6. Once a file name passes through all the above criterions then we add its name to a temporary WAL and handover the file
90
+
6. Once a file name passes through all the above criterions then we add its name to a temporary log and handover the file
92
91
name to `migrate` script which should be in `config.NSFS_GLACIER_TAPECLOUD_BIN_DIR` directory. We expect that the script will take the file name as its first parameter and will perform the migration. If the `config.NSFS_GLACIER_BACKEND` is set to `TAPECLOUD` (default) then we expect the script to output data in compliance with `eeadm migrate` command.
93
-
7. We delete the temporary WAL that we created.
94
-
8. We delete the WAL created by NSFS process **iff** there were no failures in `migrate`. In case of failures we skip the WAL
92
+
7. We delete the temporary log that we created.
93
+
8. We delete the log created by NSFS process **iff** there were no failures in `migrate`. In case of failures we skip the log
95
94
deletion as a way to retry during the next trigger of the script. It should be noted that NooBaa's `migrate` (`TAPECLOUD` backend) invocation does **not** consider `DUPLICATE TASK` an error.
96
95
97
96
### Flow 2: Restore Object
@@ -105,21 +104,21 @@ which manages the actual movements of the file.
105
104
by default and needs to be enabled via `config-local.js` by setting `config.NSFS_GLACIER_ENABLED = true` and `config.NSFS_GLACIER_LOGS_ENABLED = true`.
106
105
3. NooBaa performs a number of checks to ensure that the operation is valid (for example there is no already ongoing
107
106
restore request going on etc).
108
-
4. NooBaa saves the filename to a simple WAL (Write Ahead Log).
107
+
4. NooBaa saves the filename to a persistent log.
109
108
5. Returns the request with success indicating that the restore request has been accepted.
2. The command will first acquire an "EXCLUSIVE" lock so as to ensure that only one tape management command is running at once.
114
113
3. Once the process has the lock it will start to iterate over the potentially currently inactive files.
115
-
4. Before processing a WAL file, the proceess will get an "EXCLUSIVE" lock to the file ensuring that it is indeed the only
114
+
4. Before processing a log file, the proceess will get an "EXCLUSIVE" lock to the file ensuring that it is indeed the only
116
115
process processing the file.
117
-
5. It will read the WAL one line at a time and will store the names of the files that we expect to fail during an eeadm restore
116
+
5. It will read the log one line at a time and will store the names of the files that we expect to fail during an eeadm restore
118
117
(this can happen for example because a `RestoreObject` was issued for a file but later on that file was deleted before we could
119
118
actually process the file).
120
-
6. The WAL is handed over to `recall` script which should be present in `config.NSFS_GLACIER_TAPECLOUD_BIN_DIR` directory. We expect that the script will take the file name as its first parameter and will perform the recall. If the `config.NSFS_GLACIER_BACKEND` is set to `TAPECLOUD` (default) then we expect the script to output data in compliance with `eeadm recall` command.
121
-
7. If we get any unexpected failures then we mark it a failure and make sure we do not delete the WAL file (so as to retry later).
122
-
8. We iterate over the WAL again to set the final extended attributes. This is to make sure that we can communicate the latest with
119
+
6. The log is handed over to `recall` script which should be present in `config.NSFS_GLACIER_TAPECLOUD_BIN_DIR` directory. We expect that the script will take the file name as its first parameter and will perform the recall. If the `config.NSFS_GLACIER_BACKEND` is set to `TAPECLOUD` (default) then we expect the script to output data in compliance with `eeadm recall` command.
120
+
7. If we get any unexpected failures then we mark it a failure and make sure we do not delete the log file (so as to retry later).
121
+
8. We iterate over the log again to set the final extended attributes. This is to make sure that we can communicate the latest with
123
122
the NSFS processes.
124
123
125
124
### Flow 3: Copy Object with Glacier Object as copy source
0 commit comments