[ 
https://issues.apache.org/jira/browse/PHOENIX-2874?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15269344#comment-15269344
 ] 

James Taylor edited comment on PHOENIX-2874 at 5/3/16 6:54 PM:
---------------------------------------------------------------

bq. I need to keep PhoenixIOException( wrapped over constraintException of 
tables present in namespace ) as there will be tables present in the namespace 
which we are not deleting from hbase during dropPriorTable as they are getting 
deleted under dropNonSystemTables()

Does the dropping of a schema also drop/delete the HBase namespace? And does 
that fail if there are tables defined in the namespace? Tests typically have 
the QueryServices.DROP_METADATA_ATTRIB set to false to prevent the HBase admin 
call that drops the metadata (as that call is very expensive). Only the update 
to the SYSTEM.CATALOG table is done instead. The DROP SCHEMA call should 
respect the QueryServices.DROP_METADATA_ATTRIB parameter as well. 

Also, the CREATE SCHEMA call should only throw if the SYSTEM.CATALOG has the 
schema already, but not if the namespace already exists. That'd be consistent 
with how we handle tables.

Minor nit, but how about comparing the SYSTEM schema name before you escape it, 
as that'd improve code readability IMHO:
{code}
+                String schemaName = 
rs.getString(PhoenixDatabaseMetaData.TABLE_SCHEM);
+                
if(schemaName.equals(PhoenixDatabaseMetaData.SYSTEM_SCHEMA_NAME)){
+                    continue;
+                }
+                String ddl = "DROP SCHEMA " + 
SchemaUtil.getEscapedArgument(schemaName);
{code}


was (Author: jamestaylor):
bq. I need to keep PhoenixIOException( wrapped over constraintException of 
tables present in namespace ) as there will be tables present in the namespace 
which we are not deleting from hbase during dropPriorTable as they are getting 
deleted under dropNonSystemTables()

Does the dropping of a schema also drop/delete the HBase namespace? And does 
that fail if there are tables defined in the namespace? Tests typically have 
the QueryServices.DROP_METADATA_ATTRIB set to false to prevent the HBase admin 
call that drops the metadata (as that call is very expensive). Only the update 
to the SYSTEM.CATALOG table is done instead. The DROP SCHEMA call should 
respect the QueryServices.DROP_METADATA_ATTRIB parameter as well. 

Minor nit, but how about comparing the SYSTEM schema name before you escape it, 
as that'd improve code readability IMHO:
{code}
+                String schemaName = 
rs.getString(PhoenixDatabaseMetaData.TABLE_SCHEM);
+                
if(schemaName.equals(PhoenixDatabaseMetaData.SYSTEM_SCHEMA_NAME)){
+                    continue;
+                }
+                String ddl = "DROP SCHEMA " + 
SchemaUtil.getEscapedArgument(schemaName);
{code}

> Delete schemas also during clean up after test 
> -----------------------------------------------
>
>                 Key: PHOENIX-2874
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2874
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Ankit Singhal
>            Assignee: Ankit Singhal
>         Attachments: PHOENIX-2874.patch, PHOENIX-2874_v1.patch, 
> PHOENIX-2874_v2.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to