mirror of https://github.com/apache/cassandra
snapshot must be performed before flushlock must be acquired, or we deadlock. See #2381
patch by jbellis git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1087402 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
acde48fb3d
commit
95809de586
|
|
@ -80,11 +80,12 @@ public class DropColumnFamily extends Migration
|
|||
|
||||
if (!clientMode)
|
||||
{
|
||||
cfs.snapshot(Table.getTimestampedSnapshotName(null));
|
||||
|
||||
CompactionManager.instance.getCompactionLock().lock();
|
||||
cfs.flushLock.lock();
|
||||
try
|
||||
{
|
||||
cfs.snapshot(Table.getTimestampedSnapshotName(null));
|
||||
Table.open(ksm.name).dropCf(cfm.cfId);
|
||||
}
|
||||
finally
|
||||
|
|
|
|||
|
|
@ -63,10 +63,10 @@ public class DropKeyspace extends Migration
|
|||
CFMetaData.purge(cfm);
|
||||
if (!clientMode)
|
||||
{
|
||||
cfs.snapshot(snapshotName);
|
||||
cfs.flushLock.lock();
|
||||
try
|
||||
{
|
||||
cfs.snapshot(snapshotName);
|
||||
Table.open(ksm.name).dropCf(cfm.cfId);
|
||||
}
|
||||
finally
|
||||
|
|
|
|||
|
|
@ -411,7 +411,7 @@ public class DefsTest extends CleanupHelper
|
|||
assert ks != null;
|
||||
final CFMetaData cfm = ks.cfMetaData().get("Standard2");
|
||||
assert cfm != null;
|
||||
|
||||
|
||||
// write some data, force a flush, then verify that files exist on disk.
|
||||
RowMutation rm = new RowMutation(ks.name, dk.key);
|
||||
for (int i = 0; i < 100; i++)
|
||||
|
|
@ -451,7 +451,28 @@ public class DefsTest extends CleanupHelper
|
|||
assert th instanceof NullPointerException;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void dropKSUnflushed() throws ConfigurationException, IOException, ExecutionException, InterruptedException
|
||||
{
|
||||
DecoratedKey dk = Util.dk("dropKs");
|
||||
// sanity
|
||||
final KSMetaData ks = DatabaseDescriptor.getTableDefinition("Keyspace3");
|
||||
assert ks != null;
|
||||
final CFMetaData cfm = ks.cfMetaData().get("Standard1");
|
||||
assert cfm != null;
|
||||
|
||||
// write some data
|
||||
RowMutation rm = new RowMutation(ks.name, dk.key);
|
||||
for (int i = 0; i < 100; i++)
|
||||
rm.add(new QueryPath(cfm.cfName, null, ByteBufferUtil.bytes(("col" + i))), ByteBufferUtil.bytes("anyvalue"), 1L);
|
||||
rm.apply();
|
||||
|
||||
new DropKeyspace(ks.name).apply();
|
||||
|
||||
assert DatabaseDescriptor.getTableDefinition(ks.name) == null;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void renameKs() throws ConfigurationException, IOException, ExecutionException, InterruptedException
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue