[
https://issues.apache.org/jira/browse/PHOENIX-2099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Samarth Jain updated PHOENIX-2099:
----------------------------------
Attachment: PHOENIX-2099_v4.patch
[~jamestaylor] - please review the patch when you get a chance. Below are the
things that I tested out:
1) Old client - new server
- adding column to a table that has views fails
- adding column to a table that has no views works
2) Old to new client upgrade - new server
- base column count updated
- adding column to a table that has views works
- adding column to a table that has no views works
- Concurrently altering table from old and new clients works.
A special case worthy of mentioning here - after the upgrade is completed, an
old client is now able to add new columns to a base table with views. This is
the side effect of doing validation on the server side. As far as I can tell,
this should be OK. Let me know if you think otherwise. The upgrade basically
negates the below validation:
{code}
+ /*
+ * Adding a column is not allowed if the meta-data
for child view/s spans over
+ * more than one region (since the changes cannot
be made in a transactional fashion)
+ * A base column count of 0 means that the metadata
hasn't been upgraded yet or
+ * is currently in progress. If that is the case,
disallow adding columns for tables
+ * with views.
+ */
+ if (!childViewsResult.allViewsInSingleRegion() ||
table.getBaseColumnCount() == 0) {
return new
MetaDataMutationResult(MutationCode.UNALLOWED_TABLE_MUTATION,
EnvironmentEdgeManager.currentTimeMillis(), null);
}
{code}
3) New client - new server
- base column count set for every new table being created
- base column count changed after a column is added to base table
- able to add columns to tables with views
- able to add columns with no views
> Backward Compatibility - Concurrent modification error on connect
> -----------------------------------------------------------------
>
> Key: PHOENIX-2099
> URL: https://issues.apache.org/jira/browse/PHOENIX-2099
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.5.0
> Reporter: Mujtaba Chohan
> Assignee: Samarth Jain
> Attachments: PHOENIX-2099-v3.patch, PHOENIX-2099.patch,
> PHOENIX-2099.v2.patch, PHOENIX-2099_v4.patch
>
>
> With client/server on v4.3.0. Create few tables. Upgrade client/server to
> latest 4.x-0.98 and connect:
> Exception:
> Error: ERROR 301 (23000): Concurrent modification to table.
> tableName=SYSTEM.CATALOG (state=23000,code=301)
> org.apache.phoenix.schema.ConcurrentTableMutationException: ERROR 301
> (23000): Concurrent modification to table. tableName=SYSTEM.CATALOG
> at
> org.apache.phoenix.schema.MetaDataClient.processMutationResult(MetaDataClient.java:2223)
> at
> org.apache.phoenix.schema.MetaDataClient.addColumn(MetaDataClient.java:2518)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableAddColumnStatement$1.execute(PhoenixStatement.java:893)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:303)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:295)
> at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:293)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeUpdate(PhoenixStatement.java:1189)
> at
> org.apache.phoenix.query.ConnectionQueryServicesImpl.addColumn(ConnectionQueryServicesImpl.java:1836)
> at
> org.apache.phoenix.query.ConnectionQueryServicesImpl.access$600(ConnectionQueryServicesImpl.java:174)
> at
> org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:1958)
> at
> org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:1868)
> at
> org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:77)
> at
> org.apache.phoenix.query.ConnectionQueryServicesImpl.init(ConnectionQueryServicesImpl.java:1868)
> at
> org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:180)
> at
> org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.connect(PhoenixEmbeddedDriver.java:132)
> at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:151)
> at sqlline.SqlLine$DatabaseConnection.connect(SqlLine.java:4650)
> at sqlline.SqlLine$DatabaseConnection.getConnection(SqlLine.java:4701)
> Also getting the exception when connecting with v4.3.0 on client and latest
> 4.x-0.98 on server:
> 0: jdbc:phoenix:localhost> ALTER TABLE T1 ADD TESTCOL1 VARCHAR, TESTCOL2
> INTEGER;
> Error: ERROR 301 (23000): Concurrent modification to table. tableName=T1
> (state=23000,code=301)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)