[
https://issues.apache.org/jira/browse/PHOENIX-3757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16219455#comment-16219455
]
ASF GitHub Bot commented on PHOENIX-3757:
-----------------------------------------
Github user karanmehta93 commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/277#discussion_r146974246
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
---
@@ -2526,8 +2541,14 @@ private void
createOtherSystemTables(PhoenixConnection metaConnection) throws SQ
try {
metaConnection.createStatement().execute(QueryConstants.CREATE_FUNCTION_METADATA);
} catch (TableAlreadyExistsException ignore) {}
+ // We catch TableExistsException in createSysMutexTable() and
ignore it. Hence we will also ignore IOException here.
+ // SYSTEM.MUTEX table should not be exposed to user. Hence it is
directly created and used via HBase API.
+ // Using 'CREATE TABLE' statement will add entries to
SYSTEM.CATALOG table, which should not happen.
+ try {
+ createSysMutexTable(hBaseAdmin,
ConnectionQueryServicesImpl.this.getProps());
+ } catch (IOException ignore) {}
--- End diff --
Yes, this is a serious case that we should discuss. The correct thing to do
is to probably FAIL the connection itself or possibly have a retry logic for
creating the table.
This is because in the `acquireUpgradeMutex()` method we check if either
SYSMUTEX exists or SYS:MUTEX table exists. The only possible case where both of
those tables can be missing is when a client is trying to migrate the table,
which disables the old table and creates the new one. There is a brief period
of time when none of these table exists. Hence we throw
`UpgradeInProgressException` exception in such a case.
We have no way to determine if the table doesn't exist at well v/s the
point that the table is in migration.
Is there any other scenario in which this can affect?
> System mutex table not being created in SYSTEM namespace when namespace
> mapping is enabled
> ------------------------------------------------------------------------------------------
>
> Key: PHOENIX-3757
> URL: https://issues.apache.org/jira/browse/PHOENIX-3757
> Project: Phoenix
> Issue Type: Bug
> Reporter: Josh Elser
> Assignee: Karan Mehta
> Priority: Critical
> Labels: namespaces
> Fix For: 4.13.0
>
> Attachments: PHOENIX-3757.001.patch, PHOENIX-3757.002.patch,
> PHOENIX-3757.003.patch
>
>
> Noticed this issue while writing a test for PHOENIX-3756:
> The SYSTEM.MUTEX table is always created in the default namespace, even when
> {{phoenix.schema.isNamespaceMappingEnabled=true}}. At a glance, it looks like
> the logic for the other system tables isn't applied to the mutex table.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)