Sam Tunnicliffe created CASSANDRA-5445:
------------------------------------------

             Summary: PerRowSecondaryIndex isn't notified of row-level deletes
                 Key: CASSANDRA-5445
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5445
             Project: Cassandra
          Issue Type: Bug
    Affects Versions: 1.2.3
            Reporter: Sam Tunnicliffe
            Assignee: Sam Tunnicliffe


Following CASSANDRA-5297, the way PerRowSecondaryIndex updates are handled in 
AtomicSortedColumns is still not right as it doesn't cater for row level 
deletes properly. The key is only added MixedIndexUpdater's list of deferred 
updates if there's a column value being modified. Where an entire row is 
deleted, we never hit that code so the indexer.commit() in 
ASC.addAllWithSizeDelta becomes a no-op & the index is not correctly updated. 

Also, SecondaryIndexManager.updaterFor is not actually as efficient as it first 
seems. For a CF with no per-column indexes and a single per-row index defined, 
during compaction (when includeRowIndexes == false), we'd expect to be using 
nullUpdater to no-op the index update for each row being compacted given the 
updaterFor implementation:

{code}
        return (includeRowIndexes && !rowLevelIndexMap.isEmpty())
                        ? new MixedIndexUpdater(key)
                        : indexesByColumn.isEmpty() ? nullUpdater : new 
PerColumnIndexUpdater(key);
{code}

However, this isn't the case as indexesByColumn is never empty, the reason 
being that any index *must* be attached to a column, there's just no way to 
register a PRSI without attaching it to one of the CF's columns. So where a 
PRSI is present, a new PCIU instance is created for each row during compaction 
regardless. With that in mind, I'd propose removing the includeRowLevelIndexes 
argument and just returning nullIndexer if no indexes (PRSI or PRCI) are 
configured (although I totally acknowledge that fixing index registration so we 
can register a PRSI without attaching it to a column would be desirable in the 
long-term).

--
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