fix(spooler): correct workers (#508)

* one concurrent task

* disable spooler

* fix: improve concurrency in spooler

* fix: dont block lock

* fix: break if lock failed

* fix: check if handler is working

* fix: worker id

* fix: test

* fix: use limit for spoolers configured in startup.yaml

* fix test

* fix: factory

* fix(key): only reduce if not expired

* fix(searchQueryFactory): check for string-slice in aggregateID

* fix(migrations): combine migrations

* fix: allow saving multiple objects in one request

* fix(eventstore): logging

* fix(eventstore): rethink insert i locks table

* fix: ignore failed tests for the moment

* fix: tuubel

* fix: for tests in io

* fix: ignore tests for io

* fix: rename concurrent tasks to workers

* fix: incomment tests and remove some tests

* fix: refert changes for io

* refactor(eventstore): combine types of sql in one file

* refactor(eventstore): logs, TODO's, tests

* fix(eventstore): sql package

* test(eventstore): add tests for search query factory

* chore: logs

* fix(spooler): optimize lock query
chore(migrations): rename locks.object_type to view_name
chore(migrations): refactor migrations

* test: incomment tests

* fix: rename PrepareSaves to PrepareBulkSave

* chore: go dependencies

* fix(migrations): add id in events table

* refactor(lock): less magic numbers

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Silvan
2020-07-28 09:42:21 +02:00
committed by GitHub
parent 531060ab67
commit 41e1a7cc7b
90 changed files with 2210 additions and 1471 deletions

View File

@@ -1,17 +1,15 @@
BEGIN;
CREATE TABLE management.locks (
locker_id TEXT,
locked_until TIMESTAMPTZ,
object_type TEXT,
locked_until TIMESTAMPTZ(3),
view_name TEXT,
PRIMARY KEY (object_type)
PRIMARY KEY (view_name)
);
CREATE TABLE management.current_sequences (
view_name TEXT,
current_sequence BIGINT,
timestamp TIMESTAMPTZ,
PRIMARY KEY (view_name)
);
@@ -82,6 +80,7 @@ CREATE TABLE management.project_members (
first_name TEXT,
last_name TEXT,
roles TEXT ARRAY,
display_name TEXT,
sequence BIGINT,
PRIMARY KEY (project_id, user_id)
@@ -100,6 +99,7 @@ CREATE TABLE management.project_grant_members (
first_name TEXT,
last_name TEXT,
roles TEXT ARRAY,
display_name TEXT,
sequence BIGINT,
PRIMARY KEY (grant_id, user_id)
@@ -181,6 +181,7 @@ CREATE TABLE management.user_grants (
last_name TEXT,
email TEXT,
role_keys TEXT Array,
grant_id TEXT,
grant_state SMALLINT,
creation_date TIMESTAMPTZ,
@@ -190,16 +191,30 @@ CREATE TABLE management.user_grants (
PRIMARY KEY (id)
);
CREATE TABLE management.org_domains (
creation_date TIMESTAMPTZ,
change_date TIMESTAMPTZ,
sequence BIGINT,
domain TEXT,
org_id TEXT,
verified BOOLEAN,
primary_domain BOOLEAN,
PRIMARY KEY (org_id, domain)
);
CREATE TABLE auth.locks (
locker_id TEXT,
locked_until TIMESTAMPTZ,
object_type TEXT,
locked_until TIMESTAMPTZ(3),
view_name TEXT,
PRIMARY KEY (object_type)
PRIMARY KEY (view_name)
);
CREATE TABLE auth.current_sequences (
view_name TEXT,
timestamp TIMESTAMPTZ,
current_sequence BIGINT,
@@ -305,14 +320,15 @@ CREATE TABLE auth.tokens (
CREATE TABLE notification.locks (
locker_id TEXT,
locked_until TIMESTAMPTZ,
object_type TEXT,
locked_until TIMESTAMPTZ(3),
view_name TEXT,
PRIMARY KEY (object_type)
PRIMARY KEY (view_name)
);
CREATE TABLE notification.current_sequences (
view_name TEXT,
timestamp TIMESTAMPTZ,
current_sequence BIGINT,
@@ -348,6 +364,8 @@ CREATE TABLE notification.notify_users (
verified_phone TEXT,
sequence BIGINT,
password_set BOOLEAN,
login_names TEXT,
preferred_login_name TEXT,
PRIMARY KEY (id)
);
@@ -378,20 +396,38 @@ CREATE TABLE adminapi.failed_events (
CREATE TABLE adminapi.locks (
locker_id TEXT,
locked_until TIMESTAMPTZ,
object_type TEXT,
locked_until TIMESTAMPTZ(3),
view_name TEXT,
PRIMARY KEY (object_type)
PRIMARY KEY (view_name)
);
CREATE TABLE adminapi.current_sequences (
view_name TEXT,
timestamp TIMESTAMPTZ,
current_sequence BIGINT,
PRIMARY KEY (view_name)
);
CREATE TABLE adminapi.iam_members (
user_id TEXT,
iam_id TEXT,
creation_date TIMESTAMPTZ,
change_date TIMESTAMPTZ,
user_name TEXT,
email_address TEXT,
first_name TEXT,
last_name TEXT,
roles TEXT ARRAY,
display_name TEXT,
sequence BIGINT,
PRIMARY KEY (user_id)
);
CREATE TABLE management.orgs (
id TEXT,
@@ -419,6 +455,7 @@ CREATE TABLE management.org_members (
first_name TEXT,
last_name TEXT,
roles TEXT ARRAY,
display_name TEXT,
sequence BIGINT,
PRIMARY KEY (org_id, user_id)
@@ -479,6 +516,7 @@ CREATE TABLE auth.user_grants (
display_name TEXT,
email TEXT,
role_keys TEXT Array,
grant_id TEXT,
grant_state SMALLINT,
creation_date TIMESTAMPTZ,
@@ -504,14 +542,15 @@ CREATE TABLE auth.orgs (
CREATE TABLE authz.locks (
locker_id TEXT,
locked_until TIMESTAMPTZ,
object_type TEXT,
locked_until TIMESTAMPTZ(3),
view_name TEXT,
PRIMARY KEY (object_type)
PRIMARY KEY (view_name)
);
CREATE TABLE authz.current_sequences (
view_name TEXT,
timestamp TIMESTAMPTZ,
current_sequence BIGINT,
@@ -540,6 +579,7 @@ CREATE TABLE authz.user_grants (
display_name TEXT,
email TEXT,
role_keys TEXT Array,
grant_id TEXT,
grant_state SMALLINT,
creation_date TIMESTAMPTZ,
@@ -573,34 +613,16 @@ CREATE TABLE authz.applications (
PRIMARY KEY (id)
);
CREATE TABLE management.org_domains (
CREATE TABLE authz.orgs (
id TEXT,
creation_date TIMESTAMPTZ,
change_date TIMESTAMPTZ,
resource_owner TEXT,
org_state SMALLINT,
sequence BIGINT,
domain TEXT,
org_id TEXT,
verified BOOLEAN,
primary_domain BOOLEAN,
name TEXT,
PRIMARY KEY (org_id, domain)
PRIMARY KEY (id)
);
CREATE TABLE adminapi.iam_members (
user_id TEXT,
iam_id TEXT,
creation_date TIMESTAMPTZ,
change_date TIMESTAMPTZ,
user_name TEXT,
email_address TEXT,
first_name TEXT,
last_name TEXT,
roles TEXT ARRAY,
sequence BIGINT,
PRIMARY KEY (user_id)
);
COMMIT;