本文整理了Java中org.rocksdb.RocksDB.dropColumnFamily
方法的一些代码示例,展示了RocksDB.dropColumnFamily
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RocksDB.dropColumnFamily
方法的具体详情如下:
包路径:org.rocksdb.RocksDB
类名称:RocksDB
方法名:dropColumnFamily
[英]Drops the column family identified by columnFamilyName. Internal handles to this column family will be disposed. If the column family is not known removal will fail.
[中]删除由columnFamilyName标识的列族。将释放此柱族的内部句柄。如果柱族未知,则移除将失败。
代码示例来源:origin: voldemort/voldemort
@Override
public void truncate() {
try {
rocksDB.dropColumnFamily(storeHandle);
storeHandle.dispose();
storeHandle = rocksDB.createColumnFamily(new ColumnFamilyDescriptor(getName().getBytes(), storeOptions));
} catch (RocksDBException e) {
throw new VoldemortException("Failed to truncate DB", e);
}
}
代码示例来源:origin: hugegraph/hugegraph
@Override
public void dropTable(String table) throws RocksDBException {
this.checkValid();
ColumnFamilyHandle cfh = cf(table);
this.rocksdb.dropColumnFamily(cfh);
cfh.close();
this.cfs.remove(table);
}
代码示例来源:origin: com.palantir.atlasdb/atlasdb-rocksdb
public synchronized void drop(String tableName) throws RocksDBException {
ColumnFamily cf = cfs.remove(tableName);
if (cf != null) {
db.dropColumnFamily(cf.handle);
cf.handle.dispose();
}
}
代码示例来源:origin: org.rocksdb/rocksdbjni
/**
* Drops the column family identified by columnFamilyName. Internal
* handles to this column family will be disposed. If the column family
* is not known removal will fail.
*
* @param columnFamilyHandle {@link org.rocksdb.ColumnFamilyHandle}
* instance
*
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void dropColumnFamily(final ColumnFamilyHandle columnFamilyHandle)
throws RocksDBException, IllegalArgumentException {
// throws RocksDBException if something goes wrong
dropColumnFamily(nativeHandle_, columnFamilyHandle.nativeHandle_);
// After the drop the native handle is not valid anymore
columnFamilyHandle.disOwnNativeHandle();
}
代码示例来源:origin: com.palantir.atlasdb/atlasdb-rocksdb
public synchronized void truncate(String tableName) throws InterruptedException, RocksDBException {
ColumnFamily oldCf = cfs.get(tableName);
if (oldCf == null) {
throw new IllegalArgumentException("Table " + tableName + " does not exist.");
}
long newIndex = (oldCf.index + 1) % 2;
String realTableName = String.format("%s__%d", tableName, newIndex);
ColumnFamilyDescriptor descriptor = cfFactory.apply(realTableName);
ColumnFamilyHandle handle = db.createColumnFamily(descriptor);
cfs.put(tableName, new ColumnFamily(newIndex, handle));
while (oldCf.refCount.get() > 0) {
Thread.sleep(10);
}
db.dropColumnFamily(oldCf.handle);
oldCf.handle.dispose();
}
}
代码示例来源:origin: com.baidu.hugegraph/hugegraph-rocksdb
@Override
public void dropTable(String table) throws RocksDBException {
this.checkValid();
ColumnFamilyHandle cfh = cf(table);
this.rocksdb.dropColumnFamily(cfh);
cfh.close();
this.cfs.remove(table);
}
代码示例来源:origin: com.palantir.atlasdb/atlasdb-rocksdb
public void initialize(List<ColumnFamilyDescriptor> cfDescriptors,
List<ColumnFamilyHandle> cfHandles) throws RocksDBException {
for (int i = 0; i < cfDescriptors.size(); i++) {
String fullTableName = new String(cfDescriptors.get(i).columnFamilyName(), Charsets.UTF_8);
int nameIndex = fullTableName.lastIndexOf("__");
String tableName;
long index;
if (nameIndex == -1) {
tableName = fullTableName;
index = 0;
} else {
tableName = fullTableName.substring(0, nameIndex);
index = Long.parseLong(fullTableName.substring(nameIndex + 2));
}
ColumnFamily cf = new ColumnFamily(index, cfHandles.get(i));
ColumnFamily oldCf = cfs.put(tableName, cf);
if (oldCf != null && !tableName.equals("default")) {
db.dropColumnFamily(oldCf.getHandle());
oldCf.getHandle().dispose();
}
}
}
代码示例来源:origin: dremio/dremio-oss
@Override
@VisibleForTesting
public void deleteAllValues() throws IOException {
exclusively((deferred) -> {
synchronized(this) {
deleteAllIterators(deferred);
try {
db.dropColumnFamily(handle);
} catch(RocksDBException ex) {
deferred.addException(ex);
}
deferred.suppressingClose(handle);
try {
this.handle = db.createColumnFamily(family);
} catch (Exception ex) {
deferred.addException(ex);
}
}
});
}
内容来源于网络,如有侵权,请联系作者删除!