gokceni commented on a change in pull request #499: Phoenix-5272 ALTER INDEX 
REBUILD ALL 
URL: https://github.com/apache/phoenix/pull/499#discussion_r288793488
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
 ##########
 @@ -4362,18 +4365,40 @@ public MutationState alterIndex(AlterIndexStatement 
statement) throws SQLExcepti
                     // Set so that we get the table below with the potentially 
modified rowKeyOrderOptimizable flag set
                     indexRef.setTable(result.getTable());
                     if (newIndexState == PIndexState.BUILDING && isAsync) {
-                        try {
-                            tableUpsert = 
connection.prepareStatement(UPDATE_INDEX_REBUILD_ASYNC_STATE);
-                            tableUpsert.setString(1,
-                                    connection.getTenantId() == null ? null : 
connection.getTenantId().getString());
-                            tableUpsert.setString(2, schemaName);
-                            tableUpsert.setString(3, indexName);
-                            tableUpsert.setLong(4, 
result.getTable().getTimeStamp());
-                            tableUpsert.execute();
-                            connection.commit();
-                        } finally {
-                            if (tableUpsert != null) {
-                                tableUpsert.close();
+                        if (isRebuildAll) {
+                            List<Task.TaskRecord> tasks = 
Task.queryTaskTable(connection, schemaName, tableName, 
PTable.TaskType.INDEX_REBUILD,
 
 Review comment:
   queryTaskTable queries Task table with given parameters. The parameters 
include both index name and table name so, it checks if we have a task for 
building given index on the given table. If there is another task that builds 
another index on the same table, tasks.size will be equal to 0. I hope this 
answers your question

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to