diff --git a/core/sail/base/src/main/java/org/eclipse/rdf4j/sail/base/Changeset.java b/core/sail/base/src/main/java/org/eclipse/rdf4j/sail/base/Changeset.java index fd8b3a54b6..a634c35fae 100644 --- a/core/sail/base/src/main/java/org/eclipse/rdf4j/sail/base/Changeset.java +++ b/core/sail/base/src/main/java/org/eclipse/rdf4j/sail/base/Changeset.java @@ -806,6 +806,21 @@ Iterable getApprovedTriples(Resource subj, IRI pred, Value obj) { void removeApproved(Statement next) { assert !closed; + + Model localApproved = approved; + if (localApproved != null && !localApproved.contains(next)) { + boolean readLock = readWriteLock.readLock(); + try { + if (approved != null && !approvedEmpty) { + if (!approved.contains(next)) { + return; + } + } + } finally { + readWriteLock.unlockReader(readLock); + } + } + long writeLock = readWriteLock.writeLock(); try { if (approved != null) {