mcvsubbu commented on a change in pull request #7984:
URL: https://github.com/apache/pinot/pull/7984#discussion_r782540779
##########
File path:
pinot-common/src/main/java/org/apache/pinot/common/config/provider/TableCache.java
##########
@@ -142,24 +153,38 @@ public String getActualTableName(String
caseInsensitiveTableName) {
* Returns the table config for the given table, or {@code null} if it does
not exist.
*/
@Nullable
+ @Override
public TableConfig getTableConfig(String tableNameWithType) {
return _tableConfigMap.get(tableNameWithType);
}
+ @Override
+ public List<TableConfig>
registerTableConfigChangeListener(TableConfigChangeListener
tableConfigChangeListener) {
+ _tableConfigChangeListeners.add(tableConfigChangeListener);
+ return Lists.newArrayList(_tableConfigMap.values());
+ }
+
/**
* Returns the schema for the given table, or {@code null} if it does not
exist.
*/
@Nullable
+ @Override
public Schema getSchema(String rawTableName) {
String schemaName = _schemaNameMap.getOrDefault(rawTableName,
rawTableName);
SchemaInfo schemaInfo = _schemaInfoMap.get(schemaName);
return schemaInfo != null ? schemaInfo._schema : null;
}
+ @Override
+ public List<Schema> registerSchemaChangeListener(SchemaChangeListener
schemaChangeListener) {
Review comment:
should be synchronized so that we don't collide with notification that
may come in another thread.
##########
File path:
pinot-common/src/main/java/org/apache/pinot/common/config/provider/TableCache.java
##########
@@ -45,10 +52,11 @@
/**
+ * An implementation of {@link PinotConfigProvider}
* The {@code TableCache} caches all the table configs and schemas within the
cluster, and listens on ZK changes to keep
* them in sync. It also maintains the table name map and the column name map
for case-insensitive queries.
*/
-public class TableCache {
+public class TableCache implements PinotConfigProvider {
Review comment:
Maybe good to rename this as DefaultConfigProvider (or some such), but
perhaps that is better done in another PR.
##########
File path:
pinot-common/src/main/java/org/apache/pinot/common/config/provider/TableCache.java
##########
@@ -142,24 +153,38 @@ public String getActualTableName(String
caseInsensitiveTableName) {
* Returns the table config for the given table, or {@code null} if it does
not exist.
*/
@Nullable
+ @Override
public TableConfig getTableConfig(String tableNameWithType) {
return _tableConfigMap.get(tableNameWithType);
}
+ @Override
+ public List<TableConfig>
registerTableConfigChangeListener(TableConfigChangeListener
tableConfigChangeListener) {
Review comment:
should be synchronized so that we don't collide with the notification
thread
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]