[ https://issues.apache.org/jira/browse/PHOENIX-6086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17225731#comment-17225731 ]
ASF GitHub Bot commented on PHOENIX-6086: ----------------------------------------- yanxinyi commented on a change in pull request #952: URL: https://github.com/apache/phoenix/pull/952#discussion_r517022108 ########## File path: phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java ########## @@ -3821,17 +3823,37 @@ public void upgradeSystemTables(final String url, final Properties props) throws } sysCatalogTableName = SchemaUtil.getPhysicalName(SYSTEM_CATALOG_NAME_BYTES, this.getProps()).getNameAsString(); if (SchemaUtil.isNamespaceMappingEnabled(PTableType.SYSTEM, ConnectionQueryServicesImpl.this.getProps())) { + String snapshotName = null; // Try acquiring a lock in SYSMUTEX table before migrating the tables since it involves disabling the table. if (acquiredMutexLock = acquireUpgradeMutex(MetaDataProtocol.MIN_SYSTEM_TABLE_MIGRATION_TIMESTAMP)) { LOGGER.debug("Acquired lock in SYSMUTEX table for migrating SYSTEM tables to SYSTEM namespace " + "and/or upgrading " + sysCatalogTableName); + snapshotName = getSysTableSnapshotName( + currentServerSideTableTimeStamp, SYSTEM_CATALOG_NAME); + createSnapshot(snapshotName, SYSTEM_CATALOG_NAME); + systemTableToSnapshotMap.put(SYSTEM_CATALOG_NAME, + snapshotName); + LOGGER.debug("Created snapshot for {}", SYSTEM_CATALOG_NAME); Review comment: nit: we should change the logging level from debug to info since this rarely happens, and we need this information for sure. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Take a snapshot of all SYSTEM tables before attempting to upgrade them > ---------------------------------------------------------------------- > > Key: PHOENIX-6086 > URL: https://issues.apache.org/jira/browse/PHOENIX-6086 > Project: Phoenix > Issue Type: Improvement > Affects Versions: 5.0.0, 4.15.0 > Reporter: Chinmay Kulkarni > Assignee: Viraj Jasani > Priority: Critical > Fix For: 5.1.0, 4.16.0 > > Attachments: PHOENIX-6086.master.000.patch, > PHOENIX-6086.master.002.patch > > > Currently we only take a snapshot of SYSTEM.CATALOG before attempting to > upgrade it (see > [this|https://github.com/apache/phoenix/blob/1922895dfe5960dc025709b04acfaf974d3959dc/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java#L3718]). > From 4.15 onwards we also store critical metadata information in other > SYSTEM tables like SYSTEM.CHILD_LINK, so it is beneficial to also snapshot > those tables before upgrading them henceforth. > We also currently don't take a snapshot of SYSTEM.CATALOG on receiving an > [UpgradeRequiredException|https://github.com/apache/phoenix/blob/1922895dfe5960dc025709b04acfaf974d3959dc/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java#L3685-L3707] > which we should do. > In case of any errors during the upgrade, we restore SYSTEM.CATALOG from this > snapshot and we should extend this to all tables. In cases where the table > didn't exist before the upgrade, we need to ensure it is dropped so that a > subsequent upgrade attempt can start afresh. -- This message was sent by Atlassian Jira (v8.3.4#803005)