Search in sources :

Example 1 with HdfsUpdateLog

use of org.apache.solr.update.HdfsUpdateLog in project lucene-solr by apache.

the class TestRecoveryHdfs method testReplicationFactor.

@Test
public void testReplicationFactor() throws Exception {
    clearIndex();
    HdfsUpdateLog ulog = (HdfsUpdateLog) h.getCore().getUpdateHandler().getUpdateLog();
    assertU(commit());
    addAndGetVersion(sdoc("id", "REP1"), null);
    assertU(commit());
    String[] logList = ulog.getLogList(new Path(ulog.getLogDir()));
    boolean foundRep2 = false;
    for (String tl : logList) {
        FileStatus status = fs.getFileStatus(new Path(ulog.getLogDir(), tl));
        if (status.getReplication() == 2) {
            foundRep2 = true;
            break;
        }
    }
    assertTrue("Expected to find tlogs with a replication factor of 2", foundRep2);
}
Also used : Path(org.apache.hadoop.fs.Path) FileStatus(org.apache.hadoop.fs.FileStatus) HdfsUpdateLog(org.apache.solr.update.HdfsUpdateLog) Test(org.junit.Test)

Aggregations

FileStatus (org.apache.hadoop.fs.FileStatus)1 Path (org.apache.hadoop.fs.Path)1 HdfsUpdateLog (org.apache.solr.update.HdfsUpdateLog)1 Test (org.junit.Test)1