Fix negative value
This commit is contained in:
parent
bd0129fb9f
commit
0a378bc0f1
@ -502,6 +502,15 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
|
|||||||
@Override
|
@Override
|
||||||
public Mono<Long> getProperty(String propertyName) {
|
public Mono<Long> getProperty(String propertyName) {
|
||||||
return Mono.fromCallable(() -> db.getAggregatedLongProperty(propertyName))
|
return Mono.fromCallable(() -> db.getAggregatedLongProperty(propertyName))
|
||||||
|
.map(val -> {
|
||||||
|
// Sometimes this two properties return a negative value, I don't know why.
|
||||||
|
if (Objects.equals(propertyName, "rocksdb.cur-size-all-mem-tables")
|
||||||
|
|| Objects.equals(propertyName, "rocksdb.size-all-mem-tables")) {
|
||||||
|
return Math.abs(val);
|
||||||
|
} else {
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
})
|
||||||
.onErrorMap(cause -> new IOException("Failed to read " + propertyName, cause))
|
.onErrorMap(cause -> new IOException("Failed to read " + propertyName, cause))
|
||||||
.subscribeOn(dbScheduler);
|
.subscribeOn(dbScheduler);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user