Skip to content

Commit 15d53b2

Browse files
database: Remove Partitions from our tables (#8489)
Ahead of the move from ProxySQL + MariaDB to Vitess + MySQL 8 in #8468. Vitess blocks partition related DDL, so partitions need to be removed from all schemas under `sa/db*`. The team has agreed that this drift from Production is acceptable because it lets us begin testing on Vitess and MySQL sooner. Separately, `thisUpdate` and `nextUpdate` were relying on an implicit `DEFAULT NULL`. We now make that explicit, matching how we define other DATETIME columns. Also, add a missing `DROP TABLE `incidents`;` to our combined schema migration. Part of #7736
1 parent add6c8b commit 15d53b2

File tree

6 files changed

+19
-48
lines changed

6 files changed

+19
-48
lines changed

sa/db-next/boulder_sa/20230419000003_OrderToAuthzID.sql

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ CREATE TABLE `orderToAuthz2` (
99
PRIMARY KEY (`id`),
1010
KEY `orderID_idx` (`orderID`),
1111
KEY `authzID_idx` (`authzID`)
12-
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4
13-
PARTITION BY RANGE (`id`)
14-
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
12+
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4;
1513

1614
-- +migrate Down
1715
-- SQL section 'Down' is executed when this migration is rolled back
@@ -22,6 +20,4 @@ CREATE TABLE `orderToAuthz2` (
2220
`authzID` bigint(20) NOT NULL,
2321
PRIMARY KEY (`orderID`,`authzID`),
2422
KEY `authzID` (`authzID`)
25-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
26-
PARTITION BY RANGE COLUMNS(orderID, authzID)
27-
(PARTITION p_start VALUES LESS THAN (MAXVALUE, MAXVALUE));
23+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

sa/db-next/boulder_sa/20240503000000_RemoveRequestedNames.sql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,4 @@ CREATE TABLE `requestedNames` (
1313
PRIMARY KEY (`id`),
1414
KEY `orderID_idx` (`orderID`),
1515
KEY `reversedName_idx` (`reversedName`)
16-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
17-
PARTITION BY RANGE(id)
18-
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
16+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

sa/db/boulder_sa/20230419000000_CombinedSchema.sql

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ CREATE TABLE `authz2` (
1818
KEY `regID_expires_idx` (`registrationID`,`status`,`expires`),
1919
KEY `regID_identifier_status_expires_idx` (`registrationID`,`identifierType`,`identifierValue`,`status`,`expires`),
2020
KEY `expires_idx` (`expires`)
21-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
22-
PARTITION BY RANGE(id)
23-
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
21+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
2422

2523
CREATE TABLE `blockedKeys` (
2624
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -53,9 +51,7 @@ CREATE TABLE `certificateStatus` (
5351
KEY `serial` (`serial`),
5452
KEY `isExpired_ocspLastUpdated_idx` (`isExpired`,`ocspLastUpdated`),
5553
KEY `notAfter_idx` (`notAfter`)
56-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
57-
PARTITION BY RANGE(id)
58-
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
54+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
5955

6056
CREATE TABLE `certificates` (
6157
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -69,9 +65,7 @@ CREATE TABLE `certificates` (
6965
KEY `serial` (`serial`),
7066
KEY `regId_certificates_idx` (`registrationID`) COMMENT 'Common lookup',
7167
KEY `issued_idx` (`issued`)
72-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
73-
PARTITION BY RANGE(id)
74-
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
68+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
7569

7670
CREATE TABLE `certificatesPerName` (
7771
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -93,9 +87,7 @@ CREATE TABLE `fqdnSets` (
9387
PRIMARY KEY (`id`),
9488
KEY `serial` (`serial`),
9589
KEY `setHash_issued_idx` (`setHash`,`issued`)
96-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
97-
PARTITION BY RANGE(id)
98-
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
90+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
9991

10092
CREATE TABLE `incidents` (
10193
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -104,7 +96,7 @@ CREATE TABLE `incidents` (
10496
`renewBy` datetime NOT NULL,
10597
`enabled` boolean DEFAULT false,
10698
PRIMARY KEY (`id`)
107-
) CHARSET=utf8mb4;
99+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
108100

109101
CREATE TABLE `issuedNames` (
110102
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -114,9 +106,7 @@ CREATE TABLE `issuedNames` (
114106
`renewal` tinyint(1) NOT NULL DEFAULT 0,
115107
PRIMARY KEY (`id`),
116108
KEY `reversedName_notBefore_Idx` (`reversedName`,`notBefore`)
117-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
118-
PARTITION BY RANGE(id)
119-
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
109+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
120110

121111
CREATE TABLE `keyHashToSerial` (
122112
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -147,18 +137,14 @@ CREATE TABLE `orderFqdnSets` (
147137
KEY `setHash_expires_idx` (`setHash`,`expires`),
148138
KEY `orderID_idx` (`orderID`),
149139
KEY `orderFqdnSets_registrationID_registrations` (`registrationID`)
150-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
151-
PARTITION BY RANGE(id)
152-
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
140+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
153141

154142
CREATE TABLE `orderToAuthz2` (
155143
`orderID` bigint(20) NOT NULL,
156144
`authzID` bigint(20) NOT NULL,
157145
PRIMARY KEY (`orderID`,`authzID`),
158146
KEY `authzID` (`authzID`)
159-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
160-
PARTITION BY RANGE COLUMNS(orderID, authzID)
161-
(PARTITION p_start VALUES LESS THAN (MAXVALUE, MAXVALUE));
147+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
162148

163149
CREATE TABLE `orders` (
164150
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -171,9 +157,7 @@ CREATE TABLE `orders` (
171157
PRIMARY KEY (`id`),
172158
KEY `reg_status_expires` (`registrationID`,`expires`),
173159
KEY `regID_created_idx` (`registrationID`,`created`)
174-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
175-
PARTITION BY RANGE(id)
176-
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
160+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
177161

178162
-- Note: This table's name is a historical artifact and it is now
179163
-- used to store linting certificates, not precertificates.
@@ -189,9 +173,7 @@ CREATE TABLE `precertificates` (
189173
KEY `serial` (`serial`),
190174
KEY `regId_precertificates_idx` (`registrationID`),
191175
KEY `issued_precertificates_idx` (`issued`)
192-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
193-
PARTITION BY RANGE(id)
194-
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
176+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
195177

196178
CREATE TABLE `registrations` (
197179
`id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -215,9 +197,7 @@ CREATE TABLE `requestedNames` (
215197
PRIMARY KEY (`id`),
216198
KEY `orderID_idx` (`orderID`),
217199
KEY `reversedName_idx` (`reversedName`)
218-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
219-
PARTITION BY RANGE(id)
220-
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
200+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
221201

222202
-- Tables below have foreign key constraints, so are created after all other tables.
223203

@@ -245,6 +225,7 @@ DROP TABLE `certificateStatus`;
245225
DROP TABLE `certificatesPerName`;
246226
DROP TABLE `certificates`;
247227
DROP TABLE `fqdnSets`;
228+
DROP TABLE `incidents`;
248229
DROP TABLE `issuedNames`;
249230
DROP TABLE `keyHashToSerial`;
250231
DROP TABLE `newOrdersRL`;

sa/db/boulder_sa/20230519000000_CrlShards.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ CREATE TABLE `crlShards` (
55
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
66
`issuerID` bigint(20) NOT NULL,
77
`idx` int UNSIGNED NOT NULL,
8-
`thisUpdate` datetime,
9-
`nextUpdate` datetime,
8+
`thisUpdate` datetime DEFAULT NULL,
9+
`nextUpdate` datetime DEFAULT NULL,
1010
`leasedUntil` datetime NOT NULL,
1111
PRIMARY KEY (`id`),
1212
UNIQUE KEY `shardID` (`issuerID`, `idx`)

sa/db/boulder_sa/20230919000000_RevokedCertificates.sql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ CREATE TABLE `revokedCertificates` (
1111
`revokedReason` int(11) NOT NULL,
1212
PRIMARY KEY (`id`),
1313
KEY `issuerID_shardIdx_notAfterHour_idx` (`issuerID`, `shardIdx`, `notAfterHour`)
14-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
15-
PARTITION BY RANGE(id)
16-
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
14+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
1715

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

sa/db/boulder_sa/20240119000000_ReplacementOrders.sql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ CREATE TABLE `replacementOrders` (
1010
PRIMARY KEY (`id`),
1111
KEY `serial_idx` (`serial`),
1212
KEY `orderID_idx` (`orderID`)
13-
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
14-
PARTITION BY RANGE(id)
15-
(PARTITION p_start VALUES LESS THAN (MAXVALUE));
13+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
1614

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

0 commit comments

Comments
 (0)