diff --git a/CHANGES.txt b/CHANGES.txt index 1aca920964..fb95e14112 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -43,7 +43,7 @@ * Add binary protocol versioning (CASSANDRA-5436) * Swap THshaServer for TThreadedSelectorServer (CASSANDRA-5530) * Add alias support to SELECT statement (CASSANDRA-5075) - + * Don't create empty RowMutations in CommitLogReplayer (CASSANDRA-5541) 1.2.5 * fix 2i updates with identical values and timestamps (CASSANDRA-5540) diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java index 37094c6256..3d4cb8c81b 100644 --- a/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java +++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java @@ -237,11 +237,11 @@ public class CommitLogReplayer return; final Table table = Table.open(frm.getTable()); - RowMutation newRm = new RowMutation(frm.getTable(), frm.key()); // Rebuild the row mutation, omitting column families that // a) have already been flushed, // b) are part of a cf that was dropped. Keep in mind that the cf.name() is suspect. do every thing based on the cfid instead. + RowMutation newRm = null; for (ColumnFamily columnFamily : frm.getColumnFamilies()) { if (Schema.instance.getCF(columnFamily.id()) == null) @@ -254,12 +254,15 @@ public class CommitLogReplayer // if it is the last known segment, if we are after the replay position if (segment > rp.segment || (segment == rp.segment && entryLocation > rp.position)) { + if (newRm == null) + newRm = new RowMutation(frm.getTable(), frm.key()); newRm.add(columnFamily); replayedCount.incrementAndGet(); } } - if (!newRm.isEmpty()) + if (newRm != null) { + assert !newRm.isEmpty(); Table.open(newRm.getTable()).apply(newRm, false); tablesRecovered.add(table); }