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

ASF GitHub Bot commented on TRAFODION-2550:
-------------------------------------------

Github user liuyu000 commented on a diff in the pull request:

    
https://github.com/apache/incubator-trafodion/pull/1073#discussion_r113885805
  
    --- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_utilities.adoc ---
    @@ -48,6 +49,326 @@ to connect to and issue SQL utilities, see the
     {docs-url}/client_installation/index.html[_{project-name} Client 
Installation Guide_].
     
     <<<
    +[[cleanup_statement]]
    +== CLEANUP Statement
    +
    +The CLEANUP Statement cleans up objects whose information is inconsistent 
in the metadata. This command can be used to clean up individual objects or all 
objects in a schema. This command can also be used to locate all inconsistent 
objects in the Trafodion metadata and then clean them up.
    +
    +Inconsistent objects can be cleaned up and removed from the metadata and 
HBase by using one of the following options.
    +
    +```
    +CLEANUP {obj-type} {obj-name} [ ,UID {object-uid} ]
    +
    +CLEANUP [ PRIVATE | SHARED ] SCHEMA {schema-name}
    +
    +CLEANUP UID {object-uid}
    +
    +CLEANUP METADATA [ , CHECK ] [ , RETURN DETAILS ]
    +```
    +
    +```
    +{obj-type} is: TABLE | INDEX | SEQUENCE | OBJECT
    +
    +{obj-name} is: Name of the object that needs to be cleaned up
    +
    +{object-uid} is: UID (Unique ID) of the object that is stored in metadata
    +
    +{schema-name} is: Name of the schema whose contents need to be cleaned up
    +```
    +
    +[[cleanup_syntax]]
    +=== Syntax Description of CLEANUP Statement
    +
    +* `CLEANUP {obj-type} {obj-name} [ , UID {object-uid} ]`
    ++
    +This command will clean up the specified object from all Trafodion 
metadata tables
    +and HBase. If an object cannot be found in the metadata but exists in 
HBase,
    +then it will be removed from HBase. All dependent objects, such as indexes,
    +views, LOBs, internal sequences, and constraints, are also removed from the
    +metadata and HBase.
    +
    +** `obj-type` 
    +
    +*** If an object type is specified as TABLE, INDEX, or SEQUENCE and that 
object exists
    +in the metadata, then a check will be done to make sure that the specified 
{obj-name} is of the specified type. An error is returned if they are not the 
same.
    +
    +*** If an object type is specified as OBJECT, then any object that matches 
the
    +specified name is removed from the metadata and HBase.
    +
    +** `obj-name` 
    ++
    +Specifies the name of the object to be removed.
    +
    +** `object-uid` 
    ++
    +If an object exists in the OBJECTS metadata table, then the stored object 
UID is compared with the specified object UID. If they do not match, then 
cleanup is not done. If an object does not exist in the OBJECTS metadata table, 
then all entries matching the specified object UID are removed from the 
metadata tables.
    +
    +* `CLEANUP [ PRIVATE | SHARED ] SCHEMA {schema-name}`
    ++
    +This command will clean up all objects that are created in the specified 
schema.
    +
    +* `CLEANUP UID {object-uid}`
    ++
    +This command will remove all entries from all metadata tables that match 
the specified object UID. If the specified object UID exists in the OBJECTS 
metadata table and the object name associated with that UID can be retrieved, 
then that object is also removed from HBase.
    +
    +* `CLEANUP METADATA [ , CHECK ] [ , RETURN DETAILS ]`
    ++
    +This command will look for inconsistent entries in the metadata, return 
information about them, and clean them up. Multiple checks are done to validate 
metadata consistency.
    +
    +** `CHECK`
    ++
    +One can check for inconsistent metadata entries without actually cleaning 
them up.
    +This can be done by specifying the `CHECK` option. If `CHECK` is 
specified, the following checks will be performed simultaneously, and a summary 
of inconsistent objects belonging to the categories listed below will be 
returned.
    +
    +*** Orphan Metadata Objects
    ++
    +This check is done to validate that objects that exist in metadata also 
exist in HBase. If the object does not exist in HBase, then it is marked as an 
orphan metadata object.
    +
    +*** Orphan HBase Objects
    ++
    +This check is done to validate that objects that exist in HBase also exist 
in metadata. If the object does not exist in metadata, then it is marked as an 
orphan HBase object.
    +
    +*** Inconsistent Object Entries
    ++
    +This check is done to make sure that all entries in the OBJECTS table also 
exist in
    +the OBJECTS unique index (OBJECTS_UNIQ_IDX) and that all entries in 
OBJECTS_UNIQ_IDX also exist in the OBJECTS table. It also checks to make sure 
that all entries in the COLUMNS table have a corresponding entry in the OBJECTS 
table. If any of the previous checks fail, then that entry is marked as 
inconsistent.
    +
    +*** Inconsistent View Entries
    ++
    +This check is done to make sure that all view entries are consistent among 
the views and the OBJECTS table.
    +
    +** `RETURN DETAILS`
    ++
    +If `RETURN DETAILS` is specified, then details on which objects are 
inconsistent is also returned.
    +
    +<<<
    +[[cleanup_considerations]]
    +=== Considerations for CLEANUP Statement
    +
    +[[security_and_privileges]]
    +==== Security and Privileges
    +
    +To clean up an object, one needs to have DROP privileges. If object 
privileges cannot be retrieved from the metadata or if metadata cleanup is 
being done, then one needs to be DB_ROOT to perform the cleanup.
    +
    +[[consistency_checks_during_access]]
    +==== Consistency Checks During Access
    +
    +If an object exists in the metadata but does not exist in HBase, then 
error 4254 will be returned if that object is accessed during any DML or DDL 
operation.
    +
    +An object is also marked as inconsistent during any complex DDL operation. 
For example, if a CREATE TABLE also creates implicit indexes or constraints, 
then the object will be marked as inconsistent until the complex DDL operation 
is completed. If an abnormal error happens (like a process crash or a node 
failure), then that object remains inconsistent. Any attempt to access that 
object will return error 4254.
    --- End diff --
    
    Thanks Dave.
    Your comments has been incorporated. :)


> update sql reference manual about metadata clean up command
> -----------------------------------------------------------
>
>                 Key: TRAFODION-2550
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2550
>             Project: Apache Trafodion
>          Issue Type: Documentation
>            Reporter: liu ming
>            Assignee: Liu Yu
>
> please refer to 
> https://cwiki.apache.org/confluence/display/TRAFODION/Metadata+Cleanup 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to