Skip to content

Commit 904bc22

Browse files
committed
fix: properly remove collection entries when a PV is being deleted
1 parent c420034 commit 904bc22

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
group = 'net.staticstudios'
8-
version = '2.0.1-SNAPSHOT'
8+
version = '2.0.1'
99

1010
repositories {
1111
mavenCentral()

src/main/java/net/staticstudios/data/impl/PersistentCollectionManager.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,21 +436,20 @@ private void handlePersistentValueDeletionInMemory(PersistentValue<?> pv) {
436436
return;
437437
}
438438

439-
UUID oldEntryId = (UUID) pv.get();
439+
UUID oldLinkingId = (UUID) pv.get();
440440

441441
dataManager.getDummyPersistentCollections(pv.getSchema() + "." + pv.getTable()).stream()
442-
.filter(dummyCollection -> dummyCollection.getEntryIdColumn().equals(pv.getColumn()))
442+
.filter(dummyCollection -> dummyCollection.getLinkingColumn().equals(pv.getColumn()))
443443
.forEach(dummyCollection -> {
444444

445-
CollectionEntryIdentifier oldIdentifier = CollectionEntryIdentifier.of(dummyCollection.getEntryIdColumn(), oldEntryId);
446-
CellKey linkingKey = getEntryLinkingKey(dummyCollection, oldEntryId);
445+
CollectionEntryIdentifier oldIdentifier = CollectionEntryIdentifier.of(dummyCollection.getEntryIdColumn(), pv.getHolder().getRootHolder().getId());
447446

448447
CollectionKey oldCollectionKey = new CollectionKey(
449448
dummyCollection.getSchema(),
450449
dummyCollection.getTable(),
451450
dummyCollection.getLinkingColumn(),
452451
dummyCollection.getDataColumn(),
453-
dataManager.get(linkingKey)
452+
oldLinkingId
454453
);
455454

456455
removeEntry(oldCollectionKey, oldIdentifier);

0 commit comments

Comments
 (0)