[
https://issues.apache.org/jira/browse/HBASE-8642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14609672#comment-14609672
]
Ashish Singhi commented on HBASE-8642:
--------------------------------------
Thanks Anoop for the review. Added one example with namespace in v3 patch.
bq. Hope u have tested shell commands with all possible combinations.
Following are the combinations I have tested with their output.
{noformat}
hbase(main):015:0> list
TABLE
ns:t
t
t1
u
4 row(s) in 0.0330 seconds
=> ["ns:t", "t", "t1", "u"]
hbase(main):016:0> list_snapshots
SNAPSHOT TABLE + CREATION TIME
as2 t1 (Wed Jul 01 18:16:07
+0530 2015)
as3 ns:t (Wed Jul 01 18:16:26
+0530 2015)
p t (Wed Jul 01 18:15:54
+0530 2015)
q u (Wed Jul 01 18:16:42
+0530 2015)
s t (Wed Jul 01 18:15:45
+0530 2015)
s1 t (Wed Jul 01 18:15:48
+0530 2015)
s2 t1 (Wed Jul 01 18:16:01
+0530 2015)
s3 ns:t (Wed Jul 01 18:16:22
+0530 2015)
s4 u (Wed Jul 01 18:16:47
+0530 2015)
9 row(s) in 0.0780 seconds
=> ["as2", "as3", "p", "q", "s", "s1", "s2", "s3", "s4"]
hbase(main):017:0> delete_table_snapshots '.*'
SNAPSHOT TABLE + CREATION TIME
as2 t1 (Wed Jul 01 18:16:07
+0530 2015)
as3 ns:t (Wed Jul 01 18:16:26
+0530 2015)
p t (Wed Jul 01 18:15:54
+0530 2015)
q u (Wed Jul 01 18:16:42
+0530 2015)
s t (Wed Jul 01 18:15:45
+0530 2015)
s1 t (Wed Jul 01 18:15:48
+0530 2015)
s2 t1 (Wed Jul 01 18:16:01
+0530 2015)
s3 ns:t (Wed Jul 01 18:16:22
+0530 2015)
s4 u (Wed Jul 01 18:16:47
+0530 2015)
Delete the above 9 snapshots (y/n)?
n
hbase(main):018:0> delete_table_snapshots '.*', '.*'
SNAPSHOT TABLE + CREATION TIME
as2 t1 (Wed Jul 01 18:16:07
+0530 2015)
as3 ns:t (Wed Jul 01 18:16:26
+0530 2015)
p t (Wed Jul 01 18:15:54
+0530 2015)
q u (Wed Jul 01 18:16:42
+0530 2015)
s t (Wed Jul 01 18:15:45
+0530 2015)
s1 t (Wed Jul 01 18:15:48
+0530 2015)
s2 t1 (Wed Jul 01 18:16:01
+0530 2015)
s3 ns:t (Wed Jul 01 18:16:22
+0530 2015)
s4 u (Wed Jul 01 18:16:47
+0530 2015)
Delete the above 9 snapshots (y/n)?
n
hbase(main):022:0> delete_table_snapshots 't.*'
SNAPSHOT TABLE + CREATION TIME
as2 t1 (Wed Jul 01 18:16:07
+0530 2015)
p t (Wed Jul 01 18:15:54
+0530 2015)
s t (Wed Jul 01 18:15:45
+0530 2015)
s1 t (Wed Jul 01 18:15:48
+0530 2015)
s2 t1 (Wed Jul 01 18:16:01
+0530 2015)
Delete the above 5 snapshots (y/n)?
n
hbase(main):023:0> delete_table_snapshots 't.*', 's.*'
SNAPSHOT TABLE + CREATION TIME
s t (Wed Jul 01 18:15:45
+0530 2015)
s1 t (Wed Jul 01 18:15:48
+0530 2015)
s2 t1 (Wed Jul 01 18:16:01
+0530 2015)
Delete the above 3 snapshots (y/n)?
n
hbase(main):024:0> delete_table_snapshots 'ns:t.*', 's.*'
SNAPSHOT TABLE + CREATION TIME
s3 ns:t (Wed Jul 01 18:16:22
+0530 2015)
Delete the above 1 snapshots (y/n)?
n
hbase(main):025:0> delete_table_snapshots 'ns:t.*'
SNAPSHOT TABLE + CREATION TIME
as3 ns:t (Wed Jul 01 18:16:26
+0530 2015)
s3 ns:t (Wed Jul 01 18:16:22
+0530 2015)
Delete the above 2 snapshots (y/n)?
n
hbase(main):026:0> delete_table_snapshots 'ns:t.*'
SNAPSHOT TABLE + CREATION TIME
as3 ns:t (Wed Jul 01 18:16:26
+0530 2015)
s3 ns:t (Wed Jul 01 18:16:22
+0530 2015)
Delete the above 2 snapshots (y/n)?
y
0 row(s) in 0.1060 seconds
2 snapshots successfully deleted.
hbase(main):027:0> delete_table_snapshots '.*', 's.*'
SNAPSHOT TABLE + CREATION TIME
s t (Wed Jul 01 18:15:45
+0530 2015)
s1 t (Wed Jul 01 18:15:48
+0530 2015)
s2 t1 (Wed Jul 01 18:16:01
+0530 2015)
s4 u (Wed Jul 01 18:16:47
+0530 2015)
Delete the above 4 snapshots (y/n)?
y
0 row(s) in 0.0910 seconds
4 snapshots successfully deleted.
hbase(main):028:0> delete_table_snapshots '.*', '.*'
SNAPSHOT TABLE + CREATION TIME
as2 t1 (Wed Jul 01 18:16:07
+0530 2015)
p t (Wed Jul 01 18:15:54
+0530 2015)
q u (Wed Jul 01 18:16:42
+0530 2015)
Delete the above 3 snapshots (y/n)?
y
0 row(s) in 0.0720 seconds
3 snapshots successfully deleted.
hbase(main):030:0> delete_table_snapshots '.*'
SNAPSHOT TABLE + CREATION TIME
No snapshots matched the table name regular expression .* and the snapshot name
regular expression .*
hbase(main):032:0> delete_table_snapshots 't'
SNAPSHOT TABLE + CREATION TIME
No snapshots matched the table name regular expression t and the snapshot name
regular expression .*
hbase(main):033:0> delete_table_snapshots
ERROR: wrong number of arguments (0 for 1)
Here is some help for this command:
Delete all of the snapshots matching the given table name regular expression
and snapshot name regular expression.
By default snapshot name regular expression will delete all the snapshots of the
matching table name regular expression.
Examples:
hbase> delete_table_snapshots 'tableName'
hbase> delete_table_snapshots 'tableName.*'
hbase> delete_table_snapshots 'tableName' 'snapshotName'
hbase> delete_table_snapshots 'tableName' 'snapshotName.*'
hbase> delete_table_snapshots 'tableName.*' 'snapshotName.*'
hbase> delete_table_snapshots 'ns:tableName.*' 'snapshotName.*'
{noformat}
> [Snapshot] List and delete snapshot by table
> --------------------------------------------
>
> Key: HBASE-8642
> URL: https://issues.apache.org/jira/browse/HBASE-8642
> Project: HBase
> Issue Type: Improvement
> Components: snapshots
> Affects Versions: 0.98.0, 0.95.0, 0.95.1, 0.95.2
> Reporter: Julian Zhou
> Assignee: Ashish Singhi
> Fix For: 2.0.0
>
> Attachments: 8642-trunk-0.95-v0.patch, 8642-trunk-0.95-v1.patch,
> 8642-trunk-0.95-v2.patch, HBASE-8642-v1.patch, HBASE-8642-v2.patch,
> HBASE-8642-v3.patch, HBASE-8642.patch
>
>
> Support list and delete snapshots by table names.
> User scenario:
> A user wants to delete all the snapshots which were taken in January month
> for a table 't' where snapshot names starts with 'Jan'.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)