当前位置: 首页>>代码示例>>Java>>正文


Java ZNRecord.setEnumField方法代码示例

本文整理汇总了Java中org.apache.helix.ZNRecord.setEnumField方法的典型用法代码示例。如果您正苦于以下问题:Java ZNRecord.setEnumField方法的具体用法?Java ZNRecord.setEnumField怎么用?Java ZNRecord.setEnumField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.helix.ZNRecord的用法示例。


在下文中一共展示了ZNRecord.setEnumField方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:21,代码来源:SegmentZKMetadata.java

示例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;
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:17,代码来源:SegmentZKMetadataTest.java

示例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;
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:17,代码来源:SegmentZKMetadataTest.java

示例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;
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:19,代码来源:SegmentZKMetadataTest.java

示例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;
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:18,代码来源:SegmentZKMetadataTest.java

示例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;
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:18,代码来源:SegmentZKMetadataTest.java

示例7: 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;
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:38,代码来源:SegmentZKMetadata.java

示例8: 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();
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:77,代码来源:SegmentStatusCheckerTest.java

示例9: 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();
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:72,代码来源:SegmentStatusCheckerTest.java


注:本文中的org.apache.helix.ZNRecord.setEnumField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。