in cassandra-four-zero-bridge/src/main/java/org/apache/cassandra/io/sstable/SSTableTombstoneWriter.java [169:235]
private void rawAddRow(List<ByteBuffer> values) throws InvalidRequestException, IOException
{
if (values.size() != boundNames.size())
{
throw new InvalidRequestException(
String.format("Invalid number of arguments, expecting %d values but got %d",
boundNames.size(), values.size()));
}
QueryOptions options = QueryOptions.forInternalCalls(null, values);
List<ByteBuffer> keys = delete.buildPartitionKeyNames(options);
long now = System.currentTimeMillis();
// NOTE: We ask indexes to not validate values (the last 'false' arg below) because that
// triggers a 'Keyspace.open' and that forces a lot of initialization that we don't want
UpdateParameters params = new UpdateParameters(delete.metadata,
delete.updatedColumns(),
options,
delete.getTimestamp(TimeUnit.MILLISECONDS.toMicros(now), options),
(int) TimeUnit.MILLISECONDS.toSeconds(now),
delete.getTimeToLive(options),
Collections.emptyMap());
if (delete.hasSlices())
{
// Write out range tombstones
SortedSet<ClusteringBound<?>> startBounds = delete.getRestrictions().getClusteringColumnsBounds(Bound.START, options);
SortedSet<ClusteringBound<?>> endBounds = delete.getRestrictions().getClusteringColumnsBounds(Bound.END, options);
Slices slices = toSlices(startBounds, endBounds);
try
{
for (ByteBuffer key : keys)
{
for (Slice slice : slices)
{
delete.addUpdateForKey(writer.getUpdateFor(key), slice, params);
}
}
return;
}
catch (SSTableSimpleUnsortedWriter.SyncException exception)
{
// If we use a BufferedWriter and had a problem writing to disk, the IOException has been
// wrapped in a SyncException (see BufferedWriter below). We want to extract that IOException.
throw (IOException) exception.getCause();
}
}
SortedSet<Clustering<?>> clusterings = delete.createClustering(options);
try
{
for (ByteBuffer key : keys)
{
for (Clustering<?> clustering : clusterings)
{
delete.addUpdateForKey(writer.getUpdateFor(key), clustering, params);
}
}
}
catch (SSTableSimpleUnsortedWriter.SyncException exception)
{
// If we use a BufferedWriter and had a problem writing to disk, the IOException has been
// wrapped in a SyncException (see BufferedWriter below). We want to extract that IOException.
throw (IOException) exception.getCause();
}
}