You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Paulo Motta (Jira)" <ji...@apache.org> on 2021/11/07 21:02:00 UTC

[jira] [Commented] (CASSANDRA-16843) List snapshots of dropped tables

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

Paulo Motta commented on CASSANDRA-16843:
-----------------------------------------

Added an initial trunk patch [on this PR|https://github.com/apache/cassandra/pull/1305] decoupling snapshot loading logic from {{ColumnFamilyStore}} which enables listing snapshots of dropped tables.

The basic idea is to search all data file locations for snapshot directories matching {{{}${data_dir}/${ks_name}/${table_name}-${table_uuid}/snapshots/{tag{}}}}, optionally with a json manifest ({{{}manifest.json{}}}) and feed these to {{SnapshotManager}} which will keep track of live snapshots listed by {{{}nodetool listsnapshots{}}}.

One potential issue is handling legacy data directories (2.x series iirc) which do not contain the UUID part. I'm not sure if these are still supported, if so we may need to handle these.

The snapshot searching logic is done by {{SnapshotFinder}} on [this commit|https://github.com/pauloricardomg/cassandra/commit/6b104afed5cd190ab43e97bad622feda5db5d2df] (with a few tests).

[This commit|https://github.com/pauloricardomg/cassandra/commit/ec53e8a5cec9dd58f574663c4ab48780de7feb4a] updates {{SnapshotManager}} initialization logic to use {{SnapshotFinder}} instead of {{Keyspace/ColumnFamilyStore}} to load snapshots into memory during startup.

The {{SnapshotManager}} class originally stored only expiring snapshots (added by CASSANDRA-16789), but after this patch it keeps an in-memory view of all live snapshots (expiring and non-expiring). As new snapshots are created they are registered on this class by {{ColumnFamilyStore}} via {{{}SnapshotManager.addSnapshot{}}}. In the future I want move snapshot creation logic completely out of {{ColumnFamilyStore}} leaving there only sstable hardlinking logic.

[This commit|https://github.com/pauloricardomg/cassandra/commit/c614f88b817145e83237f61975e0e8a1b4b71cff] makes snapshot listing use {{{}SnapshotManager.getSnapshots{}}}. This enables listing of dropped snapshots which is tested by the test [added on this commit|https://github.com/pauloricardomg/cassandra/commit/1fb024e6ab726da5c42f7937a8e97540d43fd7fd].

The previous change broke {{org.apache.cassandra.distributed.test.SnapshotsTest.testManualSnapshotCleanup}} because cleared snapshots were not removed from {{{}SnapshotManager{}}}. [This commit|https://github.com/pauloricardomg/cassandra/commit/2b1ec31885908b1199a93127668b2a4fd422a2c6] fixes this by moving snapshot cleanup logic to {{{}SnapshotManager{}}}.

Finally [this commit|https://github.com/pauloricardomg/cassandra/commit/6edb90ac025690566a7a1ebc138a6198bb8a9c28] fixes an NPE when computing the true size disk bytes of snapshots since these are not currently computed for snapshots loaded via {{{}SnapshotFinder{}}}. I will create a fix to this by moving this logic which is dependent of {{ColumnFamilyStore}} out of the {{TableSnapshot}} class.

I wanted to hear your initial feedback on the approach before addressing todos, working on edge cases (ie. secondary indexes, dropped tables with same names, snapshot tag uniqueness) and cleanup (ie. remove dead snapshot handling code).

Can you take a look [~brandon.williams], [~stefan.miklosovic] ?

> List snapshots of dropped tables
> --------------------------------
>
>                 Key: CASSANDRA-16843
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16843
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Local/Snapshots
>            Reporter: James Brown
>            Assignee: Paulo Motta
>            Priority: Normal
>             Fix For: 3.11.x, 4.0.x
>
>
> Auto snapshots from dropped tables don't seem to show up in {{nodetool listsnapshots}} (even though they do get cleared by {{nodetool clearsnapshot}}). This makes them kind of annoying to clean up, since you need to muck about in the data directory to find them.
> Erick on the mailing list said that this seems to be an oversight and that clearsnapshot was fixed by [CASSANDRA-6418|https://issues.apache.org/jira/browse/CASSANDRA-6418].
> I reproduced this both on 3.11.11 and 4.0.0.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org