phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Sukhanov <>
Subject SchemaUtil.getTableNameFromFullName() do not respect IS_NAMESPACE_MAPPING_ENABLED flag
Date Thu, 07 Sep 2017 11:17:03 GMT

We experienced one problem in hdp (includes schema mapping feature from
4.8) and I can see the same problem in master. The problem itself quite easy to understand,
but what it can break is a big question.

Class org.apache.phoenix.util,SchemaUtil has getSchemaNameFromFullName <>
and getTableNameFromFullName <>
methods that do not respect IS_NAMESPACE_MAPPING_ENABLED flag. Moreover methods treat namespace
as a schema even though flag is supposed to be FALSE by default. I am pretty surprised that
it wasn’t discovered before and might be I am wrong. I found only one related bug and wrote
comment PHOENIX-3460 <>.

The problem can cause quite nasty bugs. Please find method PhoenixRuntime#generateColumnInfo
(btw there is another method in SchemaUtil with another implementation) and see how it works
with table name and cache. The method calls PhoenixRuntime#getTable <>
with normalized table name and if cache doesn’t contain the table, it tries to update cache
but with table name returned by getTableNameFromFullName and fails.

Consider an example (schema mapping feature is disabled):

generateColumnInfo("\"ns:my_table\"") -> getTable("ns:my_table") -> MetaDataClient#updateCache("ns",

Therefore it looks up for the table "ns:my_table" in cache but updates cache with "ns.my_table"
and throws exception with "ns:my_table". So this problem depends on the cache state which
makes it really nasty. The exception with a wrong table name is also something to consider.

Alright, questions:

1) Am I right?
2) Is there any plan to get rid of those methods?
3) Is there any plan to fix those methods or namespace mapping is must be always turned on?

If there any suggestion how it should be fixed I can help with that. In our project we changed
methods to default behavior (IS_NAMESPACE_MAPPING_ENABLED=false) but I do not see clear way
to fetch this flag from config.

// Stas
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message