Skip to content

Commit

Permalink
Potential bugfix.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppanopticon committed Nov 3, 2023
1 parent b7dc70e commit 2f0fcff
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class DefaultEntity(override val name: Name.EntityName, override val parent: Def
* @return The maximum tuple ID occupied by entries in this [DefaultEntity].
*/
override fun smallestTupleId(): TupleId = this.txLatch.withLock {
this.bitmap.getFirst(this.context.txn.xodusTx)
this.bitmap.getFirst(this.context.txn.xodusTx.readonlySnapshot)
}

/**
Expand All @@ -181,7 +181,7 @@ class DefaultEntity(override val name: Name.EntityName, override val parent: Def
* @return The maximum tuple ID occupied by entries in this [DefaultEntity].
*/
override fun largestTupleId(): TupleId = this.txLatch.withLock {
this.bitmap.getLast(this.context.txn.xodusTx)
this.bitmap.getLast(this.context.txn.xodusTx.readonlySnapshot)
}

/**
Expand Down Expand Up @@ -450,11 +450,11 @@ class DefaultEntity(override val name: Name.EntityName, override val parent: Def
* @return Next [TupleId] for insert.
*/
private fun nextTupleId(): TupleId = this.txLatch.withLock {
val smallest = this.bitmap.getFirst(this.context.txn.xodusTx)
val smallest = this.bitmap.getFirst(this.context.txn.xodusTx.readonlySnapshot)
val next = when {
smallest == -1L -> 0L
smallest > 0L -> smallest - 1L
else -> this.bitmap.getLast(this.context.txn.xodusTx) + 1L
else -> this.bitmap.getLast(this.context.txn.xodusTx.readonlySnapshot) + 1L
}
return@withLock next
}
Expand Down

0 comments on commit 2f0fcff

Please sign in to comment.