don't create empty RowMutations in CommitLogReplayer

patch by jbellis reviewed by dbrosius for (CASSANDRA-5541)
This commit is contained in:
Dave Brosius 2013-05-13 14:29:46 -04:00
parent 3683d621b1
commit 31d991a255
2 changed files with 6 additions and 3 deletions

View File

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

View File

@ -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);
}