Skip to content

Commit 1f6ec8c

Browse files
borp/sa: Update borp to pass Transaction args through BoulderTypeConverter (#8494)
Today, timestamp truncation happens for queries using `*borp.DbMap` but not `*borp.Transaction`. That means comparisons still see sub-seconds, but inserts into MariaDB `DATETIME` columns silently truncate them to whole seconds. On MySQL 8, the same queries will still include sub-seconds, but inserts into `DATETIME` columns will round to the nearest second instead of truncate. This leads to issues for queries like the one in `*StorageAuthority.UpdateCRLShard()`. When two CRL updaters write within the same second one may be rounded up to the next second. When the other updater attempts its own `UPDATE .. WHERE thisUpdate <= ?`, the condition fails because the stored timestamp now appears to be in the future. Ahead of the transition from ProxySQL + MariaDB to Vitess + MySQL 8 in #8468, update borp (letsencrypt/borp#12) to expose Transaction arguments to the BoulderTypeConverter, allowing it to truncate all timestamps passed through Transactions and keep behavior consistent across `*borp.DbMap` and `*borp.Transaction`, as well as MariaDB and MySQL 8. Part of #7736
1 parent d0d89a7 commit 1f6ec8c

File tree

5 files changed

+61
-6
lines changed

5 files changed

+61
-6
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require (
1515
github.com/google/certificate-transparency-go v1.3.2-0.20250507091337-0eddb39e94f8
1616
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1
1717
github.com/jmhodges/clock v1.2.0
18-
github.com/letsencrypt/borp v0.0.0-20240620175310-a78493c6e2bd
18+
github.com/letsencrypt/borp v0.0.0-20251118150929-89c6927051ae
1919
github.com/letsencrypt/challtestsrv v1.3.3
2020
github.com/letsencrypt/pkcs11key/v4 v4.0.0
2121
github.com/letsencrypt/validator/v10 v10.0.0-20230215210743-a0c7dfc17158

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
149149
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
150150
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
151151
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
152-
github.com/letsencrypt/borp v0.0.0-20240620175310-a78493c6e2bd h1:3c+LdlAOEcW1qmG8gtkMCyAEoslmj6XCmniB+926kMM=
153-
github.com/letsencrypt/borp v0.0.0-20240620175310-a78493c6e2bd/go.mod h1:gMSMCNKhxox/ccR923EJsIvHeVVYfCABGbirqa0EwuM=
152+
github.com/letsencrypt/borp v0.0.0-20251118150929-89c6927051ae h1:yFuF5yRIwaandcuNMi1A4he4FMWJsGRv38rsizIaxJA=
153+
github.com/letsencrypt/borp v0.0.0-20251118150929-89c6927051ae/go.mod h1:gMSMCNKhxox/ccR923EJsIvHeVVYfCABGbirqa0EwuM=
154154
github.com/letsencrypt/challtestsrv v1.3.3 h1:ki02PH84fo6IOe/A+zt1/kfRBp2JrtauEaa5xwjg4/Q=
155155
github.com/letsencrypt/challtestsrv v1.3.3/go.mod h1:Ur4e4FvELUXLGhkMztHOsPIsvGxD/kzSJninOrkM+zc=
156156
github.com/letsencrypt/pkcs11key/v4 v4.0.0 h1:qLc/OznH7xMr5ARJgkZCCWk+EomQkiNTOoOF5LAgagc=

sa/sa.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ func (ssa *SQLStorageAuthority) PauseIdentifiers(ctx context.Context, req *sapb.
13141314
// Not currently or previously paused, insert a new pause record.
13151315
err = tx.Insert(ctx, &pausedModel{
13161316
RegistrationID: req.RegistrationID,
1317-
PausedAt: ssa.clk.Now().Truncate(time.Second),
1317+
PausedAt: ssa.clk.Now(),
13181318
identifierModel: identifierModel{
13191319
Type: ident.Type,
13201320
Value: ident.Value,
@@ -1347,7 +1347,7 @@ func (ssa *SQLStorageAuthority) PauseIdentifiers(ctx context.Context, req *sapb.
13471347
identifierType = ? AND
13481348
identifierValue = ? AND
13491349
unpausedAt IS NOT NULL`,
1350-
ssa.clk.Now().Truncate(time.Second),
1350+
ssa.clk.Now(),
13511351
req.RegistrationID,
13521352
ident.Type,
13531353
ident.Value,

vendor/github.com/letsencrypt/borp/transaction.go

Lines changed: 55 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ github.com/grpc-ecosystem/grpc-gateway/v2/utilities
205205
# github.com/jmhodges/clock v1.2.0
206206
## explicit; go 1.17
207207
github.com/jmhodges/clock
208-
# github.com/letsencrypt/borp v0.0.0-20240620175310-a78493c6e2bd
208+
# github.com/letsencrypt/borp v0.0.0-20251118150929-89c6927051ae
209209
## explicit; go 1.20
210210
github.com/letsencrypt/borp
211211
# github.com/letsencrypt/challtestsrv v1.3.3

0 commit comments

Comments
 (0)