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

@@ -4,16 +4,15 @@ import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/zitadel/zitadel/internal/api/authz"
"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/notification/channels/fs"
"github.com/zitadel/zitadel/internal/repository/instance"
"github.com/zitadel/zitadel/internal/repository/settings"
"github.com/stretchr/testify/assert"
)
func TestCommandSide_AddDefaultDebugNotificationProviderFile(t *testing.T) {
@@ -28,6 +27,7 @@ func TestCommandSide_AddDefaultDebugNotificationProviderFile(t *testing.T) {
want *domain.ObjectDetails
err func(error) bool
}
ctx := authz.WithInstanceID(context.Background(), "INSTANCE")
tests := []struct {
name string
fields fields
@@ -41,7 +41,7 @@ func TestCommandSide_AddDefaultDebugNotificationProviderFile(t *testing.T) {
t,
expectFilter(
eventFromEventPusher(
instance.NewDebugNotificationProviderFileAddedEvent(context.Background(),
instance.NewDebugNotificationProviderFileAddedEvent(ctx,
&instance.NewAggregate("INSTANCE").Aggregate,
true,
),
@@ -50,7 +50,7 @@ func TestCommandSide_AddDefaultDebugNotificationProviderFile(t *testing.T) {
),
},
args: args{
ctx: context.Background(),
ctx: ctx,
provider: &fs.Config{
Compact: true,
Enabled: true,
@@ -67,20 +67,15 @@ func TestCommandSide_AddDefaultDebugNotificationProviderFile(t *testing.T) {
t,
expectFilter(),
expectPush(
[]*repository.Event{
eventFromEventPusherWithInstanceID(
"INSTANCE",
instance.NewDebugNotificationProviderFileAddedEvent(context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate,
true,
),
),
},
instance.NewDebugNotificationProviderFileAddedEvent(ctx,
&instance.NewAggregate("INSTANCE").Aggregate,
true,
),
),
),
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
ctx: authz.WithInstanceID(ctx, "INSTANCE"),
provider: &fs.Config{
Compact: true,
},
@@ -215,13 +210,8 @@ func TestCommandSide_ChangeDebugNotificationProviderFile(t *testing.T) {
),
),
expectPush(
[]*repository.Event{
eventFromEventPusherWithInstanceID(
"INSTANCE",
newDefaultDebugNotificationFileChangedEvent(context.Background(),
false),
),
},
newDefaultDebugNotificationFileChangedEvent(context.Background(),
false),
),
),
},
@@ -305,13 +295,8 @@ func TestCommandSide_RemoveDebugNotificationProviderFile(t *testing.T) {
),
),
expectPush(
[]*repository.Event{
eventFromEventPusherWithInstanceID(
"INSTANCE",
instance.NewDebugNotificationProviderFileRemovedEvent(context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate),
),
},
instance.NewDebugNotificationProviderFileRemovedEvent(context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate),
),
),
},