/** * Drop out key space. * * @param keyspaceName * keyspace name */ public static void dropKeySpace(String keyspaceName) { try { if (client != null) { client.system_drop_keyspace(keyspaceName); } } catch (InvalidRequestException e) { return; } catch (SchemaDisagreementException e) { log.error("Error while dropping keyspace, Caused by: .", e); } catch (TException e) { log.error("Error while dropping keyspace, Caused by: .", e); } }
client.system_drop_keyspace(keyspaceName);
/** * Drop keyspace or c fs. * * @throws InvalidRequestException * the invalid request exception * @throws SchemaDisagreementException * the schema disagreement exception * @throws TException * the t exception * @throws Exception * the exception */ private void dropKeyspaceOrCFs() throws InvalidRequestException, SchemaDisagreementException, TException, Exception { if (createdKeyspaces.contains(databaseName))// drop if created during // create-drop call. { cassandra_client.system_drop_keyspace(databaseName); } else { cassandra_client.set_keyspace(databaseName); for (TableInfo tableInfo : tableInfos) { dropColumnFamily(tableInfo); } } }
/** * Delete a keyspace * @param statement - a token tree representing current statement * @throws TException - exception * @throws InvalidRequestException - exception * @throws NotFoundException - exception * @throws SchemaDisagreementException */ private void executeDelKeySpace(Tree statement) throws TException, InvalidRequestException, NotFoundException, SchemaDisagreementException { if (!CliMain.isConnected()) return; String keyspaceName = CliCompiler.getKeySpace(statement, thriftClient.describe_keyspaces()); String version = thriftClient.system_drop_keyspace(keyspaceName); sessionState.out.println(version); if (keyspaceName.equals(keySpace)) //we just deleted the keyspace we were authenticated too keySpace = null; }
/** * Delete the keyspace with the given name. This method can use any DB connection. * * @param dbConn Database connection to use. * @param keyspace Name of keyspace to drop. */ public static void dropKeyspace(DBConn dbConn, String keyspace) { m_logger.info("Deleting Keyspace '{}'", keyspace); try { dbConn.getClientSession().system_drop_keyspace(keyspace); } catch (Exception ex) { String errMsg = "Failed to delete Keyspace '" + keyspace + "'"; m_logger.error(errMsg, ex); throw new RuntimeException(errMsg, ex); } } // dropKeyspace
@Override public String execute(Cassandra.Client cassandra) throws HectorException { try { if (waitForSchemaAgreement) { waitForSchemaAgreement(cassandra); } String schemaId = cassandra.system_drop_keyspace(keyspace); if (waitForSchemaAgreement) { waitForSchemaAgreement(cassandra); } return schemaId; } catch (Exception e) { throw xtrans.translate(e); } } };
/** * Delete the keyspace with the given name. This method can use any DB connection. * * @param dbConn Database connection to use. * @param keyspace Name of keyspace to drop. */ public void dropKeyspace(DBConn dbConn, String keyspace) { m_logger.info("Deleting Keyspace '{}'", keyspace); try { dbConn.getClientSession().system_drop_keyspace(keyspace); waitForSchemaPropagation(dbConn); } catch (Exception ex) { String errMsg = "Failed to delete Keyspace '" + keyspace + "'"; m_logger.error(errMsg, ex); throw new RuntimeException(errMsg, ex); } } // dropKeyspace
@Override public String execute(Cassandra.Client cassandra) throws HectorException { try { if (waitForSchemaAgreement) { waitForSchemaAgreement(cassandra); } String schemaId = cassandra.system_drop_keyspace(keyspace); if (waitForSchemaAgreement) { waitForSchemaAgreement(cassandra); } return schemaId; } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public SchemaChangeResult internalExecute(Client client, ConnectionContext context) throws Exception { precheckSchemaAgreement(client); return new SchemaChangeResponseImpl() .setSchemaId(client.system_drop_keyspace(getKeyspaceName())); } }, RunOnce.get());
@Override public String system_drop_keyspace(String keyspace) throws InvalidRequestException, TException, SchemaDisagreementException { return client.system_drop_keyspace(keyspace); }
@Override public SchemaChangeResult internalExecute(Client client, ConnectionContext context) throws Exception { precheckSchemaAgreement(client); return new SchemaChangeResponseImpl() .setSchemaId(client.system_drop_keyspace(getKeyspaceName())); } }, RunOnce.get());
@Override public SchemaChangeResult internalExecute(Client client, ConnectionContext context) throws Exception { precheckSchemaAgreement(client); return new SchemaChangeResponseImpl().setSchemaId(client.system_drop_keyspace(keyspaceName)); } }, RunOnce.get());
@Override public String system_drop_keyspace(String keyspace) throws InvalidRequestException, TException, SchemaDisagreementException { return client.system_drop_keyspace(keyspace); }
private void dropOldKeyspace() throws InvalidRequestException, SchemaDisagreementException, TException { TTransport tr = new TFramedTransport(new TSocket("localhost", 9160)); TProtocol proto = new TBinaryProtocol(tr); Cassandra.Client client = new Cassandra.Client(proto); tr.open(); client.system_drop_keyspace(JANUSGRAPH); LOGGER.info("DROPPED keyspace janusgraph"); tr.close(); }
@Override public SchemaChangeResult internalExecute(Client client, ConnectionContext context) throws Exception { precheckSchemaAgreement(client); return new SchemaChangeResponseImpl().setSchemaId(client.system_drop_keyspace(keyspaceName)); } }, RunOnce.get());
@Override public String execute(Cassandra.Client cassandra) throws HectorException { try { if (waitForSchemaAgreement) { waitForSchemaAgreement(cassandra); } String schemaId = cassandra.system_drop_keyspace(keyspace); if (waitForSchemaAgreement) { waitForSchemaAgreement(cassandra); } return schemaId; } catch (Exception e) { throw xtrans.translate(e); } } };
@Override public String system_drop_keyspace(String keyspace) throws InvalidRequestException, TException, SchemaDisagreementException { return client.system_drop_keyspace(keyspace); }