This commit is contained in:
Andrea Cavalli 2022-07-20 02:00:08 +02:00
parent a976a4baa4
commit c27f7d4e2b
2 changed files with 20 additions and 9 deletions

View File

@ -442,11 +442,13 @@ public class DatabaseMapDictionaryDeep<T, U, US extends DatabaseStage<U>> extend
var fullRange = tuple.getT2(); var fullRange = tuple.getT2();
try { try {
if (firstKey.isPresent()) { if (firstKey.isPresent()) {
try (var key1Buf = deepMap.alloc.allocate(keySuffix1Serializer.getSerializedBinaryLength())) { try (fullRange) {
keySuffix1Serializer.serialize(firstKey.get(), key1Buf); try (var key1Buf = deepMap.alloc.allocate(keySuffix1Serializer.getSerializedBinaryLength())) {
sink.next(LLRange.of(key1Buf.send(), fullRange.getMax())); keySuffix1Serializer.serialize(firstKey.get(), key1Buf);
} catch (SerializationException e) { sink.next(LLRange.of(key1Buf.send(), fullRange.getMax()));
sink.error(e); } catch (SerializationException e) {
sink.error(e);
}
} }
} else { } else {
sink.next(fullRange); sink.next(fullRange);
@ -457,7 +459,7 @@ public class DatabaseMapDictionaryDeep<T, U, US extends DatabaseStage<U>> extend
} catch (Throwable ex2) { } catch (Throwable ex2) {
LOG.error(ex2); LOG.error(ex2);
} }
throw ex; sink.error(ex);
} }
}), false, false) }), false, false)
.concatMapIterable(entry -> { .concatMapIterable(entry -> {

View File

@ -89,14 +89,23 @@ public abstract class LLLocalReactiveRocksIterator<T> {
rocksIterator.next(); rocksIterator.next();
} }
sink.next(getEntry(key, value)); sink.next(getEntry(key, value));
} finally { } catch (Throwable ex) {
if (value != null && value.isAccessible()) { if (value != null && value.isAccessible()) {
value.close(); try {
value.close();
} catch (Throwable ex2) {
logger.error(ex2);
}
} }
throw ex;
} }
} catch (Throwable ex) { } catch (Throwable ex) {
if (key.isAccessible()) { if (key.isAccessible()) {
key.close(); try {
key.close();
} catch (Throwable ex2) {
logger.error(ex2);
}
} }
throw ex; throw ex;
} }