Skip to content

Commit

Permalink
Fix off-by-one error in partitioning.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Jun 2, 2024
1 parent 334aa65 commit e30c947
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.8.4:
- use end epoch without reduction when creating partitioned tables

0.8.3:
- add validator retention by pubkey
- move to periodic finalization rather than event-triggered
Expand Down
6 changes: 2 additions & 4 deletions services/chaindb/postgresql/partitioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@ func (s *Service) createTablePartitions(ctx context.Context,
startEpoch := chainTime.TimestampToEpoch(start)

end := start.AddDate(0, 0, 1)
// endEpoch is exclusive, which means that endEpoch for today will equal startEpoch tomorrow.
// As such, no reduction in endEpoch is required.
endEpoch := chainTime.TimestampToEpoch(end)
endEpochStart := chainTime.StartOfEpoch(endEpoch)
if endEpochStart.Before(end) {
endEpoch--
}

ctx, cancel, err := s.BeginTx(ctx)
if err != nil {
Expand Down

0 comments on commit e30c947

Please sign in to comment.