Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

12 changes: 12 additions & 0 deletions sa/db-next/boulder_sa/20251021000000_AddRevokedSerialsIndex.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- +migrate Up
-- SQL in section 'Up' is executed when this migration is applied

ALTER TABLE `revokedCertificates` REMOVE PARTITIONING;
ALTER TABLE `revokedCertificates` ADD UNIQUE INDEX `serial` (`serial`);

-- +migrate Down
-- SQL section 'Down' is executed when this migration is rolled back

ALTER TABLE `revokedCertificates` DROP UNIQUE INDEX `serial`;
ALTER TABLE `revokedCertificates` PARTITION BY RANGE(id)
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
6 changes: 6 additions & 0 deletions sa/sa.go
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,12 @@ func addRevokedCertificate(ctx context.Context, tx db.Executor, req *sapb.Revoke
NotAfterHour: serial.Expires.Add(time.Hour).Truncate(time.Hour),
})
if err != nil {
if db.IsDuplicate(err) {
// An attempted duplicate insert means that this certificate was already
// revoked. The RA has special logic for that case, so use the specific
// error for it.
return berrors.AlreadyRevokedError("certificate already revoked")
}
return fmt.Errorf("inserting revoked certificate row: %w", err)
}

Expand Down