+1 to this approach, It can be also very helpful in failover scenarios when something wrong happened with disk. In this case we're reducing the number of points of failure.
2018-05-15 18:37 GMT+03:00 Dmitriy Govorukhin <dmitriy.govoruk...@gmail.com> : > Hi Ignite, > > Do we have a general approach to work with a file and directories? > I see many duplication logic for write through .tmp file. > > For example, > > GridCacheDatabaseSharedManager.writeCheckpointEntry(); > GridCacheDatabaseSharedManage.nodeStart(); > FileWriteAheadLogManager.FileArchiver.archiveSegment(); > > All of these methods implement the same logic, write to tmp file and rename > to normal name. > > I guess, will be better if we stopping write duplication logic code and > start to consolidate all in one place. > > Also, I think that current approach to creating files is not quite right > faithful. Each internal component > create/delete files inside himself, and nobody knows where which files > located. > > I suggest refactoring code and create something (maybe new manager) that > will know about all files inside the node. All internal components must > create files only through this one. > > It makes help to write tests for persistence easier and reduce duplication > code in working with files. >