Review Board 1.7.22


Fix for failure in TestLog.testReplaySucceedsWithUnusedEmptyLogMetaDataFastReplay() in file channel on Windows:

Review Request #11544 - Created May 30, 2013 and submitted

Roshan Naik
flume-1.4
FLUME-2060
Reviewers
Flume
flume-git
ERROR >  Unable to delete file:C:\Users\ROSHAN~1\AppData\Local\Temp\1369355138695-0\inflighttakes


In this fix we avoid reusing the checkpoint directory.. and set it up for deletion on jvm exit.
the said test now passes.
flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestLog.java
Revision 6751714 New Change
[20] 44 lines
[+20] [+] public class TestLog {
45
  private long transactionID;
45
  private long transactionID;
46
  @Before
46
  @Before
47
  public void setup() throws IOException {
47
  public void setup() throws IOException {
48
    transactionID = 0;
48
    transactionID = 0;
49
    checkpointDir = Files.createTempDir();
49
    checkpointDir = Files.createTempDir();

    
   
50
    FileUtils.forceDeleteOnExit(checkpointDir);
50
    Assert.assertTrue(checkpointDir.isDirectory());
51
    Assert.assertTrue(checkpointDir.isDirectory());
51
    dataDirs = new File[3];
52
    dataDirs = new File[3];
52
    for (int i = 0; i < dataDirs.length; i++) {
53
    for (int i = 0; i < dataDirs.length; i++) {
53
      dataDirs[i] = Files.createTempDir();
54
      dataDirs[i] = Files.createTempDir();
54
      Assert.assertTrue(dataDirs[i].isDirectory());
55
      Assert.assertTrue(dataDirs[i].isDirectory());
[+20] [20] 355 lines
[+20] [+] public void testReplaySucceedsWithUnusedEmptyLogMetaDataFastReplay()
410
    FlumeEvent eventIn = TestUtils.newPersistableEvent();
411
    FlumeEvent eventIn = TestUtils.newPersistableEvent();
411
    long transactionID = ++this.transactionID;
412
    long transactionID = ++this.transactionID;
412
    FlumeEventPointer eventPointer = log.put(transactionID, eventIn);
413
    FlumeEventPointer eventPointer = log.put(transactionID, eventIn);
413
    log.commitPut(transactionID); // this is not required since
414
    log.commitPut(transactionID); // this is not required since
414
    log.close();
415
    log.close();
415
    FileUtils.deleteDirectory(checkpointDir);
416
    checkpointDir = Files.createTempDir();
416
    Assert.assertTrue(checkpointDir.mkdir());
417
    FileUtils.forceDeleteOnExit(checkpointDir);

    
   
418
    Assert.assertTrue(checkpointDir.isDirectory());
417
    log = new Log.Builder().setCheckpointInterval(1L).setMaxFileSize(
419
    log = new Log.Builder().setCheckpointInterval(1L).setMaxFileSize(
418
        MAX_FILE_SIZE).setQueueSize(CAPACITY).setCheckpointDir(
420
        MAX_FILE_SIZE).setQueueSize(CAPACITY).setCheckpointDir(
419
            checkpointDir).setLogDirs(dataDirs)
421
            checkpointDir).setLogDirs(dataDirs)
420
            .setChannelName("testlog").setUseFastReplay(true).build();
422
            .setChannelName("testlog").setUseFastReplay(true).build();
421
    doTestReplaySucceedsWithUnusedEmptyLogMetaData(eventIn, eventPointer);
423
    doTestReplaySucceedsWithUnusedEmptyLogMetaData(eventIn, eventPointer);
[+20] [20] 55 lines
  1. flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestLog.java: Loading...