You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2021/12/24 01:27:14 UTC
[pinot] branch master updated: Remove TableConfigCache which does not listen on ZK changes (#7943)
This is an automated email from the ASF dual-hosted git repository.
jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 0bf4086 Remove TableConfigCache which does not listen on ZK changes (#7943)
0bf4086 is described below
commit 0bf408615cb8dc96defa80f4b8a0c302741dd40c
Author: Xiaotian (Jackie) Jiang <17...@users.noreply.github.com>
AuthorDate: Thu Dec 23 17:26:53 2021 -0800
Remove TableConfigCache which does not listen on ZK changes (#7943)
---
.../realtime/PinotLLCRealtimeSegmentManager.java | 17 +++---
.../helix/core/realtime/TableConfigCache.java | 63 ----------------------
2 files changed, 9 insertions(+), 71 deletions(-)
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/PinotLLCRealtimeSegmentManager.java b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/PinotLLCRealtimeSegmentManager.java
index f04bffa..00b6560 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/PinotLLCRealtimeSegmentManager.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/PinotLLCRealtimeSegmentManager.java
@@ -29,7 +29,6 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
-import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Lock;
@@ -155,7 +154,6 @@ public class PinotLLCRealtimeSegmentManager {
private final MetadataEventNotifierFactory _metadataEventNotifierFactory;
private final int _numIdealStateUpdateLocks;
private final Lock[] _idealStateUpdateLocks;
- private final TableConfigCache _tableConfigCache;
private final FlushThresholdUpdateManager _flushThresholdUpdateManager;
private final boolean _isDeepStoreLLCSegmentUploadRetryEnabled;
@@ -179,7 +177,6 @@ public class PinotLLCRealtimeSegmentManager {
for (int i = 0; i < _numIdealStateUpdateLocks; i++) {
_idealStateUpdateLocks[i] = new ReentrantLock();
}
- _tableConfigCache = new TableConfigCache(_propertyStore);
_flushThresholdUpdateManager = new FlushThresholdUpdateManager();
_isDeepStoreLLCSegmentUploadRetryEnabled = controllerConf.isDeepStoreRetryUploadLLCSegmentEnabled();
if (_isDeepStoreLLCSegmentUploadRetryEnabled) {
@@ -342,16 +339,20 @@ public class PinotLLCRealtimeSegmentManager {
_helixResourceManager.deleteSegments(realtimeTableName, segmentsToRemove);
}
+ // TODO: Consider using TableCache to read the table config
@VisibleForTesting
public TableConfig getTableConfig(String realtimeTableName) {
+ TableConfig tableConfig;
try {
- return _tableConfigCache.getTableConfig(realtimeTableName);
- } catch (ExecutionException e) {
+ tableConfig = ZKMetadataProvider.getTableConfig(_propertyStore, realtimeTableName);
+ } catch (Exception e) {
_controllerMetrics.addMeteredTableValue(realtimeTableName, ControllerMeter.LLC_ZOOKEEPER_FETCH_FAILURES, 1L);
- throw new IllegalStateException(
- "Caught exception while loading table config from property store to cache for table: " + realtimeTableName,
- e);
+ throw e;
+ }
+ if (tableConfig == null) {
+ throw new IllegalStateException("Failed to find table config for table: " + realtimeTableName);
}
+ return tableConfig;
}
@VisibleForTesting
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/TableConfigCache.java b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/TableConfigCache.java
deleted file mode 100644
index 48901ec..0000000
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/TableConfigCache.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.pinot.controller.helix.core.realtime;
-
-import com.google.common.base.Preconditions;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
-import org.apache.helix.ZNRecord;
-import org.apache.helix.store.zk.ZkHelixPropertyStore;
-import org.apache.pinot.common.metadata.ZKMetadataProvider;
-import org.apache.pinot.spi.config.table.TableConfig;
-
-
-/**
- * Cache for table config.
- */
-public class TableConfigCache {
-
- // TODO: Make cache size, timeout configurable through controller config.
- private static final long DEFAULT_CACHE_SIZE = 50;
- private static final long DEFAULT_CACHE_TIMEOUT_IN_MINUTE = 60;
-
- private final LoadingCache<String, TableConfig> _tableConfigCache;
-
- public TableConfigCache(ZkHelixPropertyStore<ZNRecord> propertyStore) {
- _tableConfigCache = CacheBuilder.newBuilder().maximumSize(DEFAULT_CACHE_SIZE)
- .expireAfterWrite(DEFAULT_CACHE_TIMEOUT_IN_MINUTE, TimeUnit.MINUTES)
- .build(new CacheLoader<String, TableConfig>() {
- @Override
- public TableConfig load(@Nonnull String tableNameWithType) {
- TableConfig tableConfig = ZKMetadataProvider.getTableConfig(propertyStore, tableNameWithType);
- Preconditions
- .checkState(tableConfig != null, "Failed to find table config for table: %s", tableNameWithType);
- return tableConfig;
- }
- });
- }
-
- public TableConfig getTableConfig(String tableNameWithType)
- throws ExecutionException {
- return _tableConfigCache.get(tableNameWithType);
- }
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org