mirror of
https://github.com/google/nomulus.git
synced 2025-04-29 19:47:51 +02:00
Add a third poll message column in TransferData for domain transfers (#974)
Because we don't store serverApproveEntities specifically as a set in the SQL world, we need to make sure that the entities are all separated and stored if they exist. For domain transfers, there exist three separate poll messages (client losing, client gaining, autorenew) so we need to store and retrieve that one. Founnd this while converting domain transfer flows to SQL.
This commit is contained in:
parent
d79a8b1513
commit
5f1ba8bef4
7 changed files with 2497 additions and 2374 deletions
|
@ -15,7 +15,6 @@
|
|||
package google.registry.model.transfer;
|
||||
|
||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
import static google.registry.model.ImmutableObject.DoNotCompare;
|
||||
import static google.registry.util.CollectionUtils.isNullOrEmpty;
|
||||
import static google.registry.util.CollectionUtils.nullToEmpty;
|
||||
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
|
||||
|
@ -95,6 +94,9 @@ public abstract class TransferData<
|
|||
// the transfer request flow, when the instance is loaded from Datastore, we cannot make this
|
||||
// distinction because they are just VKeys. Also, the only way we use serverApproveEntities is to
|
||||
// just delete all the entities referenced by the VKeys, so we don't need to make the distinction.
|
||||
//
|
||||
// In addition, there may be a third poll message for the autorenew poll message on domain
|
||||
// transfer if applicable.
|
||||
@Ignore
|
||||
@Column(name = "transfer_poll_message_id_1")
|
||||
Long pollMessageId1;
|
||||
|
@ -103,6 +105,10 @@ public abstract class TransferData<
|
|||
@Column(name = "transfer_poll_message_id_2")
|
||||
Long pollMessageId2;
|
||||
|
||||
@Ignore
|
||||
@Column(name = "transfer_poll_message_id_3")
|
||||
Long pollMessageId3;
|
||||
|
||||
public abstract boolean isEmpty();
|
||||
|
||||
@Nullable
|
||||
|
@ -177,6 +183,10 @@ public abstract class TransferData<
|
|||
Key<PollMessage> ofyKey = Key.create(historyEntryKey, PollMessage.class, pollMessageId2);
|
||||
entityKeysBuilder.add(PollMessage.createVKey(ofyKey));
|
||||
}
|
||||
if (pollMessageId3 != null) {
|
||||
Key<PollMessage> ofyKey = Key.create(historyEntryKey, PollMessage.class, pollMessageId3);
|
||||
entityKeysBuilder.add(PollMessage.createVKey(ofyKey));
|
||||
}
|
||||
serverApproveEntities = entityKeysBuilder.build();
|
||||
}
|
||||
|
||||
|
@ -189,6 +199,7 @@ public abstract class TransferData<
|
|||
transferData.repoId = null;
|
||||
transferData.pollMessageId1 = null;
|
||||
transferData.pollMessageId2 = null;
|
||||
transferData.pollMessageId3 = null;
|
||||
return;
|
||||
}
|
||||
// Each element in serverApproveEntities should have the exact same Key<HistoryEntry> as its
|
||||
|
@ -204,6 +215,9 @@ public abstract class TransferData<
|
|||
if (sortedPollMessageIds.size() >= 2) {
|
||||
transferData.pollMessageId2 = sortedPollMessageIds.get(1);
|
||||
}
|
||||
if (sortedPollMessageIds.size() >= 3) {
|
||||
transferData.pollMessageId3 = sortedPollMessageIds.get(2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -261,11 +261,11 @@ td.section {
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="property_name">generated on</td>
|
||||
<td class="property_value">2021-01-21 00:11:27.19594</td>
|
||||
<td class="property_value">2021-02-25 19:33:39.25711</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="property_name">last flyway file</td>
|
||||
<td id="lastFlywayFile" class="property_value">V85__add_required_columns_in_transfer_data.sql</td>
|
||||
<td id="lastFlywayFile" class="property_value">V86__third_poll_message.sql</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -284,7 +284,7 @@ td.section {
|
|||
generated on
|
||||
</text>
|
||||
<text text-anchor="start" x="4035.94" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
||||
2021-01-21 00:11:27.19594
|
||||
2021-02-25 19:33:39.25711
|
||||
</text>
|
||||
<polygon fill="none" stroke="#888888" points="3948.44,-4 3948.44,-44 4205.44,-44 4205.44,-4 3948.44,-4" /> <!-- allocationtoken_a08ccbef -->
|
||||
<g id="node1" class="node">
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -83,3 +83,4 @@ V82__add_columns_to_restore_symmetric_billing_vkey.sql
|
|||
V83__add_indexes_on_domainhost.sql
|
||||
V84__add_vkey_columns_in_billing_cancellation.sql
|
||||
V85__add_required_columns_in_transfer_data.sql
|
||||
V86__third_poll_message.sql
|
||||
|
|
20
db/src/main/resources/sql/flyway/V86__third_poll_message.sql
Normal file
20
db/src/main/resources/sql/flyway/V86__third_poll_message.sql
Normal file
|
@ -0,0 +1,20 @@
|
|||
-- Copyright 2021 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.
|
||||
|
||||
ALTER TABLE "Contact" ADD COLUMN IF NOT EXISTS "transfer_poll_message_id_3" bigint;
|
||||
ALTER TABLE "ContactHistory" ADD COLUMN IF NOT EXISTS "transfer_poll_message_id_3" bigint;
|
||||
ALTER TABLE "Domain" ADD COLUMN IF NOT EXISTS "transfer_poll_message_id_3" bigint;
|
||||
ALTER TABLE "DomainHistory" ADD COLUMN IF NOT EXISTS "transfer_poll_message_id_3" bigint;
|
||||
ALTER TABLE "Host" ADD COLUMN IF NOT EXISTS "transfer_poll_message_id_3" bigint;
|
||||
ALTER TABLE "HostHistory" ADD COLUMN IF NOT EXISTS "transfer_poll_message_id_3" bigint;
|
|
@ -143,6 +143,7 @@
|
|||
transfer_history_entry_id int8,
|
||||
transfer_poll_message_id_1 int8,
|
||||
transfer_poll_message_id_2 int8,
|
||||
transfer_poll_message_id_3 int8,
|
||||
transfer_repo_id text,
|
||||
transfer_client_txn_id text,
|
||||
transfer_server_txn_id text,
|
||||
|
@ -206,6 +207,7 @@
|
|||
transfer_history_entry_id int8,
|
||||
transfer_poll_message_id_1 int8,
|
||||
transfer_poll_message_id_2 int8,
|
||||
transfer_poll_message_id_3 int8,
|
||||
transfer_repo_id text,
|
||||
transfer_client_txn_id text,
|
||||
transfer_server_txn_id text,
|
||||
|
@ -291,6 +293,7 @@
|
|||
transfer_history_entry_id int8,
|
||||
transfer_poll_message_id_1 int8,
|
||||
transfer_poll_message_id_2 int8,
|
||||
transfer_poll_message_id_3 int8,
|
||||
transfer_repo_id text,
|
||||
transfer_client_txn_id text,
|
||||
transfer_server_txn_id text,
|
||||
|
@ -362,6 +365,7 @@
|
|||
transfer_history_entry_id int8,
|
||||
transfer_poll_message_id_1 int8,
|
||||
transfer_poll_message_id_2 int8,
|
||||
transfer_poll_message_id_3 int8,
|
||||
transfer_repo_id text,
|
||||
transfer_client_txn_id text,
|
||||
transfer_server_txn_id text,
|
||||
|
|
|
@ -221,7 +221,8 @@ CREATE TABLE public."Contact" (
|
|||
transfer_status text,
|
||||
update_timestamp timestamp with time zone,
|
||||
transfer_history_entry_id bigint,
|
||||
transfer_repo_id text
|
||||
transfer_repo_id text,
|
||||
transfer_poll_message_id_3 bigint
|
||||
);
|
||||
|
||||
|
||||
|
@ -296,7 +297,8 @@ CREATE TABLE public."ContactHistory" (
|
|||
contact_repo_id text NOT NULL,
|
||||
update_timestamp timestamp with time zone,
|
||||
transfer_history_entry_id bigint,
|
||||
transfer_repo_id text
|
||||
transfer_repo_id text,
|
||||
transfer_poll_message_id_3 bigint
|
||||
);
|
||||
|
||||
|
||||
|
@ -383,7 +385,8 @@ CREATE TABLE public."Domain" (
|
|||
transfer_autorenew_poll_message_history_id bigint,
|
||||
transfer_billing_event_history_id bigint,
|
||||
transfer_history_entry_id bigint,
|
||||
transfer_repo_id text
|
||||
transfer_repo_id text,
|
||||
transfer_poll_message_id_3 bigint
|
||||
);
|
||||
|
||||
|
||||
|
@ -473,7 +476,8 @@ CREATE TABLE public."DomainHistory" (
|
|||
transfer_autorenew_poll_message_history_id bigint,
|
||||
transfer_billing_event_history_id bigint,
|
||||
transfer_history_entry_id bigint,
|
||||
transfer_repo_id text
|
||||
transfer_repo_id text,
|
||||
transfer_poll_message_id_3 bigint
|
||||
);
|
||||
|
||||
|
||||
|
@ -590,7 +594,8 @@ CREATE TABLE public."Host" (
|
|||
last_transfer_time timestamp with time zone,
|
||||
superordinate_domain text,
|
||||
inet_addresses text[],
|
||||
update_timestamp timestamp with time zone
|
||||
update_timestamp timestamp with time zone,
|
||||
transfer_poll_message_id_3 bigint
|
||||
);
|
||||
|
||||
|
||||
|
@ -622,7 +627,8 @@ CREATE TABLE public."HostHistory" (
|
|||
last_epp_update_time timestamp with time zone,
|
||||
statuses text[],
|
||||
host_repo_id text NOT NULL,
|
||||
update_timestamp timestamp with time zone
|
||||
update_timestamp timestamp with time zone,
|
||||
transfer_poll_message_id_3 bigint
|
||||
);
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue