Skip to content

Commit

Permalink
fix minor
Browse files Browse the repository at this point in the history
  • Loading branch information
Rong Rong committed Feb 18, 2022
1 parent ab894d6 commit dd04096
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ private long getDeletionTimeMsFromFile(String targetFile, long lastModifiedTime)
return lastModifiedTime + _defaultDeletedSegmentsRetentionMs;
}

private static Long getRetentionMsFromTableConfig(@Nullable TableConfig tableConfig) {
private static @Nullable Long getRetentionMsFromTableConfig(@Nullable TableConfig tableConfig) {
if (tableConfig != null) {
SegmentsValidationAndRetentionConfig validationConfig = tableConfig.getValidationConfig();
if (!StringUtils.isEmpty(validationConfig.getDeletedSegmentsRetentionPeriod())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.apache.helix.HelixAdmin;
import org.apache.helix.ZNRecord;
import org.apache.helix.model.IdealState;
import org.apache.helix.store.zk.ZkHelixPropertyStore;
import org.apache.pinot.common.lineage.SegmentLineage;
import org.apache.pinot.common.metadata.segment.SegmentZKMetadata;
import org.apache.pinot.common.metrics.ControllerMetrics;
import org.apache.pinot.common.metrics.PinotMetricUtils;
Expand All @@ -44,7 +41,6 @@
import org.apache.pinot.spi.utils.CommonConstants;
import org.apache.pinot.spi.utils.builder.TableConfigBuilder;
import org.apache.pinot.spi.utils.builder.TableNameBuilder;
import org.apache.zookeeper.data.Stat;
import org.joda.time.Duration;
import org.joda.time.Interval;
import org.mockito.ArgumentMatchers;
Expand Down Expand Up @@ -200,15 +196,6 @@ public Object answer(InvocationOnMock invocationOnMock)
return null;
}
}).when(resourceManager).deleteSegments(anyString(), ArgumentMatchers.anyList());

// fake segment lineage.
SegmentLineage segmentLineage = new SegmentLineage(REALTIME_TABLE_NAME);

ZkHelixPropertyStore<ZNRecord> mockPropertyStore = mock(ZkHelixPropertyStore.class);
when(mockPropertyStore.get(anyString(), any(Stat.class), anyInt())).thenReturn(segmentLineage.toZNRecord());
when(mockPropertyStore.set(anyString(), any(ZNRecord.class), anyInt(), anyInt())).thenReturn(true);

when(resourceManager.getPropertyStore()).thenReturn(mockPropertyStore);
}

// This test makes sure that we clean up the segments marked OFFLINE in realtime for more than 7 days
Expand Down Expand Up @@ -308,15 +295,6 @@ private PinotHelixResourceManager setupSegmentMetadata(TableConfig tableConfig,
when(helixAdmin.getResourceIdealState(HELIX_CLUSTER_NAME, REALTIME_TABLE_NAME)).thenReturn(idealState);
when(pinotHelixResourceManager.getHelixAdmin()).thenReturn(helixAdmin);

// fake segment lineage.
SegmentLineage segmentLineage = new SegmentLineage(REALTIME_TABLE_NAME);

ZkHelixPropertyStore<ZNRecord> mockPropertyStore = mock(ZkHelixPropertyStore.class);
when(mockPropertyStore.get(anyString(), any(Stat.class), anyInt())).thenReturn(segmentLineage.toZNRecord());
when(mockPropertyStore.set(anyString(), any(ZNRecord.class), anyInt(), anyInt())).thenReturn(true);

when(pinotHelixResourceManager.getPropertyStore()).thenReturn(mockPropertyStore);

return pinotHelixResourceManager;
}

Expand Down

0 comments on commit dd04096

Please sign in to comment.