mirror of
https://github.com/google/nomulus.git
synced 2025-07-31 15:06:29 +02:00
Reorganize new schema changes (#1551)
* Reorganize new schema changes Reorganized new schema changes and make each flyway script update a single table. Each flyway script is executed in a single database transaction so that the script can be rolled back in one shot. It acquires a shared lock on all tables touched by the script. This is deadlock-prone because in a busy database, there may be user queries that attempt to lock the same set of tables, but in different order. By limiting each script to one table, we avoid the problem. We should have some a presubmit check to enforce this rule. All changes have been deployed to Sandbox out-of-band. When doing so, we changed all CREATE INDEX statements to CREATE INDEX IF NOT EXISTS. Future deployments should be able to proceed normally.
This commit is contained in:
parent
bd49e8b238
commit
4b1f4f96e3
10 changed files with 106 additions and 39 deletions
|
@ -261,11 +261,11 @@ td.section {
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="property_name">generated on</td>
|
||||
<td class="property_value">2022-03-08 17:12:37.970348</td>
|
||||
<td class="property_value">2022-03-09 22:28:58.465478</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="property_name">last flyway file</td>
|
||||
<td id="lastFlywayFile" class="property_value">V108__add_host_indexes_for_whois.sql</td>
|
||||
<td id="lastFlywayFile" class="property_value">V112__add_billingrecurrence_missing_indexes.sql</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -284,7 +284,7 @@ td.section {
|
|||
generated on
|
||||
</text>
|
||||
<text text-anchor="start" x="4055.5" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
||||
2022-03-08 17:12:37.970348
|
||||
2022-03-09 22:28:58.465478
|
||||
</text>
|
||||
<polygon fill="none" stroke="#888888" points="3968,-4 3968,-44 4233,-44 4233,-4 3968,-4" /> <!-- allocationtoken_a08ccbef -->
|
||||
<g id="node1" class="node">
|
||||
|
|
|
@ -261,11 +261,11 @@ td.section {
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="property_name">generated on</td>
|
||||
<td class="property_value">2022-03-08 17:12:35.997985</td>
|
||||
<td class="property_value">2022-03-09 22:28:56.561494</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="property_name">last flyway file</td>
|
||||
<td id="lastFlywayFile" class="property_value">V108__add_host_indexes_for_whois.sql</td>
|
||||
<td id="lastFlywayFile" class="property_value">V112__add_billingrecurrence_missing_indexes.sql</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -284,7 +284,7 @@ td.section {
|
|||
generated on
|
||||
</text>
|
||||
<text text-anchor="start" x="4755.52" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
||||
2022-03-08 17:12:35.997985
|
||||
2022-03-09 22:28:56.561494
|
||||
</text>
|
||||
<polygon fill="none" stroke="#888888" points="4668.02,-4 4668.02,-44 4933.02,-44 4933.02,-4 4668.02,-4" /> <!-- allocationtoken_a08ccbef -->
|
||||
<g id="node1" class="node">
|
||||
|
|
|
@ -103,6 +103,10 @@ V102__add_indexes_to_domain_history_sub_tables.sql
|
|||
V103__creation_time_not_null.sql
|
||||
V104__add_transfer_response_host_id_to_poll_message.sql
|
||||
V105__add_index_on_host_name_in_host_table.sql
|
||||
V106__add_missing_indexes_from_query_analyzer.sql
|
||||
V107__add_billingevent_domainrepoid_indexes.sql
|
||||
V106__add_domain_missing_indexes_from_query_analyzer.sql
|
||||
V107__add_billingevent_missing_indexes.sql
|
||||
V108__add_host_indexes_for_whois.sql
|
||||
V109__add_domain_host_missing_indexes_from_query_analyzer.sql
|
||||
V110__add_graceperiod_missing_indexes_from_query_analyzer.sql
|
||||
V111__add_billingcancellation_missing_indexes.sql
|
||||
V112__add_billingrecurrence_missing_indexes.sql
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
-- Copyright 2022 The Nomulus Authors. All Rights Reserved.
|
||||
--
|
||||
-- Licensed under the Apache License, Version 2.0 (the "License");
|
||||
-- you may not use this file except in compliance with the License.
|
||||
-- You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing, software
|
||||
-- distributed under the License is distributed an "AS IS" BASIS,
|
||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
-- See the License for the specific language governing permissions and
|
||||
-- limitations under the License.
|
||||
|
||||
CREATE INDEX IF NOT EXISTS IDX3y3k7m2bkgahm9sixiohgyrga
|
||||
ON "Domain" (transfer_billing_event_id);
|
||||
CREATE INDEX IF NOT EXISTS IDXsfci08jgsymxy6ovh4k7r358c
|
||||
ON "Domain" (billing_recurrence_id);
|
||||
CREATE INDEX IF NOT EXISTS IDXcju58vqascbpve1t7fem53ctl
|
||||
ON "Domain" (transfer_billing_recurrence_id);
|
|
@ -1,27 +0,0 @@
|
|||
-- Copyright 2022 The Nomulus Authors. All Rights Reserved.
|
||||
--
|
||||
-- Licensed under the Apache License, Version 2.0 (the "License");
|
||||
-- you may not use this file except in compliance with the License.
|
||||
-- You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing, software
|
||||
-- distributed under the License is distributed on an "AS IS" BASIS,
|
||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
-- See the License for the specific language governing permissions and
|
||||
-- limitations under the License.
|
||||
|
||||
CREATE INDEX IDX3y3k7m2bkgahm9sixiohgyrga ON "Domain" (transfer_billing_event_id);
|
||||
CREATE INDEX IDXsfci08jgsymxy6ovh4k7r358c ON "Domain" (billing_recurrence_id);
|
||||
CREATE INDEX IDXcju58vqascbpve1t7fem53ctl ON "Domain" (transfer_billing_recurrence_id);
|
||||
|
||||
CREATE INDEX IDXjw3rwtfrexyq53x9vu7qghrdt ON "DomainHost" (host_repo_id);
|
||||
|
||||
CREATE INDEX IDXbgssjudpm428mrv0xfpvgifps ON "GracePeriod" (billing_event_id);
|
||||
CREATE INDEX IDX5u5m6clpk3nktrvtyy5umacb6 ON "GracePeriod" (billing_recurrence_id);
|
||||
|
||||
CREATE INDEX IDX6ebt3nwk5ocvnremnhnlkl6ff ON "BillingEvent" (cancellation_matching_billing_recurrence_id);
|
||||
|
||||
CREATE INDEX IDX4ytbe5f3b39trsd4okx5ijhs4 ON "BillingCancellation" (billing_event_id);
|
||||
CREATE INDEX IDXku0fopwyvd57ebo8bf0jg9xo2 ON "BillingCancellation" (billing_recurrence_id);
|
|
@ -0,0 +1,18 @@
|
|||
-- Copyright 2022 The Nomulus Authors. All Rights Reserved.
|
||||
--
|
||||
-- Licensed under the Apache License, Version 2.0 (the "License");
|
||||
-- you may not use this file except in compliance with the License.
|
||||
-- You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing, software
|
||||
-- distributed under the License is distributed ON an "AS IS" BASIS,
|
||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
-- See the License for the specific language governing permissions and
|
||||
-- limitations under the License.
|
||||
|
||||
CREATE INDEX IF NOT EXISTS IDX6ebt3nwk5ocvnremnhnlkl6ff
|
||||
ON "BillingEvent" (cancellation_matching_billing_recurrence_id);
|
||||
CREATE INDEX IF NOT EXISTS IDXbgfmveqa7e5hn689koikwn70r
|
||||
ON "BillingEvent" (domain_repo_id);
|
|
@ -12,7 +12,5 @@
|
|||
-- See the License for the specific language governing permissions and
|
||||
-- limitations under the License.
|
||||
|
||||
|
||||
CREATE INDEX IDXbgfmveqa7e5hn689koikwn70r ON "BillingEvent" (domain_repo_id);
|
||||
CREATE INDEX IDXoqttafcywwdn41um6kwlt0n8b ON "BillingRecurrence" (domain_repo_id);
|
||||
CREATE INDEX IDXl8vobbecsd32k4ksavdfx8st6 ON "BillingCancellation" (domain_repo_id);
|
||||
CREATE INDEX IF NOT EXISTS IDXjw3rwtfrexyq53x9vu7qghrdt
|
||||
ON "DomainHost" (host_repo_id);
|
|
@ -0,0 +1,18 @@
|
|||
-- Copyright 2022 The Nomulus Authors. All Rights Reserved.
|
||||
--
|
||||
-- Licensed under the Apache License, Version 2.0 (the "License");
|
||||
-- you may not use this file except in compliance with the License.
|
||||
-- You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing, software
|
||||
-- distributed under the License is distributed on an "AS IS" BASIS,
|
||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
-- See the License for the specific language governing permissions and
|
||||
-- limitations under the License.
|
||||
|
||||
CREATE INDEX IF NOT EXISTS IDXbgssjudpm428mrv0xfpvgifps
|
||||
ON "GracePeriod" (billing_event_id);
|
||||
CREATE INDEX IF NOT EXISTS IDX5u5m6clpk3nktrvtyy5umacb6
|
||||
ON "GracePeriod" (billing_recurrence_id);
|
|
@ -0,0 +1,20 @@
|
|||
-- Copyright 2022 The Nomulus Authors. All Rights Reserved.
|
||||
--
|
||||
-- Licensed under the Apache License, Version 2.0 (the "License");
|
||||
-- you may not use this file except in compliance with the License.
|
||||
-- You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing, software
|
||||
-- distributed under the License is distributed on an "AS IS" BASIS,
|
||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
-- See the License for the specific language governing permissions and
|
||||
-- limitations under the License.
|
||||
|
||||
CREATE INDEX IF NOT EXISTS IDX4ytbe5f3b39trsd4okx5ijhs4
|
||||
ON "BillingCancellation" (billing_event_id);
|
||||
CREATE INDEX IF NOT EXISTS IDXku0fopwyvd57ebo8bf0jg9xo2
|
||||
ON "BillingCancellation" (billing_recurrence_id);
|
||||
CREATE INDEX IF NOT EXISTS IDXl8vobbecsd32k4ksavdfx8st6
|
||||
ON "BillingCancellation" (domain_repo_id);
|
|
@ -0,0 +1,16 @@
|
|||
-- Copyright 2022 The Nomulus Authors. All Rights Reserved.
|
||||
--
|
||||
-- Licensed under the Apache License, Version 2.0 (the "License");
|
||||
-- you may not use this file except in compliance with the License.
|
||||
-- You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing, software
|
||||
-- distributed under the License is distributed on an "AS IS" BASIS,
|
||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
-- See the License for the specific language governing permissions and
|
||||
-- limitations under the License.
|
||||
|
||||
CREATE INDEX IF NOT EXISTS IDXoqttafcywwdn41um6kwlt0n8b
|
||||
ON "BillingRecurrence" (domain_repo_id);
|
Loading…
Add table
Add a link
Reference in a new issue