abhishekbafna commented on code in PR #15515:
URL: https://github.com/apache/pinot/pull/15515#discussion_r2059682223
##########
pinot-common/src/main/java/org/apache/pinot/common/config/provider/TableCache.java:
##########
@@ -476,6 +581,49 @@ public synchronized void handleDataDeleted(String path) {
}
}
+ private class ZkLogicalTableChangeListener implements IZkChildListener,
IZkDataListener {
+
+ @Override
+ public synchronized void handleChildChange(String path, List<String>
logicalTableNames) {
+ if (CollectionUtils.isEmpty(logicalTableNames)) {
+ return;
+ }
+
+ // Only process new added logical tables. Changed/removed logical tables
are handled by other callbacks.
+ List<String> pathsToAdd = new ArrayList<>();
+ for (String logicalTableName : logicalTableNames) {
+ if (!_logicalTableNameMap.containsKey(logicalTableName)) {
+ pathsToAdd.add(LOGICAL_TABLE_PATH_PREFIX + logicalTableName);
+ }
+ }
+ if (!pathsToAdd.isEmpty()) {
+ addLogicalTables(pathsToAdd);
+ }
+ notifyLogicalTableChangeListeners();
+ }
+
+ @Override
+ public synchronized void handleDataChange(String path, Object data) {
+ if (data != null) {
+ ZNRecord znRecord = (ZNRecord) data;
+ try {
+ putLogicalTable(znRecord);
+ } catch (Exception e) {
+ LOGGER.error("Caught exception while refreshing logical table for
ZNRecord: {}", znRecord.getId(), e);
+ }
+ notifyLogicalTableChangeListeners();
+ }
+ }
+
+ @Override
+ public synchronized void handleDataDeleted(String path) {
+ // NOTE: The path here is the absolute ZK path instead of the relative
path to the property store.
+ String logicalTableName = path.substring(path.lastIndexOf('/') + 1);
+ removeLogicalTable(LOGICAL_TABLE_PATH_PREFIX + logicalTableName);
+ notifyLogicalTableChangeListeners();
+ }
+ }
+
private static class TableConfigInfo {
Review Comment:
I have got the basic structure for this. So let go ahead with it. We can
extend it further when we work on the query options.
--
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]