Skip to content

Commit

Permalink
Added a check when resetting a sequence, since truncating a previousl…
Browse files Browse the repository at this point in the history
…y truncated entity may lead to the SequenceCatalogueEntry being left unchanged.
  • Loading branch information
ppanopticon committed May 9, 2022
1 parent ce72ef8 commit 6848c0d
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ class DefaultSchema(override val name: Name.SchemaName, override val parent: Def

/* Resets the tuple ID counter. */
if (!SequenceCatalogueEntries.reset(name.tid(), this@DefaultSchema.catalogue, this.context.xodusTx)) {
throw DatabaseException.DataCorruptionException("DROP entity $name failed: Failed to delete tuple ID sequence entry.")
if (SequenceCatalogueEntries.read(name.tid(), this@DefaultSchema.catalogue, this.context.xodusTx) == null) {
throw DatabaseException.DataCorruptionException("DROP entity $name failed: Failed to reset tuple ID sequence entry.")
}
}
}

Expand Down

0 comments on commit 6848c0d

Please sign in to comment.