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
{{ message }}
This repository was archived by the owner on Jul 10, 2025. It is now read-only.
During the review meeting it has been decided to merge wrapped filesystem approach and stateful token approach. Then the final proposal is as shown below. The `WrappedFileSystem` and `Filesystem` classes described above are to be extended with three new methods,
700
+
During the review meeting it has been decided to merge wrapped filesystem approach and stateful token approach. Then the final proposal is as shown below. The `WrappedFileSystem` and `Filesystem` classes described above are to be extended with four new methods,
701
701
702
702
```cpp
703
703
classWrappedFileSystem : publicFilesystem {
@@ -707,6 +707,11 @@ class WrappedFileSystem : public Filesystem {
The new functions will be null pointers until respective plugins implement them. `ModularFilesystem` implementation will check whether a plugin implements the transactions and will ignore the transaction if it is not implemented, possibly after producing a log message, thus falling back to current transactionless state. Since these function pointers will be added after existing pointers, already compiled plugins will keep functioning and they can be gradually start supporting transactions. Any filesystem plugin that start supporting transaction will be used by the framework.
744
+
The new functions will be null pointers until respective plugins implement them. `ModularFilesystem` implementation will check whether a plugin implements the transactions and will ignore the transaction if it is not implemented, possibly after producing a log message, thus falling back to
745
+
current transactionless state. Since these function pointers will be added after existing pointers, already compiled plugins will keep functioning and they can be gradually start supporting transactions. Any filesystem plugin that start supporting transaction will be used by the framework.
746
+
747
+
## Example use
748
+
749
+
With these final modifications, there is no need to carry transaction tokens through different compilation units or ops in the graph. For example current checkpointing logic involve adding one or more `SaveV2` ops and a `MergeV2Checkpoints` op to the graph. In order to prevent
750
+
corrupt checkpoints in case of errors and optimize i/o, SaveV2 ops write their outputs to the temporary directories, given as constant input arguments, and MergeV2Checkpoints op is given the names of the temporary save files generated by all SaveV2 ops which reads and merges
751
+
them into a final file and then deletes temporary files. Just by adding a few lines to SaveV2 to and MergeV2Checkpoints ops, these operations can be completed transactionally. In this case overview of the operations would be,
752
+
753
+
- SaveV2 op uses `Env::GetTokenOrStartTransaction(base_dir)` call to start a new transaction or get an existing transaction on the base output directory.
754
+
- SaveV2 op adds files it generates to the transaction.
755
+
- MergeV2Checkpoint op uses `Env::GetTransactionTokenForPath(base_dir)` to get the transaction started by SaveV2 ops and adds its output to the same transaction.
756
+
- MergeV2Checkpoint op removes intermediate files and calls `EndTransaction()` to finalize the transaction.
757
+
758
+
Then a transactional file system may operate in a cache and move files to the final destination only at the end of the transaction which would ensure that the files in the checkpoint directory are consistent. The
759
+
implementation of how this is achieved may be different for each filesystem but the end result should be consistent.
760
+
761
+
An example implementation of this could be as shown in the diff set below.
With these final modifications, there is no need to carry transaction tokens through different compilation units or ops in the graph. For example checkpointing logic can be implemented in an atomic-like way by simply modifying the save and merge ops to use same transaction using accessed file names and directories.
0 commit comments