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

Paulo Motta commented on CASSANDRA-18102:
-----------------------------------------

{quote}I reworked the whole implementation a little bit. We need to retrieve 
these snapshots from snapshot loader.
{quote}
Nice, this looks cleaner.

One issue I found is that it was not possible to filter snapshots by size 
because they're in human readable string format, so I updated the 
{{size_on_disk}} and {{true_size}} to be long instead, to allow filtering by 
snapshot size:
{noformat}
cqlsh> SELECT * from system_views.snapshots WHERE keyspace_name = 'ks1' AND 
true_size > 1080;

 name | keyspace_name | table_name | created_at                      | 
ephemeral | expires_at                      | size_on_disk | true_size
------+---------------+------------+---------------------------------+-----------+---------------------------------+--------------+-----------
  ks1 |           ks1 |         t1 | 2023-03-19 17:24:39.236000+0000 |     
False | 2023-03-20 03:24:39.236000+0000 |         6186 |      1082
  ks1 |           ks1 |         t2 | 2023-03-19 17:24:39.236000+0000 |     
False | 2023-03-20 03:24:39.236000+0000 |         6186 |      1082
(2 rows)
{noformat}
Also, even though I suggested we use the {{id}} to identify a snapshot I 
actually think we should use {{name}} instead since this is the term used to 
describe snapshots on nodetool to avoid adding another term in addition to 
{{tag}} and {{{}name{}}}:
{noformat}
$ nodetool snapshot
Requested creating snapshot(s) for [ks1] with snapshot name [ks1.t1] and 
options {skipFlush=false}

$ nodetool listsnapshots
Snapshot Details:
Snapshot name              Keyspace name Column family name True size Size on 
disk Creation time            Expiration time
{noformat}
I made these changes on [this 
commit|https://github.com/pauloricardomg/cassandra/commit/1654048f2ee2cf89d5362d6e6172acc0d4f90d46].

CI (queued): 
[!https://ci-cassandra.apache.org/job/Cassandra-devbranch/2359/badge/icon!|https://ci-cassandra.apache.org/blue/organizations/jenkins/Cassandra-devbranch/detail/Cassandra-devbranch/2359/pipeline]

> Add a virtual table to list snapshots
> -------------------------------------
>
>                 Key: CASSANDRA-18102
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18102
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Feature/Virtual Tables, Local/Snapshots
>            Reporter: Paulo Motta
>            Assignee: maxwellguo
>            Priority: Normal
>             Fix For: 5.0
>
>          Time Spent: 8h 40m
>  Remaining Estimate: 0h
>
> It should be possible to query a node's snapshots via virtual tables.
> The table should expose the same fields/columns as the 
> [TableSnapshot|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/service/snapshot/TableSnapshot.java]
>  class.
> Something along these lines:
> {noformat}
> cqlsh> SELECT * FROM system_views.snapshots;
>  
> tag | keyspace_name | table_name |  table_id | is_ephemeral | created_at | 
> expires_at | directories
> ----+---------------+------------+-----------+--------------+-----------+------------+------------
> 1670460346841 | system | compaction_info | 
> 123e4567-e89b-12d3-a456-426614174000 | false | 2022-12-08T00:45:47.108Z | 
> null | 
> {'/var/lib/cassandra/data/system/compaction_history-b4dbb7b4dc493fb5b3bfce6e434832ca/snapshots/1670460346841'}
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to