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:
Silvan
2023-10-19 12:19:10 +02:00
committed by GitHub
parent 259faba3f0
commit b5564572bc
791 changed files with 30326 additions and 43202 deletions

View File

@@ -11,7 +11,6 @@ import (
"github.com/zitadel/zitadel/internal/domain"
caos_errs "github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore"
"github.com/zitadel/zitadel/internal/eventstore/repository"
"github.com/zitadel/zitadel/internal/id"
id_mock "github.com/zitadel/zitadel/internal/id/mock"
"github.com/zitadel/zitadel/internal/notification/channels/twilio"
@@ -46,22 +45,19 @@ func TestCommandSide_AddSMSConfigTwilio(t *testing.T) {
t,
expectFilter(),
expectPush(
[]*repository.Event{
eventFromEventPusher(instance.NewSMSConfigTwilioAddedEvent(
context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate,
"providerid",
"sid",
"senderName",
&crypto.CryptoValue{
CryptoType: crypto.TypeEncryption,
Algorithm: "enc",
KeyID: "id",
Crypted: []byte("token"),
},
),
),
},
instance.NewSMSConfigTwilioAddedEvent(
context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate,
"providerid",
"sid",
"senderName",
&crypto.CryptoValue{
CryptoType: crypto.TypeEncryption,
Algorithm: "enc",
KeyID: "id",
Crypted: []byte("token"),
},
),
),
),
idGenerator: id_mock.NewIDGeneratorExpectIDs(t, "providerid"),
@@ -218,16 +214,12 @@ func TestCommandSide_ChangeSMSConfigTwilio(t *testing.T) {
),
),
expectPush(
[]*repository.Event{
eventFromEventPusher(
newSMSConfigTwilioChangedEvent(
context.Background(),
"providerid",
"sid2",
"senderName2",
),
),
},
newSMSConfigTwilioChangedEvent(
context.Background(),
"providerid",
"sid2",
"senderName2",
),
),
),
},
@@ -335,15 +327,11 @@ func TestCommandSide_ActivateSMSConfigTwilio(t *testing.T) {
),
),
expectPush(
[]*repository.Event{
eventFromEventPusher(
instance.NewSMSConfigTwilioActivatedEvent(
context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate,
"providerid",
),
),
},
instance.NewSMSConfigTwilioActivatedEvent(
context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate,
"providerid",
),
),
),
},
@@ -453,15 +441,11 @@ func TestCommandSide_DeactivateSMSConfigTwilio(t *testing.T) {
),
),
expectPush(
[]*repository.Event{
eventFromEventPusher(
instance.NewSMSConfigDeactivatedEvent(
context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate,
"providerid",
),
),
},
instance.NewSMSConfigDeactivatedEvent(
context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate,
"providerid",
),
),
),
},
@@ -564,15 +548,11 @@ func TestCommandSide_RemoveSMSConfig(t *testing.T) {
),
),
expectPush(
[]*repository.Event{
eventFromEventPusher(
instance.NewSMSConfigRemovedEvent(
context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate,
"providerid",
),
),
},
instance.NewSMSConfigRemovedEvent(
context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate,
"providerid",
),
),
),
},