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

Sylvain Lebresne commented on CASSANDRA-5228:
---------------------------------------------

* In SSTableMetadata default ctor, we need to use MAX_VALUE, not MIN_VALUE, 
same as when we read metadata that don't track the deletion time.
* Nit: In the Descriptor version, it uses version "ic" but trunk version is now 
"ja".
* Nit: I don't know why CompactionController don't already keep a reference to 
the compacted sstable, but let's do it. It's weird to have to pass it to 
getTTLExpiredSSTables even though CompactionController has been created with 
the sstables in the first place.
* In CompactionTask, we could use actuallyCompact for the getPreheatKeyCache 
branch. But we shouldn't use it in the createCompactionWriter call.
* Concerning getTTLExpiredSSTables:
** The {{candidate.getMaxTimestamp() > minTimestamp}} check should use a '>=' 
because tombstone wins over normal insert on a timestamp tie.
** we should pass gcBefore as argument for the static version, and use the one 
of the controller for the non-static version, rather than recomputing it from 
scratch.
** Nit: Let's rename the method to say getFullyExpiredSSTables (or maybe 
getDroppableSSTables). This is not TTL specific, but about gcable tombstones 
(that might not come from TTL).
** I don't think it's ok to drop sstables without having done the min_timestamp 
check, unless overlapping is empty (and I'm not sure it's worth special 
casing). Overall, I find the method a bit hard to follow. I would suggest a 
slightly refactored version like:
{noformat}
List<SSTableReader> candidates = new ArrayList<SSTableReader>();
long minTimestamp = Integer.MAX_VALUE;

for (SSTableReader sstable : overlapping)
    minTimestamp = Math.min(minTimestamp, sstable.getMinTimestamp());

for (SSTableReader candidate : compacting)
{
    if (candidate.maxLocalDeletionTime() < gcBefore)
        candidates.add(candidate);
    else
        minTimestamp = Math.min(minTimestamp, sstable.getMinTimestamp());
}

// we still need to keep candidates that might shadow something in a
// non-candidate sstable. And if we remove a sstable from the candidates, we
// must take it's timestamp into account (hence the sorting below).
Collections.sort(candidates, SSTable.maxTimestampComparator);

Iterator<SSTableReader> iterator = candidates.iterator();
while (iterator.hasNext())
{
    SSTableReader candidate = iterator.next();
    if (candidate.getMaxTimestamp() >= minTimestamp)
    {
        minTimestamp = Math.min(candidate.getMinTimestamp(), minTimestamp);
        iterator.remove();
    }
    else
    {
        logger.debug("Dropping TTL Expired SSTable {} (maxLocalDeletionTime={}, 
localTime={})",
                candidate, candidate.getSSTableMetadata().maxLocalDeletionTime, 
localTimeSeconds);
    }
}
return new HashSet<SSTableReader>(candidates);
{noformat}

                
> Track maximum ttl and use to expire entire sstables
> ---------------------------------------------------
>
>                 Key: CASSANDRA-5228
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5228
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Jonathan Ellis
>            Assignee: Marcus Eriksson
>            Priority: Minor
>         Attachments: 0001-track-max-local-deletiontime-v2.patch, 
> 0001-track-max-local-deletiontime-v3.patch, 0001-track-max-ttl-v1.patch, 
> 0002-CASSANDRA-5228-add-a-nodetool-command-that-drops-ent.patch, 
> 0002-CASSANDRA-5228-drop-entire-sstables-if-all-tombstone-v2.patch
>
>
> It would be nice to be able to throw away entire sstables worth of data when 
> we know that it's all expired.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to