Skip to content

Commit

Permalink
Fix: Data not found on rotate (#577)
Browse files Browse the repository at this point in the history
* Fix: Data not found on rotate

Hedge against a scenario where the new active block and the preivously
uploaded block have the same timestamp in their ulid. This caused
queries to discard the uploaded block erroniously.
  • Loading branch information
thorfour authored Oct 26, 2023
1 parent 02eef58 commit a3d7073
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions table.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,10 @@ func (t *Table) RotateBlock(ctx context.Context, block *TableBlock, skipPersist
defer commit()

id := generateULID()
for id.Time() == block.ulid.Time() { // Ensure the new block has a different timestamp.
runtime.Gosched()
id = generateULID()
}
if err := t.newTableBlock(t.active.minTx, tx, metadata, id); err != nil {
return err
}
Expand Down

0 comments on commit a3d7073

Please sign in to comment.