Add a process time column to DnsRefreshRequest (#1948)

The value of the column would be set to START_OF_TIME for new entries.
Every time a row is read, the value is updated to the current time. This
allows concurrent reads to not repeatedly read the same entry that has the
earliest request time, because they would only look for rows that have a value
of process time that is before current time - some padding time.

This basically fulfills the same function that LEASE_PADDING gives us
when using a pull queue, whereas a task would be leased for a certain
time, during which time they would not be leased by anyone else.

See: https://cs.opensource.google/nomulus/nomulus/+/master:core/src/main/java/google/registry/dns/ReadDnsQueueAction.java;l=99?q=readdnsqueue&ss=nomulus%2Fnomulus
This commit is contained in:
Lai Jiang 2023-02-28 16:52:02 -05:00 committed by GitHub
parent 9a212314ca
commit 9137978083
5 changed files with 1588 additions and 1523 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -134,3 +134,4 @@ V133__add_pull_queue_replace_columns.sql
V134__drop_not_null_request_id_lock_table.sql
V135__null_gaia_id_user.sql
V136__add_dns_refresh_request_table.sql
V137__add_process_time_column.sql

View file

@ -0,0 +1,18 @@
-- Copyright 2023 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 "DnsRefreshRequest"
ADD COLUMN IF NOT EXISTS process_time timestamptz NOT NULL;
CREATE INDEX IDX3i7i2ktts9d7lcjbs34h0pvwo ON "DnsRefreshRequest" (process_time);

View file

@ -349,7 +349,8 @@ CREATE TABLE public."DnsRefreshRequest" (
name text NOT NULL,
request_time timestamp with time zone NOT NULL,
tld text NOT NULL,
type text NOT NULL
type text NOT NULL,
process_time timestamp with time zone NOT NULL
);
@ -1627,6 +1628,13 @@ CREATE INDEX idx1rcgkdd777bpvj0r94sltwd5y ON public."Domain" USING btree (domain
CREATE INDEX idx2exdfbx6oiiwnhr8j6gjpqt2j ON public."BillingCancellation" USING btree (event_time);
--
-- Name: idx3i7i2ktts9d7lcjbs34h0pvwo; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx3i7i2ktts9d7lcjbs34h0pvwo ON public."DnsRefreshRequest" USING btree (process_time);
--
-- Name: idx3y3k7m2bkgahm9sixiohgyrga; Type: INDEX; Schema: public; Owner: -
--