Skip to content

Commit

Permalink
Minor fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralph Gasser committed Nov 6, 2023
1 parent 89cc3e1 commit c5875b0
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,14 +436,13 @@ class DefaultEntity(override val name: Name.EntityName, override val parent: Def
* @return Next [TupleId] for insert.
*/
private fun nextTupleId(): TupleId = this.txLatch.withLock {
val snapshot = this.context.txn.xodusTx.readonlySnapshot
val smallest = this.bitmap.getFirst(snapshot)
val txn = this.context.txn.xodusTx
val smallest = this.bitmap.getFirst(txn)
val next = when {
smallest == -1L -> 0L
smallest > 0L -> smallest - 1L
else -> this.bitmap.getLast(snapshot) + 1L
else -> this.bitmap.getLast(txn) + 1L
}
snapshot.abort()
return@withLock next
}
}
Expand Down

0 comments on commit c5875b0

Please sign in to comment.