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

Abe Ratnofsky commented on CASSANDRA-19130:
-------------------------------------------

I actually wonder if we should make truncation "lazier": rather than removing 
SSTables within TruncateVerbHandler (and keeping SSTables with maxDataAge > 
truncatedAt), just record the agreed-upon truncation timestamp in TCM, then in 
compaction remove entire SSTables with maxDataAge <= truncatedAt, and remove 
all cells with earlier mutation timestamps. When we're handling a Truncation 
transformation in TCM (via TableTruncationListener), kick off a local 
truncation compaction. Once the compaction completes, we can purged the 
truncatedAt marker in the system table.

On the read path, we'd also filter returned cells by mutation timestamps, and 
exclude SSTables with maxDataAge <= truncatedAt.

The benefits of this are: clearer semantics (don't need to depend on flush / 
snapshot timing), friendlier to the key and row cache (could purge only as 
necessary). The main downside would be that truncate couldn't be used for 
emergency disk reclaim, but I think that use-case belongs in nodetool not CQL 
anyway.

> Implement transactional table truncation
> ----------------------------------------
>
>                 Key: CASSANDRA-19130
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-19130
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: Consistency/Coordination
>            Reporter: Marcus Eriksson
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>             Fix For: 5.x
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> TRUNCATE table should leverage cluster metadata to ensure consistent 
> truncation timestamps across all replicas. The current implementation depends 
> on all nodes being available, but this could be reimplemented as a 
> {{Transformation}}.



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

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

Reply via email to