[
https://issues.apache.org/jira/browse/PHOENIX-2999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15347165#comment-15347165
]
Samarth Jain edited comment on PHOENIX-2999 at 6/23/16 8:58 PM:
----------------------------------------------------------------
Thanks for the patch [[email protected]].
{code}
+ Map<String, Set<String>> tenantViewNames =
MetaDataUtil.getTenantViewNames(conn, srcTable);
+ System.out.println("upgrading following
views:"+tenantViewNames);
+ for (String tenantId : tenantViewNames.keySet()) {
+ if (tenantId != null) {
+ props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB,
tenantId);
+ }
+ conn.close();
+ conn = DriverManager.getConnection(jdbcUrl,
props).unwrap(PhoenixConnection.class);
+ for (String viewName : tenantViewNames.get(tenantId)) {
+ UpgradeUtil.upgradeTable(conn, viewName);
+ }
{code}
Using DriverManager.getConnection(url) will end up triggering the jar upgrade
code (i.e. upgrade to 4.8). Not only it will end up adding the new columns
required for 4.8 (which is good), it will also end up upgrading local indexes
(which may or may not be good). Can you work with [~rajeshbabu] and figure out
the right strategy of doing this. One option would be to set the following on
the phoenix connection:
{code}
props.setProperty(QueryServices.LOCAL_INDEX_CLIENT_UPGRADE_ATTRIB, "false");
{code}
I would also suggest to test out whether the upgrading of local indexes is
still working correctly, in both online and offline modes, after your change.
was (Author: samarthjain):
Thanks for the patch [[email protected]].
{code}
+ Map<String, Set<String>> tenantViewNames =
MetaDataUtil.getTenantViewNames(conn, srcTable);
+ System.out.println("upgrading following
views:"+tenantViewNames);
+ for (String tenantId : tenantViewNames.keySet()) {
+ if (tenantId != null) {
+ props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB,
tenantId);
+ }
+ conn.close();
+ conn = DriverManager.getConnection(jdbcUrl,
props).unwrap(PhoenixConnection.class);
+ for (String viewName : tenantViewNames.get(tenantId)) {
+ UpgradeUtil.upgradeTable(conn, viewName);
+ }
{code}
Using DriverManager.getConnection(url) will end up triggering the jar upgrade
code (i.e. upgrade to 4.8). Not only it will end up adding the new columns
required for 4.8 (which is good), it will also end up upgrading local indexes
(which may or may not be good). Can you work with [~rajeshbabu] and figure out
the right strategy of doing this. One option would be to set the following on
the phoenix connection:
{code}
props.setProperty(QueryServices.LOCAL_INDEX_CLIENT_UPGRADE_ATTRIB, "false");
{code}
I would also suggest to test out whether the upgrading of local indexes is
still working correctly after your change.
> Upgrading Multi-tenant table to map with namespace using upgradeUtil
> --------------------------------------------------------------------
>
> Key: PHOENIX-2999
> URL: https://issues.apache.org/jira/browse/PHOENIX-2999
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.8.0
> Reporter: Ankit Singhal
> Assignee: Ankit Singhal
> Fix For: 4.8.0
>
> Attachments: PHOENIX-2999.patch, PHOENIX-2999_v1.patch,
> PHOENIX-2999_v2.patch
>
>
> currently upgradeUtil doesn't handle multi-tenant table with tenant views
> properly.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)