use of org.apache.helix.ZNRecord in project pinot by linkedin.
the class SegmentZKMetadataTest method getTestInProgressRealtimeSegmentZNRecord.
private ZNRecord getTestInProgressRealtimeSegmentZNRecord() {
String segmentName = "testTable_R_1000_groupId0_part0";
ZNRecord record = new ZNRecord(segmentName);
record.setSimpleField(CommonConstants.Segment.SEGMENT_NAME, segmentName);
record.setSimpleField(CommonConstants.Segment.TABLE_NAME, "testTable");
record.setSimpleField(CommonConstants.Segment.INDEX_VERSION, "v1");
record.setEnumField(CommonConstants.Segment.SEGMENT_TYPE, CommonConstants.Segment.SegmentType.REALTIME);
record.setEnumField(CommonConstants.Segment.Realtime.STATUS, CommonConstants.Segment.Realtime.Status.IN_PROGRESS);
record.setLongField(CommonConstants.Segment.START_TIME, 1000);
record.setLongField(CommonConstants.Segment.END_TIME, -1);
record.setSimpleField(CommonConstants.Segment.TIME_UNIT, TimeUnit.HOURS.toString());
record.setLongField(CommonConstants.Segment.TOTAL_DOCS, -1);
record.setLongField(CommonConstants.Segment.CRC, -1);
record.setLongField(CommonConstants.Segment.CREATION_TIME, 1000);
record.setIntField(CommonConstants.Segment.FLUSH_THRESHOLD_SIZE, 1234);
return record;
}
use of org.apache.helix.ZNRecord in project pinot by linkedin.
the class InstanceZKMetadataTest method instanceZKMetadataConvertionTest.
@Test
public void instanceZKMetadataConvertionTest() {
ZNRecord znRecord = getTestInstanceZNRecord();
InstanceZKMetadata instanceMetadataFromZNRecord = new InstanceZKMetadata(znRecord);
InstanceZKMetadata instanceMetadata = getTestInstanceMetadata();
ZNRecord znRecordFromMetadata = instanceMetadata.toZNRecord();
Assert.assertTrue(MetadataUtils.comparisonZNRecords(znRecord, znRecordFromMetadata));
Assert.assertTrue(instanceMetadata.equals(instanceMetadataFromZNRecord));
Assert.assertTrue(instanceMetadata.equals(new InstanceZKMetadata(instanceMetadata.toZNRecord())));
Assert.assertTrue(MetadataUtils.comparisonZNRecords(znRecord, new InstanceZKMetadata(znRecord).toZNRecord()));
}
use of org.apache.helix.ZNRecord in project pinot by linkedin.
the class SegmentZKMetadataTest method getTestOfflineSegmentZNRecord.
private ZNRecord getTestOfflineSegmentZNRecord() {
String segmentName = "testTable_O_3000_4000";
ZNRecord record = new ZNRecord(segmentName);
record.setSimpleField(CommonConstants.Segment.SEGMENT_NAME, segmentName);
record.setSimpleField(CommonConstants.Segment.TABLE_NAME, "testTable");
record.setSimpleField(CommonConstants.Segment.INDEX_VERSION, "v1");
record.setEnumField(CommonConstants.Segment.SEGMENT_TYPE, CommonConstants.Segment.SegmentType.OFFLINE);
record.setLongField(CommonConstants.Segment.START_TIME, 1000);
record.setLongField(CommonConstants.Segment.END_TIME, 2000);
record.setSimpleField(CommonConstants.Segment.TIME_UNIT, TimeUnit.HOURS.toString());
record.setLongField(CommonConstants.Segment.TOTAL_DOCS, 50000);
record.setLongField(CommonConstants.Segment.CRC, 54321);
record.setLongField(CommonConstants.Segment.CREATION_TIME, 1000);
record.setSimpleField(CommonConstants.Segment.Offline.DOWNLOAD_URL, "http://localhost:8000/testTable_O_3000_4000");
record.setLongField(CommonConstants.Segment.Offline.PUSH_TIME, 4000);
record.setLongField(CommonConstants.Segment.Offline.REFRESH_TIME, 8000);
return record;
}
use of org.apache.helix.ZNRecord in project pinot by linkedin.
the class SegmentZKMetadataTest method realtimeSegmentZKMetadataConvertionTest.
@Test
public void realtimeSegmentZKMetadataConvertionTest() {
ZNRecord inProgressZnRecord = getTestInProgressRealtimeSegmentZNRecord();
ZNRecord doneZnRecord = getTestDoneRealtimeSegmentZNRecord();
RealtimeSegmentZKMetadata inProgressSegmentMetadata = getTestInProgressRealtimeSegmentMetadata();
RealtimeSegmentZKMetadata doneSegmentMetadata = getTestDoneRealtimeSegmentMetadata();
Assert.assertTrue(MetadataUtils.comparisonZNRecords(inProgressZnRecord, inProgressSegmentMetadata.toZNRecord()));
Assert.assertTrue(MetadataUtils.comparisonZNRecords(doneZnRecord, doneSegmentMetadata.toZNRecord()));
Assert.assertTrue(inProgressSegmentMetadata.equals(new RealtimeSegmentZKMetadata(inProgressZnRecord)));
Assert.assertTrue(doneSegmentMetadata.equals(new RealtimeSegmentZKMetadata(doneZnRecord)));
Assert.assertTrue(MetadataUtils.comparisonZNRecords(inProgressZnRecord, new RealtimeSegmentZKMetadata(inProgressZnRecord).toZNRecord()));
Assert.assertTrue(MetadataUtils.comparisonZNRecords(doneZnRecord, new RealtimeSegmentZKMetadata(doneZnRecord).toZNRecord()));
Assert.assertTrue(inProgressSegmentMetadata.equals(new RealtimeSegmentZKMetadata(inProgressSegmentMetadata.toZNRecord())));
Assert.assertTrue(doneSegmentMetadata.equals(new RealtimeSegmentZKMetadata(doneSegmentMetadata.toZNRecord())));
}
use of org.apache.helix.ZNRecord in project pinot by linkedin.
the class SegmentZKMetadataTest method offlineSegmentZKMetadataConvertionTest.
@Test
public void offlineSegmentZKMetadataConvertionTest() {
ZNRecord offlineZNRecord = getTestOfflineSegmentZNRecord();
OfflineSegmentZKMetadata offlineSegmentMetadata = getTestOfflineSegmentMetadata();
Assert.assertTrue(MetadataUtils.comparisonZNRecords(offlineZNRecord, offlineSegmentMetadata.toZNRecord()));
Assert.assertTrue(offlineSegmentMetadata.equals(new OfflineSegmentZKMetadata(offlineZNRecord)));
Assert.assertTrue(MetadataUtils.comparisonZNRecords(offlineZNRecord, new OfflineSegmentZKMetadata(offlineZNRecord).toZNRecord()));
Assert.assertTrue(offlineSegmentMetadata.equals(new OfflineSegmentZKMetadata(offlineSegmentMetadata.toZNRecord())));
}
Aggregations