Here is our code:
@Override
public boolean delete(String instance, final String storeName, String... keys) {
final Boolean[] isSuccess = {false};
final List<String> keyList = Arrays.asList(keys);
final Environment env = Environments.newInstance(xodusRoot + instance);
env.executeInTransaction(new TransactionalExecutable() {
@Override
public void execute(@NotNull final Transaction txn) {
final Store store = env.openStore(storeName, StoreConfig.WITHOUT_DUPLICATES, txn);
for (String key : keyList) {
isSuccess[0] = store.delete(txn, StringBinding.stringToEntry(key));
}
}
});
env.close();
return isSuccess[0];
}
I have two question for this.
Xodus is an ACID-compliant transactional database. Among other things it means that mutations of data in transactions are consistent. In your case either all specified keys (transaction is committed) or no keys (transaction aborted) would be deleted. If a transaction is interrupted for some reason (exception, system/hardware failure) nothing is modified and the transaction automatically rolls back.