mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 03:37:34 +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:
@@ -6,8 +6,7 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/errors"
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
"github.com/zitadel/zitadel/internal/eventstore/handler"
|
||||
"github.com/zitadel/zitadel/internal/eventstore/repository"
|
||||
"github.com/zitadel/zitadel/internal/eventstore/handler/v2"
|
||||
"github.com/zitadel/zitadel/internal/repository/instance"
|
||||
)
|
||||
|
||||
@@ -25,18 +24,18 @@ func TestDebugNotificationProviderProjection_reduces(t *testing.T) {
|
||||
name: "instance reduceNotificationProviderFileAdded",
|
||||
reduce: (&debugNotificationProviderProjection{}).reduceDebugNotificationProviderAdded,
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.DebugNotificationProviderFileAddedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.DebugNotificationProviderFileAddedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{
|
||||
"compact": true
|
||||
}`),
|
||||
), instance.DebugNotificationProviderFileAddedEventMapper),
|
||||
), instance.DebugNotificationProviderFileAddedEventMapper),
|
||||
},
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -61,18 +60,18 @@ func TestDebugNotificationProviderProjection_reduces(t *testing.T) {
|
||||
name: "instance reduceNotificationProviderFileChanged",
|
||||
reduce: (&debugNotificationProviderProjection{}).reduceDebugNotificationProviderChanged,
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.DebugNotificationProviderFileChangedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.DebugNotificationProviderFileChangedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{
|
||||
"compact": true
|
||||
}`),
|
||||
), instance.DebugNotificationProviderFileChangedEventMapper),
|
||||
), instance.DebugNotificationProviderFileChangedEventMapper),
|
||||
},
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -94,16 +93,16 @@ func TestDebugNotificationProviderProjection_reduces(t *testing.T) {
|
||||
name: "instance reduceNotificationProviderFileRemoved",
|
||||
reduce: (&debugNotificationProviderProjection{}).reduceDebugNotificationProviderRemoved,
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.DebugNotificationProviderFileRemovedEventType),
|
||||
instance.AggregateType,
|
||||
nil,
|
||||
), instance.DebugNotificationProviderFileRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.DebugNotificationProviderFileRemovedEventType,
|
||||
instance.AggregateType,
|
||||
nil,
|
||||
), instance.DebugNotificationProviderFileRemovedEventMapper),
|
||||
},
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -122,18 +121,18 @@ func TestDebugNotificationProviderProjection_reduces(t *testing.T) {
|
||||
name: "instance reduceNotificationProviderLogAdded",
|
||||
reduce: (&debugNotificationProviderProjection{}).reduceDebugNotificationProviderAdded,
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.DebugNotificationProviderLogAddedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.DebugNotificationProviderLogAddedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{
|
||||
"compact": true
|
||||
}`),
|
||||
), instance.DebugNotificationProviderLogAddedEventMapper),
|
||||
), instance.DebugNotificationProviderLogAddedEventMapper),
|
||||
},
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -158,18 +157,18 @@ func TestDebugNotificationProviderProjection_reduces(t *testing.T) {
|
||||
name: "instance reduceNotificationProviderLogChanged",
|
||||
reduce: (&debugNotificationProviderProjection{}).reduceDebugNotificationProviderChanged,
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.DebugNotificationProviderLogChangedEventType),
|
||||
instance.AggregateType,
|
||||
[]byte(`{
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.DebugNotificationProviderLogChangedEventType,
|
||||
instance.AggregateType,
|
||||
[]byte(`{
|
||||
"compact": true
|
||||
}`),
|
||||
), instance.DebugNotificationProviderLogChangedEventMapper),
|
||||
), instance.DebugNotificationProviderLogChangedEventMapper),
|
||||
},
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -191,16 +190,16 @@ func TestDebugNotificationProviderProjection_reduces(t *testing.T) {
|
||||
name: "instance reduceNotificationProviderLogRemoved",
|
||||
reduce: (&debugNotificationProviderProjection{}).reduceDebugNotificationProviderRemoved,
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.DebugNotificationProviderLogRemovedEventType),
|
||||
instance.AggregateType,
|
||||
nil,
|
||||
), instance.DebugNotificationProviderLogRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.DebugNotificationProviderLogRemovedEventType,
|
||||
instance.AggregateType,
|
||||
nil,
|
||||
), instance.DebugNotificationProviderLogRemovedEventMapper),
|
||||
},
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
@@ -218,17 +217,17 @@ func TestDebugNotificationProviderProjection_reduces(t *testing.T) {
|
||||
{
|
||||
name: "instance reduceInstanceRemoved",
|
||||
args: args{
|
||||
event: getEvent(testEvent(
|
||||
repository.EventType(instance.InstanceRemovedEventType),
|
||||
instance.AggregateType,
|
||||
nil,
|
||||
), instance.InstanceRemovedEventMapper),
|
||||
event: getEvent(
|
||||
testEvent(
|
||||
instance.InstanceRemovedEventType,
|
||||
instance.AggregateType,
|
||||
nil,
|
||||
), instance.InstanceRemovedEventMapper),
|
||||
},
|
||||
reduce: reduceInstanceRemovedHelper(DebugNotificationProviderInstanceIDCol),
|
||||
want: wantReduce{
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
previousSequence: 10,
|
||||
aggregateType: eventstore.AggregateType("instance"),
|
||||
sequence: 15,
|
||||
executer: &testExecuter{
|
||||
executions: []execution{
|
||||
{
|
||||
|
Reference in New Issue
Block a user