use of org.apache.hudi.exception.HoodieException in project hudi by apache.
the class RocksDBDAO method dropColumnFamily.
/**
* Note : Does not delete from underlying DB. Just closes the handle.
*
* @param columnFamilyName Column Family Name
*/
public void dropColumnFamily(String columnFamilyName) {
ValidationUtils.checkArgument(!closed);
managedDescriptorMap.computeIfPresent(columnFamilyName, (colFamilyName, descriptor) -> {
ColumnFamilyHandle handle = managedHandlesMap.get(colFamilyName);
try {
getRocksDB().dropColumnFamily(handle);
handle.close();
} catch (RocksDBException e) {
throw new HoodieException(e);
}
managedHandlesMap.remove(columnFamilyName);
return null;
});
}
use of org.apache.hudi.exception.HoodieException in project hudi by apache.
the class RocksDBDAO method writeBatch.
/**
* Perform a batch write operation.
*/
public void writeBatch(BatchHandler handler) {
try (WriteBatch batch = new WriteBatch()) {
handler.apply(batch);
getRocksDB().write(new WriteOptions(), batch);
} catch (RocksDBException re) {
throw new HoodieException(re);
}
}
use of org.apache.hudi.exception.HoodieException in project hudi by apache.
the class RocksDBDAO method putInBatch.
/**
* Helper to add put operation in batch.
*
* @param batch Batch Handle
* @param columnFamilyName Column Family
* @param key Key
* @param value Payload
* @param <T> Type of payload
*/
public <T extends Serializable> void putInBatch(WriteBatch batch, String columnFamilyName, String key, T value) {
try {
byte[] payload = serializePayload(value);
batch.put(managedHandlesMap.get(columnFamilyName), key.getBytes(), payload);
} catch (Exception e) {
throw new HoodieException(e);
}
}
use of org.apache.hudi.exception.HoodieException in project hudi by apache.
the class BoundedInMemoryExecutor method execute.
/**
* Main API to run both production and consumption.
*/
public E execute() {
try {
startProducers();
Future<E> future = startConsumer();
// Wait for consumer to be done
return future.get();
} catch (InterruptedException ie) {
shutdownNow();
Thread.currentThread().interrupt();
throw new HoodieException(ie);
} catch (Exception e) {
throw new HoodieException(e);
}
}
use of org.apache.hudi.exception.HoodieException in project hudi by apache.
the class ReflectionUtils method getClass.
public static Class<?> getClass(String clazzName) {
synchronized (CLAZZ_CACHE) {
if (!CLAZZ_CACHE.containsKey(clazzName)) {
try {
Class<?> clazz = Class.forName(clazzName);
CLAZZ_CACHE.put(clazzName, clazz);
} catch (ClassNotFoundException e) {
throw new HoodieException("Unable to load class", e);
}
}
}
return CLAZZ_CACHE.get(clazzName);
}
Aggregations