This is an automated email from the ASF dual-hosted git repository. xiangfu 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 f7c42c82ae logging error if tableConfig is null while retrieving all tables for a tenant (#10080) f7c42c82ae is described below commit f7c42c82ae752f49aafb17339fae38de04fd3c74 Author: robertzych <robert.z...@gmail.com> AuthorDate: Mon Jan 9 02:18:00 2023 -0800 logging error if tableConfig is null while retrieving all tables for a tenant (#10080) --- .../api/resources/PinotTenantRestletResource.java | 4 ++++ .../controller/api/PinotTenantRestletResourceTest.java | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTenantRestletResource.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTenantRestletResource.java index 6aa164a9c1..d1c89d206a 100644 --- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTenantRestletResource.java +++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTenantRestletResource.java @@ -246,6 +246,10 @@ public class PinotTenantRestletResource { for (String table : _pinotHelixResourceManager.getAllTables()) { TableConfig tableConfig = _pinotHelixResourceManager.getTableConfig(table); + if (tableConfig == null) { + LOGGER.error("Unable to retrieve table config for table: {}", table); + continue; + } String tableConfigTenant = tableConfig.getTenantConfig().getServer(); if (tenantName.equals(tableConfigTenant)) { tables.add(table); diff --git a/pinot-controller/src/test/java/org/apache/pinot/controller/api/PinotTenantRestletResourceTest.java b/pinot-controller/src/test/java/org/apache/pinot/controller/api/PinotTenantRestletResourceTest.java index cdd482fa97..d34c5e6806 100644 --- a/pinot-controller/src/test/java/org/apache/pinot/controller/api/PinotTenantRestletResourceTest.java +++ b/pinot-controller/src/test/java/org/apache/pinot/controller/api/PinotTenantRestletResourceTest.java @@ -19,6 +19,8 @@ package org.apache.pinot.controller.api; import com.fasterxml.jackson.databind.JsonNode; +import org.apache.helix.store.zk.ZkHelixPropertyStore; +import org.apache.helix.zookeeper.datamodel.ZNRecord; import org.apache.pinot.common.utils.config.TagNameUtils; import org.apache.pinot.controller.helix.ControllerTest; import org.apache.pinot.spi.config.table.TableType; @@ -67,6 +69,17 @@ public class PinotTenantRestletResourceTest { } assertTrue(found); + + // reset the ZK node to simulate corruption + ZkHelixPropertyStore<ZNRecord> propertyStore = TEST_INSTANCE.getPropertyStore(); + String zkPath = "/CONFIGS/TABLE/" + TABLE_NAME; + ZNRecord znRecord = propertyStore.get(zkPath, null, 0); + propertyStore.set(zkPath, new ZNRecord(znRecord.getId()), 1); + + // Now there should be no tables + tableList = JsonUtils.stringToJsonNode(ControllerTest.sendGetRequest(listTablesUrl)); + tables = tableList.get("tables"); + assertEquals(tables.size(), 0); } @AfterClass --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org