Add Cloud SQL premium list caches and compare prices with Datastore (#376)

* Add Cloud SQL premium list caches and compare prices with Datastore

Nothing will fail if the prices can't be loaded from Cloud SQL, or if the prices
are different. All that happens is that the error is logged. Then, once this is
running in production for awhile, we'll look at the logs and see if there will
be any pricing implications from switching over to the Cloud SQL version of the
premium lists.

* Add setMaxResults(1) per code review

* Add tests and reorder public functions

* Don't statically import caches

* Improve test pass rate

* Merge branch 'master' into dual-read-premium

* Add PremiumEntry mapping

* Allow update

* Revert column order

* Alphabetize PremiumEntry columns

* Don't bother trying to enforce order

* Private constructor
This commit is contained in:
Ben McIlwain 2019-12-11 16:20:19 -05:00 committed by GitHub
parent 3aad8b6aa7
commit db7fcf6c38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 438 additions and 17 deletions

View file

@ -0,0 +1,16 @@
-- Copyright 2019 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.
-- Remove default set in V9 that we no longer need.
alter table "PremiumList" alter column currency drop default;

View file

@ -15,5 +15,5 @@
-- Note: We're OK with dropping this data since it's not live in production yet.
alter table "PremiumList" drop column if exists currency;
-- TODO(mcilwain): Add a subsequent schema change to remove this default.
-- Note: This default was removed in V11.
alter table "PremiumList" add column currency text not null default 'USD';

View file

@ -132,8 +132,8 @@
create table "PremiumEntry" (
revision_id int8 not null,
price numeric(19, 2) not null,
domain_label text not null,
price numeric(19, 2) not null,
primary key (revision_id, domain_label)
);

View file

@ -93,7 +93,7 @@ CREATE TABLE public."PremiumList" (
creation_timestamp timestamp with time zone NOT NULL,
name text NOT NULL,
bloom_filter bytea NOT NULL,
currency text DEFAULT 'USD'::text NOT NULL
currency text NOT NULL
);