Add an extension to verify transaction replay (#857)

* Add an extension to verify transaction replay

Add ReplayExtension, which can be applied to test suites to verify that
transactions committed to datastore can be replayed to SQL.

This introduces a ReplayQueue class, which serves as a stand-in for the
current lack of replay-from-commit-logs.  It also includes replay logic in
TransactionInfo which introduces the concept of "entity class weights."
Entity weighting allows us store and delete objects in an order that is
consistent with the direction of foreign key and deferred foreign key
relationships.  As a general rule, lower weight classes must have no direct or
indirect non-deferred foreign key relationships on higher weight classes.

It is expected that much of this code will change when the final replay
mechanism is implemented.

* Minor fixes:

- Initialize "requestedByRegistrar" to false (it's non-nullable). [reverted
  during rebase: non-nullable was removed in another PR]
- Store test entities (registrar, hosts and contacts) in JPA.

* Make testbed save replay

This changes the replay system to make datastore saves initiated from the
testbed (as opposed to just the tested code) replay when the ReplayExtension
is enabled.  This requires modifications to DatastoreHelper and the
AppEngineExtension that the ReplayExtension can plug into.

This changes also has some necessary fixes to objects that are persisted by
the testbed (such as PremiumList).
This commit is contained in:
Michael Muller 2020-11-17 13:29:50 -05:00 committed by GitHub
parent df5a35ac44
commit 385e8fb6ec
19 changed files with 371 additions and 65 deletions

View file

@ -22,7 +22,6 @@
discount_premiums boolean not null,
discount_years int4 not null,
domain_name text,
redemption_history_entry text,
token_status_transitions hstore,
token_type text,
primary key (token)
@ -524,7 +523,7 @@
create table "PremiumList" (
revision_id bigserial not null,
creation_timestamp timestamptz not null,
creation_timestamp timestamptz,
name text not null,
bloom_filter bytea not null,
currency text not null,
@ -635,7 +634,7 @@
create table "ReservedList" (
revision_id bigserial not null,
creation_timestamp timestamptz not null,
creation_timestamp timestamptz,
name text not null,
should_publish boolean not null,
primary key (revision_id)