Search in sources :

Example 6 with RetentionManager

use of com.linkedin.pinot.controller.helix.core.retention.RetentionManager in project pinot by linkedin.

the class RetentionManagerTest method testRetentionWithDaysTimeUnit.

/**
   * Test with daysSinceEpoch time unit and make 10 segments with expired time value, 10 segments
   * with the day after tomorrow's time stamp.
   * @throws JSONException
   * @throws UnsupportedEncodingException
   * @throws IOException
   * @throws InterruptedException
   */
@Test
public void testRetentionWithDaysTimeUnit() throws JSONException, UnsupportedEncodingException, IOException, InterruptedException {
    _retentionManager = new RetentionManager(_pinotHelixResourceManager, 5);
    _retentionManager.start();
    long theDayAfterTomorrowSinceEpoch = System.currentTimeMillis() / 1000 / 60 / 60 / 24 + 2;
    for (int i = 0; i < 10; ++i) {
        SegmentMetadata segmentMetadata = getTimeSegmentMetadataImpl("15544", "15544", TimeUnit.DAYS.toString());
        registerSegmentMetadata(segmentMetadata);
        Thread.sleep(100);
    }
    for (int i = 0; i < 10; ++i) {
        SegmentMetadata segmentMetadata = getTimeSegmentMetadataImpl(theDayAfterTomorrowSinceEpoch + "", theDayAfterTomorrowSinceEpoch + "", TimeUnit.DAYS.toString());
        registerSegmentMetadata(segmentMetadata);
        Thread.sleep(100);
    }
    validate(20, _offlineTableName, 10, true);
    cleanupSegments(_offlineTableName);
}
Also used : RetentionManager(com.linkedin.pinot.controller.helix.core.retention.RetentionManager) SegmentMetadata(com.linkedin.pinot.common.segment.SegmentMetadata) Test(org.testng.annotations.Test) AfterTest(org.testng.annotations.AfterTest) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

RetentionManager (com.linkedin.pinot.controller.helix.core.retention.RetentionManager)6 AfterTest (org.testng.annotations.AfterTest)6 BeforeTest (org.testng.annotations.BeforeTest)6 Test (org.testng.annotations.Test)6 SegmentMetadata (com.linkedin.pinot.common.segment.SegmentMetadata)5 IdealState (org.apache.helix.model.IdealState)1