sa: eliminate requestedNames table (#7471)
Part of https://github.com/letsencrypt/boulder/issues/7432 Follows up on https://github.com/letsencrypt/boulder/pull/7435, now that that PR is deployed.
This commit is contained in:
parent
f24a97928b
commit
e75a821cc9
|
@ -165,10 +165,6 @@ func TestTableFromQuery(t *testing.T) {
|
|||
query: "insert into `orderToAuthz2` (`OrderID`,`AuthzID`) values (?,?);",
|
||||
expectedTable: "`orderToAuthz2`",
|
||||
},
|
||||
{
|
||||
query: "insert into `requestedNames` (`ID`,`OrderID`,`ReversedName`) values (?,?,?);",
|
||||
expectedTable: "`requestedNames`",
|
||||
},
|
||||
{
|
||||
query: "UPDATE authz2 SET status = :status, attempted = :attempted, validationRecord = :validationRecord, validationError = :validationError, expires = :expires WHERE id = :id AND status = :pending",
|
||||
expectedTable: "authz2",
|
||||
|
|
|
@ -279,7 +279,6 @@ func initTables(dbMap *borp.DbMap) {
|
|||
dbMap.AddTableWithName(orderModelv1{}, "orders").SetKeys(true, "ID")
|
||||
}
|
||||
dbMap.AddTableWithName(orderToAuthzModel{}, "orderToAuthz").SetKeys(false, "OrderID", "AuthzID")
|
||||
dbMap.AddTableWithName(requestedNameModel{}, "requestedNames").SetKeys(false, "OrderID")
|
||||
dbMap.AddTableWithName(orderFQDNSet{}, "orderFqdnSets").SetKeys(true, "ID")
|
||||
dbMap.AddTableWithName(authzModel{}, "authz2").SetKeys(true, "ID")
|
||||
dbMap.AddTableWithName(orderToAuthzModel{}, "orderToAuthz2").SetKeys(false, "OrderID", "AuthzID")
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
-- +migrate Up
|
||||
|
||||
DROP TABLE requestedNames;
|
||||
|
||||
-- +migrate Down
|
||||
|
||||
DROP TABLE requestedNames;
|
||||
|
||||
CREATE TABLE `requestedNames` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`orderID` bigint(20) NOT NULL,
|
||||
`reversedName` varchar(253) CHARACTER SET ascii NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `orderID_idx` (`orderID`),
|
||||
KEY `reversedName_idx` (`reversedName`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
|
||||
PARTITION BY RANGE(id)
|
||||
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
|
|
@ -22,7 +22,6 @@ GRANT SELECT,INSERT,UPDATE ON certificatesPerName TO 'sa'@'localhost';
|
|||
GRANT SELECT,INSERT,UPDATE ON registrations TO 'sa'@'localhost';
|
||||
GRANT SELECT,INSERT on fqdnSets TO 'sa'@'localhost';
|
||||
GRANT SELECT,INSERT,UPDATE ON orders TO 'sa'@'localhost';
|
||||
GRANT SELECT,INSERT ON requestedNames TO 'sa'@'localhost';
|
||||
GRANT SELECT,INSERT,DELETE ON orderFqdnSets TO 'sa'@'localhost';
|
||||
GRANT SELECT,INSERT,UPDATE ON authz2 TO 'sa'@'localhost';
|
||||
GRANT SELECT,INSERT ON orderToAuthz2 TO 'sa'@'localhost';
|
||||
|
@ -43,7 +42,6 @@ GRANT SELECT ON certificatesPerName TO 'sa_ro'@'localhost';
|
|||
GRANT SELECT ON registrations TO 'sa_ro'@'localhost';
|
||||
GRANT SELECT on fqdnSets TO 'sa_ro'@'localhost';
|
||||
GRANT SELECT ON orders TO 'sa_ro'@'localhost';
|
||||
GRANT SELECT ON requestedNames TO 'sa_ro'@'localhost';
|
||||
GRANT SELECT ON orderFqdnSets TO 'sa_ro'@'localhost';
|
||||
GRANT SELECT ON authz2 TO 'sa_ro'@'localhost';
|
||||
GRANT SELECT ON orderToAuthz2 TO 'sa_ro'@'localhost';
|
||||
|
|
|
@ -395,12 +395,6 @@ type orderModelv2 struct {
|
|||
CertificateProfileName string
|
||||
}
|
||||
|
||||
type requestedNameModel struct {
|
||||
ID int64
|
||||
OrderID int64
|
||||
ReversedName string
|
||||
}
|
||||
|
||||
type orderToAuthzModel struct {
|
||||
OrderID int64
|
||||
AuthzID int64
|
||||
|
|
19
sa/sa.go
19
sa/sa.go
|
@ -545,24 +545,7 @@ func (ssa *SQLStorageAuthority) NewOrderAndAuthzs(ctx context.Context, req *sapb
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// Fourth, insert all of the requestedNames.
|
||||
// TODO(#7432): Remove this
|
||||
inserter, err = db.NewMultiInserter("requestedNames", []string{"orderID", "reversedName"}, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, name := range req.NewOrder.Names {
|
||||
err := inserter.Add([]interface{}{orderID, ReverseName(name)})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
_, err = inserter.Insert(ctx, tx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Fifth, insert the FQDNSet entry for the order.
|
||||
// Fourth, insert the FQDNSet entry for the order.
|
||||
err = addOrderFQDNSet(ctx, tx, req.NewOrder.Names, orderID, req.NewOrder.RegistrationID, req.NewOrder.Expires.AsTime())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue