Clone Table
void cloneTable(String srcName, String destTable, boolean flushTable)
Function
Tables with existing clones have the same TableSpec and table data
Method parameters
1.srcName : String : required
Table name of the clone source table
2.destTable : String : required
Table name of the clone target table
3.flushTable : boolean : required
The table data is stored in the server's memory and disk. If this option is true, the source table is first brushed to the disk in the memory, then the source table is cloned. The target table and source table data are exactly the same; otherwise, only the source table data in the disk is cloned and the operation delay is less.
Method return value
void
Exception error code
INTERNAL_ERROR(1): Server exception
ACCESS_DENIED(4): No permission to clone table
VALIDATION_FAILED(5): Parameter error
SIZE_EXCEED(6): The space quota or read/write quota exceeds the user's total quota
RESOURCE_NOT_FOUND(9): Source table does not exist
RESOURCE_ALREADY_EXISTS(10): A table with the same name as the target table already exists
RESOURCE_UNAVAILABLE(11) : There are other DDL operations under this account. Does not allow DDL operations at the same time
Limitation
Only the table owner can clone a table
Example
With the Example table, the sample code for cloning table is provided below
$srcName = 'php-note';
$destName = 'php-note-clone';
$adminClient->cloneTable($srcName, $destName, true);