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

Jeff Jirsa commented on CASSANDRA-13973:
----------------------------------------

OK, leaving some quick notes for whoever gets around to handling this (maybe 
me, not self assigning because I don't have bandwidth right now, and to be 
honest I haven't thought about the right fix yet).

The code here is trying to calculate the serialized size, so it can write the 
index out as it rewrites that partition to a data file :

{code}
        long size = TypeSizes.sizeofUnsignedVInt(headerLength)
                  + DeletionTime.serializer.serializedSize(deletionTime)
                  + TypeSizes.sizeofUnsignedVInt(columnsIndex.size()); // 
number of entries
        for (IndexHelper.IndexInfo info : columnsIndex)
            size += idxSerializer.serializedSize(info);
        size += columnsIndex.size() * TypeSizes.sizeof(0);
        return Ints.checkedCast(size);
{code}

With 394GB and an index entry every 64k, you're going to write something like 
{{6169617}} index markers, and the field there to handle it is a (signed) 
integer (4 bytes), giving you a maximum size for all of the index markers of 
{{2147483648}} , about 348 bytes per marker. The size of a marker is here: 

{code}
                long size = clusteringSerializer.serializedSize(info.firstName)
                          + clusteringSerializer.serializedSize(info.lastName)
                          + TypeSizes.sizeofUnsignedVInt(info.offset)
                          + TypeSizes.sizeofVInt(info.width - WIDTH_BASE)
                          + TypeSizes.sizeof(info.endOpenMarker != null);

                if (info.endOpenMarker != null)
                    size += 
DeletionTime.serializer.serializedSize(info.endOpenMarker);
                return size;
{code}

Note that it has both the first and last clustering within that marker - so for 
you not to overflow, assuming no range tombstones which would take up even more 
space, your clustering markers would have to average less than ~165 bytes each, 
which clearly isn't happening, so we overflow that int and stop.

That's the short version of what's happening. I'm not sure why it's an {{int}} 
instead of a {{long}} , and I'm not immediately sure why you're hitting it here 
with {{upgradesstables}} when you didn't hit it previously. 

> IllegalArgumentException in upgradesstables compaction
> ------------------------------------------------------
>
>                 Key: CASSANDRA-13973
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13973
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Compaction
>            Reporter: Dan Kinder
>
> After an upgrade from 2.2.6 to 3.0.15 (sstable version la to mc), when I try 
> to run upgradesstables, most of them upgrade fine but I see the exception 
> below on several nodes, and it doesn't complete.
> CASSANDRA-12717 looks similar but the stack trace is not the same, so I 
> assumed it is not identical. The various nodes this happens on all give the 
> same trace.
> Might be notable that this is an analytics cluster with some large 
> partitions, in the GB size.
> {noformat}
> error: Out of range: 7316844981
> -- StackTrace --
> java.lang.IllegalArgumentException: Out of range: 7316844981
> at com.google.common.primitives.Ints.checkedCast(Ints.java:91)
> at 
> org.apache.cassandra.db.RowIndexEntry$IndexedEntry.promotedSize(RowIndexEntry.java:329)
> at 
> org.apache.cassandra.db.RowIndexEntry$Serializer.serialize(RowIndexEntry.java:133)
> at 
> org.apache.cassandra.io.sstable.format.big.BigTableWriter$IndexWriter.append(BigTableWriter.java:409)
> at 
> org.apache.cassandra.io.sstable.format.big.BigTableWriter.afterAppend(BigTableWriter.java:120)
> at 
> org.apache.cassandra.io.sstable.format.big.BigTableWriter.append(BigTableWriter.java:157)
> at 
> org.apache.cassandra.io.sstable.SSTableRewriter.append(SSTableRewriter.java:125)
> at 
> org.apache.cassandra.db.compaction.writers.MaxSSTableSizeWriter.realAppend(MaxSSTableSizeWriter.java:88)
> at 
> org.apache.cassandra.db.compaction.writers.CompactionAwareWriter.append(CompactionAwareWriter.java:109)
> at 
> org.apache.cassandra.db.compaction.CompactionTask.runMayThrow(CompactionTask.java:195)
> at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28)
> at 
> org.apache.cassandra.db.compaction.CompactionTask.executeInternal(CompactionTask.java:89)
> at 
> org.apache.cassandra.db.compaction.AbstractCompactionTask.execute(AbstractCompactionTask.java:61)
> at 
> org.apache.cassandra.db.compaction.CompactionManager$5.execute(CompactionManager.java:424)
> at 
> org.apache.cassandra.db.compaction.CompactionManager$2.call(CompactionManager.java:311)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at 
> org.apache.cassandra.concurrent.NamedThreadFactory.lambda$threadLocalDeallocator$0(NamedThreadFactory.java:79)
> at java.lang.Thread.run(Thread.java:748)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to