fix: VFS readdir() no longer returns duplicate entries
- PathResolver.getChildren() now deduplicates by entity ID (v7.4.1)
This handles duplicate relationship records that can occur when multiple
Brainy instances create relationships concurrently for the same storage path.
- brain.clear() now invalidates GraphAdjacencyIndex (v7.4.1)
Prevents stale in-memory index data after clearing storage, which could
cause relate()'s duplicate check to fail.
Fixes: Workshop bug where readdir('/') returned same directory 13+ times
This commit is contained in:
parent
311f165533
commit
2bd4031f9c
2 changed files with 21 additions and 0 deletions
|
|
@ -2636,6 +2636,15 @@ export class Brainy<T = any> implements BrainyInterface<T> {
|
|||
// Clear storage
|
||||
await this.storage.clear()
|
||||
|
||||
// v7.4.1: Invalidate GraphAdjacencyIndex to prevent stale in-memory data
|
||||
// The index has LSMTree data and verbIdSet pointing to deleted entities.
|
||||
// Without this, relate()'s duplicate check uses stale data, potentially
|
||||
// allowing duplicate relationships or missing valid duplicates.
|
||||
if (typeof (this.storage as any).invalidateGraphIndex === 'function') {
|
||||
;(this.storage as any).invalidateGraphIndex()
|
||||
}
|
||||
this.graphIndex = undefined as any
|
||||
|
||||
// Reset index
|
||||
if ('clear' in this.index && typeof this.index.clear === 'function') {
|
||||
await this.index.clear()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue