本文整理汇总了Java中org.apache.helix.ZNRecord.setLongField方法的典型用法代码示例。如果您正苦于以下问题:Java ZNRecord.setLongField方法的具体用法?Java ZNRecord.setLongField怎么用?Java ZNRecord.setLongField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.helix.ZNRecord
的用法示例。
在下文中一共展示了ZNRecord.setLongField方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toZNRecord
import org.apache.helix.ZNRecord; //导入方法依赖的package包/类
@Override
public ZNRecord toZNRecord() {
ZNRecord znRecord = new ZNRecord(_segmentName);
znRecord.setSimpleField(CommonConstants.Segment.SEGMENT_NAME, _segmentName);
znRecord.setSimpleField(CommonConstants.Segment.TABLE_NAME, _tableName);
znRecord.setEnumField(CommonConstants.Segment.SEGMENT_TYPE, _segmentType);
if (_timeUnit == null) {
znRecord.setSimpleField(CommonConstants.Segment.TIME_UNIT, NULL);
} else {
znRecord.setEnumField(CommonConstants.Segment.TIME_UNIT, _timeUnit);
}
znRecord.setLongField(CommonConstants.Segment.START_TIME, _startTime);
znRecord.setLongField(CommonConstants.Segment.END_TIME, _endTime);
znRecord.setSimpleField(CommonConstants.Segment.INDEX_VERSION, _indexVersion);
znRecord.setLongField(CommonConstants.Segment.TOTAL_DOCS, _totalDocs);
znRecord.setLongField(CommonConstants.Segment.CRC, _crc);
znRecord.setLongField(CommonConstants.Segment.CREATION_TIME, _creationTime);
return znRecord;
}
示例2: getTestDoneRealtimeSegmentZNRecord
import org.apache.helix.ZNRecord; //导入方法依赖的package包/类
private ZNRecord getTestDoneRealtimeSegmentZNRecord() {
String segmentName = "testTable_R_1000_2000_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.DONE);
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, 10000);
record.setLongField(CommonConstants.Segment.CRC, 1234);
record.setLongField(CommonConstants.Segment.CREATION_TIME, 3000);
return record;
}
示例3: getTestInProgressRealtimeSegmentZNRecord
import org.apache.helix.ZNRecord; //导入方法依赖的package包/类
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);
return record;
}
示例4: getTestOfflineSegmentZNRecord
import org.apache.helix.ZNRecord; //导入方法依赖的package包/类
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;
}
示例5: getTestDoneRealtimeSegmentZNRecord
import org.apache.helix.ZNRecord; //导入方法依赖的package包/类
private ZNRecord getTestDoneRealtimeSegmentZNRecord() {
String segmentName = "testTable_R_1000_2000_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.DONE);
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, 10000);
record.setLongField(CommonConstants.Segment.CRC, 1234);
record.setLongField(CommonConstants.Segment.CREATION_TIME, 3000);
record.setIntField(CommonConstants.Segment.FLUSH_THRESHOLD_SIZE, 1234);
return record;
}
示例6: getTestInProgressRealtimeSegmentZNRecord
import org.apache.helix.ZNRecord; //导入方法依赖的package包/类
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;
}
示例7: toZNRecord
import org.apache.helix.ZNRecord; //导入方法依赖的package包/类
@Override
public ZNRecord toZNRecord() {
ZNRecord znRecord = super.toZNRecord();
znRecord.setSimpleField(CommonConstants.Segment.Offline.DOWNLOAD_URL, _downloadUrl);
znRecord.setLongField(CommonConstants.Segment.Offline.PUSH_TIME, _pushTime);
znRecord.setLongField(CommonConstants.Segment.Offline.REFRESH_TIME, _refreshTime);
return znRecord;
}
示例8: toZNRecord
import org.apache.helix.ZNRecord; //导入方法依赖的package包/类
@Override
public ZNRecord toZNRecord() {
ZNRecord znRecord = new ZNRecord(_segmentName);
znRecord.setSimpleField(CommonConstants.Segment.SEGMENT_NAME, _segmentName);
znRecord.setSimpleField(CommonConstants.Segment.TABLE_NAME, _tableName);
znRecord.setEnumField(CommonConstants.Segment.SEGMENT_TYPE, _segmentType);
if (_timeUnit == null) {
znRecord.setSimpleField(CommonConstants.Segment.TIME_UNIT, NULL);
} else {
znRecord.setEnumField(CommonConstants.Segment.TIME_UNIT, _timeUnit);
}
znRecord.setLongField(CommonConstants.Segment.START_TIME, _startTime);
znRecord.setLongField(CommonConstants.Segment.END_TIME, _endTime);
znRecord.setSimpleField(CommonConstants.Segment.INDEX_VERSION, _indexVersion);
znRecord.setLongField(CommonConstants.Segment.TOTAL_DOCS, _totalRawDocs);
znRecord.setLongField(CommonConstants.Segment.CRC, _crc);
znRecord.setLongField(CommonConstants.Segment.CREATION_TIME, _creationTime);
if (_partitionMetadata != null) {
try {
String partitionMetadataJson = _partitionMetadata.toJsonString();
znRecord.setSimpleField(CommonConstants.Segment.PARTITION_METADATA, partitionMetadataJson);
} catch (IOException e) {
LOGGER.error(
"Exception caught while writing partition metadata into ZNRecord for segment '{}', will be dropped",
_segmentName, e);
}
}
if (_segmentUploadStartTime > 0) {
znRecord.setLongField(CommonConstants.Segment.SEGMENT_UPLOAD_START_TIME, _segmentUploadStartTime);
}
if (_customMap != null) {
znRecord.setMapField(CommonConstants.Segment.CUSTOM_MAP, _customMap);
}
return znRecord;
}
示例9: toZNRecord
import org.apache.helix.ZNRecord; //导入方法依赖的package包/类
@Override
public ZNRecord toZNRecord() {
ZNRecord znRecord = super.toZNRecord();
znRecord.setSimpleField(CommonConstants.Segment.Realtime.STATUS, _status.toString());
znRecord.setLongField(CommonConstants.Segment.FLUSH_THRESHOLD_SIZE, _sizeThresholdToFlushSegment);
return znRecord;
}
示例10: toZNRecord
import org.apache.helix.ZNRecord; //导入方法依赖的package包/类
@Override
public ZNRecord toZNRecord() {
ZNRecord znRecord = super.toZNRecord();
znRecord.setLongField(START_OFFSET, _startOffset);
znRecord.setLongField(END_OFFSET, _endOffset);
znRecord.setIntField(NUM_REPLICAS, _numReplicas);
znRecord.setSimpleField(DOWNLOAD_URL, _downloadUrl);
return znRecord;
}
示例11: missingEVPartitionTest
import org.apache.helix.ZNRecord; //导入方法依赖的package包/类
@Test
public void missingEVPartitionTest() throws Exception {
final String tableName = "myTable_OFFLINE";
List<String> allTableNames = new ArrayList<String>();
allTableNames.add(tableName);
IdealState idealState = new IdealState(tableName);
idealState.setPartitionState("myTable_0", "pinot1", "ONLINE");
idealState.setPartitionState("myTable_0", "pinot2", "ONLINE");
idealState.setPartitionState("myTable_0", "pinot3", "ONLINE");
idealState.setPartitionState("myTable_1", "pinot1", "ONLINE");
idealState.setPartitionState("myTable_1", "pinot2", "ONLINE");
idealState.setPartitionState("myTable_1", "pinot3", "ONLINE");
idealState.setPartitionState("myTable_2", "pinot3", "OFFLINE");
idealState.setPartitionState("myTable_3", "pinot3", "ONLINE");
idealState.setReplicas("2");
idealState.setRebalanceMode(IdealState.RebalanceMode.CUSTOMIZED);
ExternalView externalView = new ExternalView(tableName);
externalView.setState("myTable_0","pinot1","ONLINE");
externalView.setState("myTable_0","pinot2","ONLINE");
externalView.setState("myTable_1","pinot1","ERROR");
externalView.setState("myTable_1","pinot2","ONLINE");
ZNRecord znrecord = new ZNRecord("myTable_0");
znrecord.setSimpleField(CommonConstants.Segment.SEGMENT_NAME,"myTable_0");
znrecord.setSimpleField(CommonConstants.Segment.TABLE_NAME, "myTable_OFFLINE");
znrecord.setSimpleField(CommonConstants.Segment.INDEX_VERSION, "v1");
znrecord.setEnumField(CommonConstants.Segment.SEGMENT_TYPE, CommonConstants.Segment.SegmentType.OFFLINE);
znrecord.setLongField(CommonConstants.Segment.START_TIME, 1000);
znrecord.setLongField(CommonConstants.Segment.END_TIME, 2000);
znrecord.setSimpleField(CommonConstants.Segment.TIME_UNIT, TimeUnit.HOURS.toString());
znrecord.setLongField(CommonConstants.Segment.TOTAL_DOCS, 10000);
znrecord.setLongField(CommonConstants.Segment.CRC, 1234);
znrecord.setLongField(CommonConstants.Segment.CREATION_TIME, 3000);
znrecord.setSimpleField(CommonConstants.Segment.Offline.DOWNLOAD_URL, "http://localhost:8000/myTable_0");
znrecord.setLongField(CommonConstants.Segment.Offline.PUSH_TIME, System.currentTimeMillis());
znrecord.setLongField(CommonConstants.Segment.Offline.REFRESH_TIME,System.currentTimeMillis());
ZkHelixPropertyStore<ZNRecord> propertyStore;
{
propertyStore = (ZkHelixPropertyStore<ZNRecord>) mock(ZkHelixPropertyStore.class);
when(propertyStore.get("/SEGMENTS/myTable_OFFLINE/myTable_3",null, AccessOption.PERSISTENT)).thenReturn(znrecord);
}
HelixAdmin helixAdmin;
{
helixAdmin = mock(HelixAdmin.class);
when(helixAdmin.getResourceIdealState("StatusChecker",tableName)).thenReturn(idealState);
when(helixAdmin.getResourceExternalView("StatusChecker",tableName)).thenReturn(externalView);
}
{
helixResourceManager = mock(PinotHelixResourceManager.class);
when(helixResourceManager.isLeader()).thenReturn(true);
when(helixResourceManager.getAllTables()).thenReturn(allTableNames);
when(helixResourceManager.getHelixClusterName()).thenReturn("StatusChecker");
when(helixResourceManager.getHelixAdmin()).thenReturn(helixAdmin);
when(helixResourceManager.getPropertyStore()).thenReturn(propertyStore);
}
{
config = mock(ControllerConf.class);
when(config.getStatusCheckerFrequencyInSeconds()).thenReturn(300);
when(config.getStatusCheckerWaitForPushTimeInSeconds()).thenReturn(0);
}
metricsRegistry = new MetricsRegistry();
controllerMetrics = new ControllerMetrics(metricsRegistry);
segmentStatusChecker = new SegmentStatusChecker(helixResourceManager, config);
segmentStatusChecker.setMetricsRegistry(controllerMetrics);
segmentStatusChecker.runSegmentMetrics();
Assert.assertEquals(controllerMetrics.getValueOfTableGauge(externalView.getId(),
ControllerGauge.SEGMENTS_IN_ERROR_STATE), 1);
Assert.assertEquals(controllerMetrics.getValueOfTableGauge(externalView.getId(),
ControllerGauge.NUMBER_OF_REPLICAS), 0);
Assert.assertEquals(controllerMetrics.getValueOfTableGauge(externalView.getId(),
ControllerGauge.PERCENT_SEGMENTS_AVAILABLE), 75);
segmentStatusChecker.stop();
}
示例12: missingEVPartitionPushTest
import org.apache.helix.ZNRecord; //导入方法依赖的package包/类
@Test
public void missingEVPartitionPushTest() throws Exception {
final String tableName = "myTable_OFFLINE";
List<String> allTableNames = new ArrayList<String>();
allTableNames.add(tableName);
IdealState idealState = new IdealState(tableName);
idealState.setPartitionState("myTable_0", "pinot1", "ONLINE");
idealState.setPartitionState("myTable_1", "pinot1", "ONLINE");
idealState.setPartitionState("myTable_1", "pinot2", "ONLINE");
idealState.setReplicas("2");
idealState.setRebalanceMode(IdealState.RebalanceMode.CUSTOMIZED);
ExternalView externalView = new ExternalView(tableName);
externalView.setState("myTable_1","pinot1","ONLINE");
externalView.setState("myTable_1","pinot2","ONLINE");
HelixAdmin helixAdmin;
{
helixAdmin = mock(HelixAdmin.class);
when(helixAdmin.getResourceIdealState("StatusChecker","myTable_OFFLINE")).thenReturn(idealState);
when(helixAdmin.getResourceExternalView("StatusChecker","myTable_OFFLINE")).thenReturn(externalView);
}
ZNRecord znrecord = new ZNRecord("myTable_0");
znrecord.setSimpleField(CommonConstants.Segment.SEGMENT_NAME,"myTable_0");
znrecord.setSimpleField(CommonConstants.Segment.TABLE_NAME, "myTable_OFFLINE");
znrecord.setSimpleField(CommonConstants.Segment.INDEX_VERSION, "v1");
znrecord.setEnumField(CommonConstants.Segment.SEGMENT_TYPE, CommonConstants.Segment.SegmentType.OFFLINE);
znrecord.setLongField(CommonConstants.Segment.START_TIME, 1000);
znrecord.setLongField(CommonConstants.Segment.END_TIME, 2000);
znrecord.setSimpleField(CommonConstants.Segment.TIME_UNIT, TimeUnit.HOURS.toString());
znrecord.setLongField(CommonConstants.Segment.TOTAL_DOCS, 10000);
znrecord.setLongField(CommonConstants.Segment.CRC, 1234);
znrecord.setLongField(CommonConstants.Segment.CREATION_TIME, 3000);
znrecord.setSimpleField(CommonConstants.Segment.Offline.DOWNLOAD_URL, "http://localhost:8000/myTable_0");
znrecord.setLongField(CommonConstants.Segment.Offline.PUSH_TIME, System.currentTimeMillis());
znrecord.setLongField(CommonConstants.Segment.Offline.REFRESH_TIME,System.currentTimeMillis());
ZkHelixPropertyStore<ZNRecord> propertyStore;
{
propertyStore = (ZkHelixPropertyStore<ZNRecord>) mock(ZkHelixPropertyStore.class);
when(propertyStore.get("/SEGMENTS/myTable_OFFLINE/myTable_0",null, AccessOption.PERSISTENT)).thenReturn(znrecord);
}
{
helixResourceManager = mock(PinotHelixResourceManager.class);
when(helixResourceManager.isLeader()).thenReturn(true);
when(helixResourceManager.getAllTables()).thenReturn(allTableNames);
when(helixResourceManager.getHelixClusterName()).thenReturn("StatusChecker");
when(helixResourceManager.getHelixAdmin()).thenReturn(helixAdmin);
when(helixResourceManager.getPropertyStore()).thenReturn(propertyStore);
}
{
config = mock(ControllerConf.class);
when(config.getStatusCheckerFrequencyInSeconds()).thenReturn(300);
when(config.getStatusCheckerWaitForPushTimeInSeconds()).thenReturn(300);
}
metricsRegistry = new MetricsRegistry();
controllerMetrics = new ControllerMetrics(metricsRegistry);
segmentStatusChecker = new SegmentStatusChecker(helixResourceManager, config);
segmentStatusChecker.setMetricsRegistry(controllerMetrics);
segmentStatusChecker.runSegmentMetrics();
Assert.assertEquals(controllerMetrics.getValueOfTableGauge(externalView.getId(),
ControllerGauge.SEGMENTS_IN_ERROR_STATE), 0);
Assert.assertEquals(controllerMetrics.getValueOfTableGauge(externalView.getId(),
ControllerGauge.NUMBER_OF_REPLICAS), 2);
Assert.assertEquals(controllerMetrics.getValueOfTableGauge(externalView.getId(),
ControllerGauge.PERCENT_OF_REPLICAS), 100);
Assert.assertEquals(controllerMetrics.getValueOfTableGauge(externalView.getId(),
ControllerGauge.PERCENT_SEGMENTS_AVAILABLE), 100);
segmentStatusChecker.stop();
}