ignore 0.8 hints even if compaction begins before we try to purge them

patch by jbellis; reviewed by brandonwilliams for CASSANDRA-3385

git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0@1189863 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Ellis 2011-10-27 16:44:50 +00:00
parent 5455e5446c
commit 16e1875d7d
3 changed files with 28 additions and 5 deletions

View File

@ -28,6 +28,8 @@
* fix cassandra hanging on jsvc stop (CASSANDRA-3302)
* Avoid leveled compaction getting blocked on errors (CASSANDRA-3408)
* Make reloading the compaction strategy safe (CASSANDRA-3409)
* ignore 0.8 hints even if compaction begins before we try to purge
them (CASSANDRA-3385)
Merged from 0.8:
* (CQL) update grammar to require key clause in DELETE statement
(CASSANDRA-3349)

View File

@ -85,9 +85,13 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
private static final Logger logger_ = LoggerFactory.getLogger(HintedHandOffManager.class);
private static final int PAGE_SIZE = 1024;
private static final String SEPARATOR = "-";
private static final int LARGE_NUMBER = 65536; // 64k nodes ought to be enough for anybody.
// in 0.8, subcolumns were KS-CF bytestrings, and the data was stored in the "normal" storage there.
// (so replay always consisted of sending an entire row,
// no matter how little was part of the mutation that created the hint.)
private static final String SEPARATOR_08 = "-";
private final NonBlockingHashSet<InetAddress> queuedDeliveries = new NonBlockingHashSet<InetAddress>();
private final ExecutorService executor_ = new JMXEnabledThreadPoolExecutor("HintedHandoff", Thread.MIN_PRIORITY);
@ -139,7 +143,7 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
{
RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, tokenBytes);
rm.delete(new QueryPath(HINTS_CF, hintId), timestamp);
rm.apply();
rm.applyUnsafe(); // don't bother with commitlog since we're going to flush as soon as we're done with delivery
}
public void deleteHintsForEndpoint(final String ipOrHostname)
@ -275,9 +279,20 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
if (pagingFinished(hintColumnFamily, startColumn))
break;
page:
for (IColumn hint : hintColumnFamily.getSortedColumns())
{
startColumn = hint.name();
for (IColumn subColumn : hint.getSubColumns())
{
// both 0.8 and 1.0 column names are UTF8 strings, so this check is safe
if (ByteBufferUtil.string(subColumn.name()).contains(SEPARATOR_08))
{
logger_.debug("0.8-style hint found. This should have been taken care of by purgeIncompatibleHints");
deleteHint(tokenBytes, hint.name(), subColumn.timestamp());
continue page;
}
}
IColumn versionColumn = hint.getSubColumn(ByteBufferUtil.bytes("version"));
IColumn tableColumn = hint.getSubColumn(ByteBufferUtil.bytes("table"));

View File

@ -118,9 +118,15 @@ public class SystemTable
ColumnFamilyStore hintsCfs = Table.open(Table.SYSTEM_TABLE).getColumnFamilyStore(HintedHandOffManager.HINTS_CF);
if (hintsCfs.getSSTables().size() > 0)
{
logger.info("Possible old-format hints found. Snapshotting as 'old-hints' and purging");
hintsCfs.snapshot("old-hints");
hintsCfs.removeAllSSTables();
logger.info("Possible old-format hints found. Truncating");
try
{
hintsCfs.truncate();
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
logger.debug("Marking pre-1.0 hints purged");
RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, COOKIE_KEY);