mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:17:32 +00:00
feat(eventstore): increase parallel write capabilities (#5940)
This implementation increases parallel write capabilities of the eventstore. Please have a look at the technical advisories: [05](https://zitadel.com/docs/support/advisory/a10005) and [06](https://zitadel.com/docs/support/advisory/a10006). The implementation of eventstore.push is rewritten and stored events are migrated to a new table `eventstore.events2`. If you are using cockroach: make sure that the database user of ZITADEL has `VIEWACTIVITY` grant. This is used to query events.
This commit is contained in:
@@ -2,6 +2,7 @@ package initialise
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"database/sql/driver"
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
@@ -30,11 +31,53 @@ func Test_verifyEvents(t *testing.T) {
|
||||
},
|
||||
targetErr: sql.ErrConnDone,
|
||||
},
|
||||
{
|
||||
name: "events already exists",
|
||||
args: args{
|
||||
db: prepareDB(t,
|
||||
expectBegin(nil),
|
||||
expectQuery(
|
||||
"SELECT count(*) FROM information_schema.tables WHERE table_schema = 'eventstore' AND table_name like 'events%'",
|
||||
nil,
|
||||
[]string{"count"},
|
||||
[][]driver.Value{
|
||||
{1},
|
||||
},
|
||||
),
|
||||
expectCommit(nil),
|
||||
),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "events and events2 already exists",
|
||||
args: args{
|
||||
db: prepareDB(t,
|
||||
expectBegin(nil),
|
||||
expectQuery(
|
||||
"SELECT count(*) FROM information_schema.tables WHERE table_schema = 'eventstore' AND table_name like 'events%'",
|
||||
nil,
|
||||
[]string{"count"},
|
||||
[][]driver.Value{
|
||||
{2},
|
||||
},
|
||||
),
|
||||
expectCommit(nil),
|
||||
),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "create table fails",
|
||||
args: args{
|
||||
db: prepareDB(t,
|
||||
expectBegin(nil),
|
||||
expectQuery(
|
||||
"SELECT count(*) FROM information_schema.tables WHERE table_schema = 'eventstore' AND table_name like 'events%'",
|
||||
nil,
|
||||
[]string{"count"},
|
||||
[][]driver.Value{
|
||||
{0},
|
||||
},
|
||||
),
|
||||
expectExec(createEventsStmt, sql.ErrNoRows),
|
||||
expectRollback(nil),
|
||||
),
|
||||
@@ -46,6 +89,14 @@ func Test_verifyEvents(t *testing.T) {
|
||||
args: args{
|
||||
db: prepareDB(t,
|
||||
expectBegin(nil),
|
||||
expectQuery(
|
||||
"SELECT count(*) FROM information_schema.tables WHERE table_schema = 'eventstore' AND table_name like 'events%'",
|
||||
nil,
|
||||
[]string{"count"},
|
||||
[][]driver.Value{
|
||||
{0},
|
||||
},
|
||||
),
|
||||
expectExec(createEventsStmt, nil),
|
||||
expectCommit(nil),
|
||||
),
|
||||
|
Reference in New Issue
Block a user