Search in sources :

Example 1 with BRFSRdFileFilter

use of com.bonree.brfs.disknode.utils.BRFSRdFileFilter in project BRFS by zhangnianli.

the class FileWriterManager method rebuildFileWriterbyDir.

public void rebuildFileWriterbyDir(String dataDirPath) {
    Map<String, String> baseMap = new HashMap<>();
    List<BRFSPath> rds = BRFSFileUtil.scanBRFSFiles(dataDirPath, baseMap, baseMap.size(), new BRFSRdFileFilter());
    File rdFile = null;
    File dataFile = null;
    for (BRFSPath path : rds) {
        rdFile = new File(new StringBuilder().append(dataDirPath).append(FileUtils.FILE_SEPARATOR).append(path).toString());
        dataFile = RecordFileBuilder.reverse(rdFile);
        if (!dataFile.exists()) {
            LOG.error("no data file is attached to a existed rd file[{}]!", rdFile.getAbsolutePath());
            rdFile.delete();
            continue;
        }
        try {
            rebuildFileWriter(dataFile);
        } catch (Throwable e) {
            LOG.error("rebuild file[{}] error!", dataFile.getAbsolutePath(), e);
        }
    }
}
Also used : HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) BRFSPath(com.bonree.brfs.common.utils.BRFSPath) BRFSRdFileFilter(com.bonree.brfs.disknode.utils.BRFSRdFileFilter) File(java.io.File)

Aggregations

BRFSPath (com.bonree.brfs.common.utils.BRFSPath)1 BRFSRdFileFilter (com.bonree.brfs.disknode.utils.BRFSRdFileFilter)1 File (java.io.File)1 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1