本文整理汇总了Java中org.apache.cassandra.service.MigrationManager.announceColumnFamilyDrop方法的典型用法代码示例。如果您正苦于以下问题:Java MigrationManager.announceColumnFamilyDrop方法的具体用法?Java MigrationManager.announceColumnFamilyDrop怎么用?Java MigrationManager.announceColumnFamilyDrop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.service.MigrationManager
的用法示例。
在下文中一共展示了MigrationManager.announceColumnFamilyDrop方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: system_drop_column_family
import org.apache.cassandra.service.MigrationManager; //导入方法依赖的package包/类
public String system_drop_column_family(String column_family)
throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("drop_column_family");
ThriftClientState cState = state();
try
{
String keyspace = cState.getKeyspace();
cState.hasColumnFamilyAccess(keyspace, column_family, Permission.DROP);
MigrationManager.announceColumnFamilyDrop(keyspace, column_family);
return Schema.instance.getVersion().toString();
}
catch (RequestValidationException e)
{
throw ThriftConversion.toThrift(e);
}
}
示例2: system_drop_column_family
import org.apache.cassandra.service.MigrationManager; //导入方法依赖的package包/类
public String system_drop_column_family(String column_family)
throws InvalidRequestException, SchemaDisagreementException, TException
{
logger.debug("drop_column_family");
ThriftClientState cState = state();
try
{
//wso2
String keyspace = cState.getResolvedKeyspace();
cState.hasColumnFamilyAccess(keyspace, column_family, Permission.DROP);
MigrationManager.announceColumnFamilyDrop(keyspace, column_family);
return Schema.instance.getVersion().toString();
}
catch (RequestValidationException e)
{
throw ThriftConversion.toThrift(e);
}
}
示例3: announceMigration
import org.apache.cassandra.service.MigrationManager; //导入方法依赖的package包/类
public boolean announceMigration(boolean isLocalOnly) throws ConfigurationException
{
try
{
MigrationManager.announceColumnFamilyDrop(keyspace(), columnFamily(), isLocalOnly);
return true;
}
catch (ConfigurationException e)
{
if (ifExists)
return false;
throw e;
}
}
示例4: announceMigration
import org.apache.cassandra.service.MigrationManager; //导入方法依赖的package包/类
public void announceMigration() throws ConfigurationException
{
try
{
MigrationManager.announceColumnFamilyDrop(keyspace(), columnFamily());
}
catch (ConfigurationException e)
{
if (!ifExists)
throw e;
}
}
示例5: announceMigration
import org.apache.cassandra.service.MigrationManager; //导入方法依赖的package包/类
public Event.SchemaChange announceMigration(boolean isLocalOnly) throws ConfigurationException
{
try
{
KeyspaceMetadata ksm = Schema.instance.getKSMetaData(keyspace());
if (ksm == null)
throw new ConfigurationException(String.format("Cannot drop table in unknown keyspace '%s'", keyspace()));
CFMetaData cfm = ksm.getTableOrViewNullable(columnFamily());
if (cfm != null)
{
if (cfm.isView())
throw new InvalidRequestException("Cannot use DROP TABLE on Materialized View");
boolean rejectDrop = false;
StringBuilder messageBuilder = new StringBuilder();
for (ViewDefinition def : ksm.views)
{
if (def.baseTableId.equals(cfm.cfId))
{
if (rejectDrop)
messageBuilder.append(',');
rejectDrop = true;
messageBuilder.append(def.viewName);
}
}
if (rejectDrop)
{
throw new InvalidRequestException(String.format("Cannot drop table when materialized views still depend on it (%s.{%s})",
keyspace(),
messageBuilder.toString()));
}
}
MigrationManager.announceColumnFamilyDrop(keyspace(), columnFamily(), isLocalOnly);
return new Event.SchemaChange(Event.SchemaChange.Change.DROPPED, Event.SchemaChange.Target.TABLE, keyspace(), columnFamily());
}
catch (ConfigurationException e)
{
if (ifExists)
return null;
throw e;
}
}
示例6: dropCf
import org.apache.cassandra.service.MigrationManager; //导入方法依赖的package包/类
@Test
public void dropCf() throws ConfigurationException
{
// sanity
final KeyspaceMetadata ks = Schema.instance.getKSMetaData(KEYSPACE1);
assertNotNull(ks);
final CFMetaData cfm = ks.tables.getNullable(TABLE1);
assertNotNull(cfm);
// write some data, force a flush, then verify that files exist on disk.
for (int i = 0; i < 100; i++)
QueryProcessor.executeInternal(String.format("INSERT INTO %s.%s (key, name, val) VALUES (?, ?, ?)",
KEYSPACE1, TABLE1),
"dropCf", "col" + i, "anyvalue");
ColumnFamilyStore store = Keyspace.open(cfm.ksName).getColumnFamilyStore(cfm.cfName);
assertNotNull(store);
store.forceBlockingFlush();
assertTrue(store.getDirectories().sstableLister(Directories.OnTxnErr.THROW).list().size() > 0);
MigrationManager.announceColumnFamilyDrop(ks.name, cfm.cfName);
assertFalse(Schema.instance.getKSMetaData(ks.name).tables.get(cfm.cfName).isPresent());
// any write should fail.
boolean success = true;
try
{
QueryProcessor.executeInternal(String.format("INSERT INTO %s.%s (key, name, val) VALUES (?, ?, ?)",
KEYSPACE1, TABLE1),
"dropCf", "col0", "anyvalue");
}
catch (Throwable th)
{
success = false;
}
assertFalse("This mutation should have failed since the CF no longer exists.", success);
// verify that the files are gone.
Supplier<Object> lambda = () -> {
for (File file : store.getDirectories().sstableLister(Directories.OnTxnErr.THROW).listFiles())
{
if (file.getPath().endsWith("Data.db") && !new File(file.getPath().replace("Data.db", "Compacted")).exists())
return false;
}
return true;
};
Util.spinAssertEquals(true, lambda, 30);
}
示例7: dropCf
import org.apache.cassandra.service.MigrationManager; //导入方法依赖的package包/类
@Test
public void dropCf() throws ConfigurationException
{
DecoratedKey dk = Util.dk("dropCf");
// sanity
final KSMetaData ks = Schema.instance.getKSMetaData(KEYSPACE1);
Assert.assertNotNull(ks);
final CFMetaData cfm = ks.cfMetaData().get("Standard1");
Assert.assertNotNull(cfm);
// write some data, force a flush, then verify that files exist on disk.
Mutation rm = new Mutation(ks.name, dk.getKey());
for (int i = 0; i < 100; i++)
rm.add(cfm.cfName, cellname("col" + i), ByteBufferUtil.bytes("anyvalue"), 1L);
rm.applyUnsafe();
ColumnFamilyStore store = Keyspace.open(cfm.ksName).getColumnFamilyStore(cfm.cfName);
Assert.assertNotNull(store);
store.forceBlockingFlush();
Assert.assertTrue(store.directories.sstableLister().list().size() > 0);
MigrationManager.announceColumnFamilyDrop(ks.name, cfm.cfName);
Assert.assertFalse(Schema.instance.getKSMetaData(ks.name).cfMetaData().containsKey(cfm.cfName));
// any write should fail.
rm = new Mutation(ks.name, dk.getKey());
boolean success = true;
try
{
rm.add("Standard1", cellname("col0"), ByteBufferUtil.bytes("value0"), 1L);
rm.applyUnsafe();
}
catch (Throwable th)
{
success = false;
}
Assert.assertFalse("This mutation should have failed since the CF no longer exists.", success);
// verify that the files are gone.
for (File file : store.directories.sstableLister().listFiles())
{
if (file.getPath().endsWith("Data.db") && !new File(file.getPath().replace("Data.db", "Compacted")).exists())
throw new AssertionError("undeleted file " + file);
}
}
示例8: announceMigration
import org.apache.cassandra.service.MigrationManager; //导入方法依赖的package包/类
public void announceMigration() throws ConfigurationException
{
MigrationManager.announceColumnFamilyDrop(keyspace(), columnFamily(), clientState);
}
示例9: announceMigration
import org.apache.cassandra.service.MigrationManager; //导入方法依赖的package包/类
public void announceMigration() throws ConfigurationException
{
MigrationManager.announceColumnFamilyDrop(keyspace(), columnFamily());
}
示例10: dropCf
import org.apache.cassandra.service.MigrationManager; //导入方法依赖的package包/类
@Test
public void dropCf() throws ConfigurationException
{
DecoratedKey dk = Util.dk("dropCf");
// sanity
final KSMetaData ks = Schema.instance.getKSMetaData("Keyspace1");
Assert.assertNotNull(ks);
final CFMetaData cfm = ks.cfMetaData().get("Standard1");
Assert.assertNotNull(cfm);
// write some data, force a flush, then verify that files exist on disk.
Mutation rm = new Mutation(ks.name, dk.key);
for (int i = 0; i < 100; i++)
rm.add(cfm.cfName, cellname("col" + i), ByteBufferUtil.bytes("anyvalue"), 1L);
rm.apply();
ColumnFamilyStore store = Keyspace.open(cfm.ksName).getColumnFamilyStore(cfm.cfName);
Assert.assertNotNull(store);
store.forceBlockingFlush();
Assert.assertTrue(store.directories.sstableLister().list().size() > 0);
MigrationManager.announceColumnFamilyDrop(ks.name, cfm.cfName);
Assert.assertFalse(Schema.instance.getKSMetaData(ks.name).cfMetaData().containsKey(cfm.cfName));
// any write should fail.
rm = new Mutation(ks.name, dk.key);
boolean success = true;
try
{
rm.add("Standard1", cellname("col0"), ByteBufferUtil.bytes("value0"), 1L);
rm.apply();
}
catch (Throwable th)
{
success = false;
}
Assert.assertFalse("This mutation should have failed since the CF no longer exists.", success);
// verify that the files are gone.
for (File file : store.directories.sstableLister().listFiles())
{
if (file.getPath().endsWith("Data.db") && !new File(file.getPath().replace("Data.db", "Compacted")).exists())
throw new AssertionError("undeleted file " + file);
}
}