Jackie-Jiang commented on code in PR #15956:
URL: https://github.com/apache/pinot/pull/15956#discussion_r2122213266


##########
pinot-common/src/main/java/org/apache/pinot/common/messages/TableSchemaRefreshMessage.java:
##########
@@ -0,0 +1,54 @@
+/**
+ * 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.common.messages;
+
+import java.util.UUID;
+import org.apache.helix.model.Message;
+import org.apache.helix.zookeeper.datamodel.ZNRecord;
+
+public class TableSchemaRefreshMessage extends Message {

Review Comment:
   Rename it to `TableConfigSchemaRefreshMessage` given it refreshes both



##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/BaseTableDataManager.java:
##########
@@ -398,6 +396,15 @@ public Pair<TableConfig, Schema> 
getCachedTableConfigAndSchema() {
     return _cachedTableConfigAndSchema;
   }
 
+  @Override
+  public void refreshCachedTableConfigAndSchema() {

Review Comment:
   We need to invoke `TimestampIndexUtils.applyTimestampIndex()` which could 
modify `schema` before caching it. We can also consider just call 
`fetchIndexLoadingConfig()` without introducing this method



##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -1585,13 +1586,26 @@ public void updateSchema(Schema schema, boolean reload, 
boolean forceTableSchema
     }
 
     updateSchema(schema, oldSchema, forceTableSchemaUpdate);
-
-    if (reload) {
-      LOGGER.info("Reloading tables with name: {}", schemaName);
-      List<String> tableNamesWithType = 
getExistingTableNamesWithType(schemaName, null);
+    List<String> tableNamesWithType;
+    try {
+      tableNamesWithType = getExistingTableNamesWithType(schemaName, null);
+      if (reload) {
+        LOGGER.info("Reloading tables with name: {}", schemaName);
+        for (String tableNameWithType : tableNamesWithType) {
+          reloadAllSegments(tableNameWithType, false, null);
+        }
+      }
+      // Send schema refresh message to all tables that use this schema
       for (String tableNameWithType : tableNamesWithType) {
-        reloadAllSegments(tableNameWithType, false, null);
+        LOGGER.info("Sending updated schema message for table: {}", 
tableNameWithType);
+        sendTableSchemaRefreshMessage(tableNameWithType);

Review Comment:
   We don't need to send this if reload is enabled. Reload will also fetch new 
table config and schema



##########
pinot-common/src/main/java/org/apache/pinot/common/messages/TableSchemaRefreshMessage.java:
##########
@@ -0,0 +1,54 @@
+/**
+ * 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.common.messages;
+
+import java.util.UUID;
+import org.apache.helix.model.Message;
+import org.apache.helix.zookeeper.datamodel.ZNRecord;
+
+public class TableSchemaRefreshMessage extends Message {
+  public static final String REFRESH_TABLE_SCHEMA = "REFRESH_TABLE_SCHEMA";

Review Comment:
   Also adjust this field



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to