Description
When PTable object is built for any given table as part of getTable() API, many recursive getTable() calls are made in order to build the full PTable object with all details of parent table/view hierarchy as well as index tables.
Moreover, PHOENIX-6247 introduced a way to separate Phoenix logical table name from HBase physical table name. As part of this, the num of recursive getTable() calls have increased but more importantly in case of view index, the num of getTable() RPC calls using server-side CQSI connection has also increased, which are redundant as the view index table does not have corresponding PTable representation in Phoenix.
} else if (Bytes.compareTo(LINK_TYPE_BYTES, 0, LINK_TYPE_BYTES.length, colKv.getQualifierArray(), colKv.getQualifierOffset(), colKv.getQualifierLength()) == 0) { LinkType linkType = LinkType.fromSerializedValue(colKv.getValueArray()[colKv.getValueOffset()]); if (linkType == LinkType.INDEX_TABLE) { addIndexToTable(tenantId, schemaName, famName, tableName, clientTimeStamp, indexes, clientVersion); } else if (linkType == PHYSICAL_TABLE) { // famName contains the logical name of the parent table. We need to get the actual physical name of the table PTable parentTable = null; if (indexType != IndexType.LOCAL) { parentTable = getTable(null, SchemaUtil.getSchemaNameFromFullName(famName.getBytes()).getBytes(StandardCharsets.UTF_8), SchemaUtil.getTableNameFromFullName(famName.getBytes()).getBytes(StandardCharsets.UTF_8), clientTimeStamp, clientVersion); if (parentTable == null || isTableDeleted(parentTable)) { // parentTable is not in the cache. Since famName is only logical name, we need to find the physical table. try (PhoenixConnection connection = QueryUtil.getConnectionOnServer(env.getConfiguration()).unwrap(PhoenixConnection.class)) { parentTable = connection.getTableNoCache(famName.getString()); } catch (TableNotFoundException e) { // It is ok to swallow this exception since this could be a view index and _IDX_ table is not there. } } }
Under heavy load, the situation can get worse and occupy all metadata handler threads, freezing the regionserver hosting SYSTEM.CATALOG.
The proposal for this Jira:
- For View Index table, do not perform any getTable() call. This will also avoid large num of RPC calls.
- Only for splittable SYSTEM.CATALOG, we should allow getTable() RPC calls if the scanning of local region provides null PTable.
Attachments
Issue Links
- is caused by
-
PHOENIX-6247 Change SYSTEM.CATALOG to allow separation of physical name (Hbase name) from logical name (Phoenix name)
- Resolved
- links to