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


Java ZkHelixPropertyStore类代码示例

本文整理汇总了Java中org.apache.helix.store.zk.ZkHelixPropertyStore的典型用法代码示例。如果您正苦于以下问题:Java ZkHelixPropertyStore类的具体用法?Java ZkHelixPropertyStore怎么用?Java ZkHelixPropertyStore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ZkHelixPropertyStore类属于org.apache.helix.store.zk包,在下文中一共展示了ZkHelixPropertyStore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAssignedInstances

import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入依赖的package包/类
@Override
public List<String> getAssignedInstances(HelixAdmin helixAdmin, ZkHelixPropertyStore<ZNRecord> propertyStore,
    String helixClusterName, SegmentMetadata segmentMetadata, int numReplicas, String tenantName) {
  String serverTenantName = ControllerTenantNameBuilder.getOfflineTenantNameForTenant(tenantName);
  final Random random = new Random(System.currentTimeMillis());

  List<String> allInstanceList =
      HelixHelper.getEnabledInstancesWithTag(helixAdmin, helixClusterName, serverTenantName);
  List<String> selectedInstanceList = new ArrayList<>();
  for (int i = 0; i < numReplicas; ++i) {
    final int idx = random.nextInt(allInstanceList.size());
    selectedInstanceList.add(allInstanceList.get(idx));
    allInstanceList.remove(idx);
  }
  LOGGER.info("Segment assignment result for : " + segmentMetadata.getName() + ", in resource : "
      + segmentMetadata.getTableName() + ", selected instances: " + Arrays.toString(selectedInstanceList.toArray()));

  return selectedInstanceList;
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:20,代码来源:RandomAssignmentStrategy.java

示例2: getRealtimeSegmentZKMetadataListForTable

import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入依赖的package包/类
public static List<RealtimeSegmentZKMetadata> getRealtimeSegmentZKMetadataListForTable(
    ZkHelixPropertyStore<ZNRecord> propertyStore, String resourceName) {
  List<RealtimeSegmentZKMetadata> resultList = new ArrayList<>();
  if (propertyStore == null) {
    return resultList;
  }
  String realtimeTableName = TableNameBuilder.REALTIME.tableNameWithType(resourceName);
  if (propertyStore.exists(constructPropertyStorePathForResource(realtimeTableName), AccessOption.PERSISTENT)) {
    List<ZNRecord> znRecordList =
        propertyStore.getChildren(constructPropertyStorePathForResource(realtimeTableName), null,
            AccessOption.PERSISTENT);
    if (znRecordList != null) {
      for (ZNRecord record : znRecordList) {
        resultList.add(new RealtimeSegmentZKMetadata(record));
      }
    }
  }
  return resultList;
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:20,代码来源:ZKMetadataProvider.java

示例3: buildInitialRealtimeIdealStateFor

import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入依赖的package包/类
public static IdealState buildInitialRealtimeIdealStateFor(String realtimeTableName,
    AbstractTableConfig realtimeTableConfig, HelixAdmin helixAdmin, String helixClusterName,
    ZkHelixPropertyStore<ZNRecord> zkHelixPropertyStore) {
  KafkaStreamMetadata kafkaStreamMetadata =
      new KafkaStreamMetadata(realtimeTableConfig.getIndexingConfig().getStreamConfigs());
  String realtimeServerTenant =
      ControllerTenantNameBuilder.getRealtimeTenantNameForTenant(realtimeTableConfig.getTenantConfig().getServer());
  switch (kafkaStreamMetadata.getConsumerType()) {
    case highLevel:
      IdealState idealState =
          buildInitialKafkaHighLevelConsumerRealtimeIdealStateFor(realtimeTableName, helixAdmin, helixClusterName,
              zkHelixPropertyStore);
      List<String> realtimeInstances = helixAdmin.getInstancesInClusterWithTag(helixClusterName, realtimeServerTenant);
      if (realtimeInstances.size() % Integer.parseInt(realtimeTableConfig.getValidationConfig().getReplication()) != 0) {
        throw new RuntimeException("Number of instance in current tenant should be an integer multiples of the number of replications");
      }
      setupInstanceConfigForKafkaHighLevelConsumer(realtimeTableName, realtimeInstances.size(),
          Integer.parseInt(realtimeTableConfig.getValidationConfig().getReplication()), realtimeTableConfig
              .getIndexingConfig().getStreamConfigs(), zkHelixPropertyStore, realtimeInstances);
      return idealState;
    case simple:
    default:
      throw new UnsupportedOperationException("Not support kafka consumer type: "
          + kafkaStreamMetadata.getConsumerType());
  }
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:27,代码来源:PinotTableIdealStateBuilder.java

示例4: HelixExternalViewBasedRouting

import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入依赖的package包/类
public HelixExternalViewBasedRouting(RoutingTableBuilder defaultOfflineRoutingTableBuilder,
    RoutingTableBuilder defaultRealtimeRoutingTableBuilder, Map<String, RoutingTableBuilder> routingTableBuilderMap,
    ZkHelixPropertyStore<ZNRecord> propertyStore) {
  _timeBoundaryService = new HelixExternalViewBasedTimeBoundaryService(propertyStore);
  if (defaultOfflineRoutingTableBuilder != null) {
    _defaultOfflineRoutingTableBuilder = defaultOfflineRoutingTableBuilder;
  } else {
    _defaultOfflineRoutingTableBuilder = new BalancedRandomRoutingTableBuilder();
  }
  if (defaultRealtimeRoutingTableBuilder != null) {
    _defaultRealtimeRoutingTableBuilder = defaultRealtimeRoutingTableBuilder;
  } else {
    _defaultRealtimeRoutingTableBuilder = new KafkaHighLevelConsumerBasedRoutingTableBuilder();
  }
  if (routingTableBuilderMap != null) {
    _routingTableBuilderMap = routingTableBuilderMap;
  } else {
    _routingTableBuilderMap = new HashMap<String, RoutingTableBuilder>();
  }
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:21,代码来源:HelixExternalViewBasedRouting.java

示例5: addingSegmentsToPropertyStore

import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入依赖的package包/类
private void addingSegmentsToPropertyStore(int numSegments, ZkHelixPropertyStore<ZNRecord> propertyStore,
    String tableName) {
  for (int i = 0; i < numSegments; ++i) {
    OfflineSegmentZKMetadata offlineSegmentZKMetadata = new OfflineSegmentZKMetadata();
    offlineSegmentZKMetadata.setSegmentName(tableName + "_" + System.currentTimeMillis() + "_" + i);
    offlineSegmentZKMetadata.setTimeUnit(TimeUnit.DAYS);
    offlineSegmentZKMetadata.setEndTime(i);
    offlineSegmentZKMetadata.setCrc(-1);
    offlineSegmentZKMetadata.setCreationTime(-1);
    offlineSegmentZKMetadata.setStartTime(i - 1);
    offlineSegmentZKMetadata.setIndexVersion("0");
    offlineSegmentZKMetadata.setPushTime(i + 5);
    offlineSegmentZKMetadata.setTableName(tableName);
    offlineSegmentZKMetadata.setSegmentType(SegmentType.OFFLINE);
    ZKMetadataProvider.setOfflineSegmentZKMetadata(_propertyStore, offlineSegmentZKMetadata);
  }
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:18,代码来源:TimeBoundaryServiceTest.java

示例6: getOfflineSegmentZKMetadataListForTable

import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入依赖的package包/类
public static List<OfflineSegmentZKMetadata> getOfflineSegmentZKMetadataListForTable(ZkHelixPropertyStore<ZNRecord> propertyStore, String tableName) {
  List<OfflineSegmentZKMetadata> resultList = new ArrayList<OfflineSegmentZKMetadata>();
  if (propertyStore == null) {
    return resultList;
  }
  String offlineTableName = TableNameBuilder.OFFLINE_TABLE_NAME_BUILDER.forTable(tableName);
  if (propertyStore.exists(constructPropertyStorePathForResource(offlineTableName), AccessOption.PERSISTENT)) {
    List<ZNRecord> znRecordList = propertyStore.getChildren(constructPropertyStorePathForResource(offlineTableName), null, AccessOption.PERSISTENT);
    if (znRecordList != null) {
      for (ZNRecord record : znRecordList) {
        resultList.add(new OfflineSegmentZKMetadata(record));
      }
    }
  }
  return resultList;
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:17,代码来源:ZKMetadataProvider.java

示例7: getRealtimeSegmentZKMetadataListForTable

import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入依赖的package包/类
public static List<RealtimeSegmentZKMetadata> getRealtimeSegmentZKMetadataListForTable(ZkHelixPropertyStore<ZNRecord> propertyStore, String resourceName) {
  List<RealtimeSegmentZKMetadata> resultList = new ArrayList<RealtimeSegmentZKMetadata>();
  if (propertyStore == null) {
    return resultList;
  }
  String realtimeTableName = TableNameBuilder.REALTIME_TABLE_NAME_BUILDER.forTable(resourceName);
  if (propertyStore.exists(constructPropertyStorePathForResource(realtimeTableName), AccessOption.PERSISTENT)) {
    List<ZNRecord> znRecordList = propertyStore.getChildren(constructPropertyStorePathForResource(realtimeTableName), null, AccessOption.PERSISTENT);
    if (znRecordList != null) {
      for (ZNRecord record : znRecordList) {
        resultList.add(new RealtimeSegmentZKMetadata(record));
      }
    }
  }
  return resultList;
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:17,代码来源:ZKMetadataProvider.java

示例8: execute

import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入依赖的package包/类
@Override
public boolean execute()
    throws Exception {
  if (!_validateTableConfig && !_validateSchema) {
    throw new RuntimeException("Need to specify at least one of -schema and -tableConfig");
  }

  LOGGER.info("Connecting to Zookeeper: {}, cluster: ", _zkAddress, _clusterName);
  ZNRecordSerializer serializer = new ZNRecordSerializer();
  String path = PropertyPathConfig.getPath(PropertyType.PROPERTYSTORE, _clusterName);
  _helixPropertyStore = new ZkHelixPropertyStore<>(_zkAddress, serializer, path);

  LOGGER.info("\n\n-------------------- Starting Validation --------------------");
  if (_validateTableConfig) {
    validateTableConfig();
  }
  if (_validateSchema) {
    validateSchema();
  }

  return true;
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:23,代码来源:ValidateConfigCommand.java

示例9: PinotZKChanger

import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入依赖的package包/类
public PinotZKChanger(String zkAddress, String clusterName) {
  this.clusterName = clusterName;
  helixAdmin = new ZKHelixAdmin(zkAddress);
  helixManager =
      HelixManagerFactory
          .getZKHelixManager(clusterName, "PinotNumReplicaChanger", InstanceType.ADMINISTRATOR, zkAddress);
  try {
    helixManager.connect();
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
  ZNRecordSerializer serializer = new ZNRecordSerializer();
  String path = PropertyPathConfig.getPath(PropertyType.PROPERTYSTORE, clusterName);
  propertyStore = new ZkHelixPropertyStore<>(zkAddress, serializer, path);
  objectMapper = new ObjectMapper();
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:17,代码来源:PinotZKChanger.java

示例10: getAssignedInstances

import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入依赖的package包/类
@Override
public List<String> getAssignedInstances(HelixAdmin helixAdmin, ZkHelixPropertyStore<ZNRecord> propertyStore,
    String helixClusterName, SegmentMetadata segmentMetadata, int numReplicas, String tenantName) {
  String serverTenantName = ControllerTenantNameBuilder.getOfflineTenantNameForTenant(tenantName);

  List<String> allInstances = HelixHelper.getEnabledInstancesWithTag(helixAdmin, helixClusterName, serverTenantName);
  List<String> selectedInstanceList = new ArrayList<>();
  if (segmentMetadata.getShardingKey() != null) {
    for (String instance : allInstances) {
      if (HelixHelper.getInstanceConfigsMapFor(instance, helixClusterName, helixAdmin)
          .get("shardingKey")
          .equalsIgnoreCase(segmentMetadata.getShardingKey())) {
        selectedInstanceList.add(instance);
      }
    }
    LOGGER.info("Segment assignment result for : " + segmentMetadata.getName() + ", in resource : "
        + segmentMetadata.getTableName() + ", selected instances: " + Arrays.toString(
        selectedInstanceList.toArray()));
    return selectedInstanceList;
  } else {
    throw new RuntimeException("Segment missing sharding key!");
  }
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:24,代码来源:BucketizedSegmentStrategy.java

示例11: PinotLLCRealtimeSegmentManager

import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入依赖的package包/类
protected PinotLLCRealtimeSegmentManager(HelixAdmin helixAdmin, String clusterName, HelixManager helixManager,
    ZkHelixPropertyStore propertyStore, PinotHelixResourceManager helixResourceManager, ControllerConf controllerConf,
    ControllerMetrics controllerMetrics) {
  _helixAdmin = helixAdmin;
  _helixManager = helixManager;
  _propertyStore = propertyStore;
  _helixResourceManager = helixResourceManager;
  _clusterName = clusterName;
  _controllerConf = controllerConf;
  _controllerMetrics = controllerMetrics;
  _idealstateUpdateLocks = new Lock[NUM_LOCKS];
  for (int i = 0; i < NUM_LOCKS; i++) {
    _idealstateUpdateLocks[i] = new ReentrantLock();
  }
  _tableConfigCache = new TableConfigCache(_propertyStore);
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:17,代码来源:PinotLLCRealtimeSegmentManager.java

示例12: buildInitialHighLevelRealtimeIdealStateFor

import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入依赖的package包/类
public static IdealState buildInitialHighLevelRealtimeIdealStateFor(String realtimeTableName,
    TableConfig realtimeTableConfig, HelixAdmin helixAdmin, String helixClusterName,
    ZkHelixPropertyStore<ZNRecord> zkHelixPropertyStore) {
  String realtimeServerTenant =
      ControllerTenantNameBuilder.getRealtimeTenantNameForTenant(realtimeTableConfig.getTenantConfig().getServer());
  final List<String> realtimeInstances = helixAdmin.getInstancesInClusterWithTag(helixClusterName,
      realtimeServerTenant);
  IdealState idealState = buildEmptyKafkaConsumerRealtimeIdealStateFor(realtimeTableName, 1);
  if (realtimeInstances.size() % Integer.parseInt(realtimeTableConfig.getValidationConfig().getReplication()) != 0) {
    throw new RuntimeException(
        "Number of instance in current tenant should be an integer multiples of the number of replications");
  }
  setupInstanceConfigForKafkaHighLevelConsumer(realtimeTableName, realtimeInstances.size(),
      Integer.parseInt(realtimeTableConfig.getValidationConfig().getReplication()),
      realtimeTableConfig.getIndexingConfig().getStreamConfigs(), zkHelixPropertyStore, realtimeInstances);
  return idealState;
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:18,代码来源:PinotTableIdealStateBuilder.java

示例13: testBulkDeleteWithFailures

import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入依赖的package包/类
public void testBulkDeleteWithFailures(boolean useSet) throws Exception {
  HelixAdmin helixAdmin =  makeHelixAdmin();
  ZkHelixPropertyStore<ZNRecord> propertyStore = makePropertyStore();
  FakeDeletionManager deletionManager = new FakeDeletionManager(helixAdmin, propertyStore);
  Collection<String> segments;
  if (useSet) {
    segments = new HashSet<String>();
  } else {
    segments = new ArrayList<String>();
  }

  segments.addAll(segmentsThatShouldBeDeleted());
  segments.addAll(segmentsInIdealStateOrExtView());
  segments.addAll(segmentsFailingPropStore());
  deletionManager.deleteSegmentsFromPropertyStoreAndLocal(tableName, segments);

  Assert.assertTrue(deletionManager.segmentsToRetry.containsAll(segmentsFailingPropStore()));
  Assert.assertTrue(deletionManager.segmentsToRetry.containsAll(segmentsInIdealStateOrExtView()));
  Assert.assertTrue(deletionManager.segmentsRemovedFromStore.containsAll(segmentsThatShouldBeDeleted()));
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:21,代码来源:SegmentDeletionManagerTest.java

示例14: init

import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入依赖的package包/类
@Override
public void init(Configuration configuration, TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore) {
  // TODO jfim This is a broker-level configuration for now, until we refactor the configuration of the routing table to allow per-table routing settings
  if (configuration.containsKey("offlineTargetServerCountPerQuery")) {
    final String targetServerCountPerQuery = configuration.getString("offlineTargetServerCountPerQuery");
    try {
      _targetNumServersPerQuery = Integer.parseInt(targetServerCountPerQuery);
      LOGGER.info("Using offline target server count of {}", _targetNumServersPerQuery);
    } catch (Exception e) {
      LOGGER.warn(
          "Could not get the offline target server count per query from configuration value {}, keeping default value {}",
          targetServerCountPerQuery, _targetNumServersPerQuery, e);
    }
  } else {
    LOGGER.info("Using default value for offline target server count of {}", _targetNumServersPerQuery);
  }
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:18,代码来源:LargeClusterRoutingTableBuilder.java

示例15: init

import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入依赖的package包/类
@Override
public void init(Configuration configuration, TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore) {
  // TODO jfim This is a broker-level configuration for now, until we refactor the configuration of the routing table to allow per-table routing settings
  if (configuration.containsKey("realtimeTargetServerCountPerQuery")) {
    final String targetServerCountPerQuery = configuration.getString("realtimeTargetServerCountPerQuery");
    try {
      _targetNumServersPerQuery = Integer.parseInt(targetServerCountPerQuery);
      LOGGER.info("Using realtime target server count of {}", _targetNumServersPerQuery);
    } catch (Exception e) {
      LOGGER.warn(
          "Could not get the realtime target server count per query from configuration value {}, keeping default value {}",
          targetServerCountPerQuery, _targetNumServersPerQuery, e);
    }
  } else {
    LOGGER.info("Using default value for realtime target server count of {}", _targetNumServersPerQuery);
  }
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:18,代码来源:KafkaLowLevelConsumerRoutingTableBuilder.java


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