[ https://issues.apache.org/jira/browse/PHOENIX-3757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16218948#comment-16218948 ]
ASF GitHub Bot commented on PHOENIX-3757: ----------------------------------------- Github user joshelser commented on a diff in the pull request: https://github.com/apache/phoenix/pull/277#discussion_r146902970 --- Diff: phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java --- @@ -3101,49 +3124,72 @@ void ensureSystemTablesUpgraded(ReadOnlyProps props) // Regardless of the case 1 or 2, if the NS does not exist, we will error expectedly // below. If the NS does exist and is mapped, the below check will exit gracefully. } - + List<TableName> tableNames = getSystemTableNames(admin); // No tables exist matching "SYSTEM\..*", they are all already in "SYSTEM:.*" if (tableNames.size() == 0) { return; } // Try to move any remaining tables matching "SYSTEM\..*" into "SYSTEM:" if (tableNames.size() > 5) { logger.warn("Expected 5 system tables but found " + tableNames.size() + ":" + tableNames); } + + // Try acquiring a lock in SYSMUTEX table before migrating the tables since it involves disabling the table + // If we cannot acquire lock, it means some old client is either migrating SYSCAT or trying to upgrade the + // schema of SYSCAT table and hence it should not be interrupted + acquiredMutexLock = acquireUpgradeMutex(0, mutexRowKey); + if(acquiredMutexLock) { + logger.debug("Acquired lock in SYSMUTEX table for migrating SYSTEM tables to SYSTEM namespace"); --- End diff -- Log a debug message for the `else` case too? Easier than finding the lack of the above message when debugging.. > 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)