mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:37: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:
@@ -1,11 +1,8 @@
|
||||
package settings
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/errors"
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
"github.com/zitadel/zitadel/internal/eventstore/repository"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -23,11 +20,11 @@ type DebugNotificationProviderAddedEvent struct {
|
||||
Compact bool `json:"compact,omitempty"`
|
||||
}
|
||||
|
||||
func (e *DebugNotificationProviderAddedEvent) Data() interface{} {
|
||||
func (e *DebugNotificationProviderAddedEvent) Payload() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func (e *DebugNotificationProviderAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
func (e *DebugNotificationProviderAddedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -41,12 +38,12 @@ func NewDebugNotificationProviderAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func DebugNotificationProviderAddedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
func DebugNotificationProviderAddedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
||||
e := &DebugNotificationProviderAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
|
||||
err := json.Unmarshal(event.Data, e)
|
||||
err := event.Unmarshal(e)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "SET-f93ns", "unable to unmarshal debug notification added")
|
||||
}
|
||||
@@ -60,11 +57,11 @@ type DebugNotificationProviderChangedEvent struct {
|
||||
Compact *bool `json:"compact,omitempty"`
|
||||
}
|
||||
|
||||
func (e *DebugNotificationProviderChangedEvent) Data() interface{} {
|
||||
func (e *DebugNotificationProviderChangedEvent) Payload() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func (e *DebugNotificationProviderChangedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
func (e *DebugNotificationProviderChangedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -92,12 +89,12 @@ func ChangeCompact(compact bool) func(*DebugNotificationProviderChangedEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
func DebugNotificationProviderChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
func DebugNotificationProviderChangedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
||||
e := &DebugNotificationProviderChangedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
|
||||
err := json.Unmarshal(event.Data, e)
|
||||
err := event.Unmarshal(e)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "POLIC-ehssl", "unable to unmarshal policy")
|
||||
}
|
||||
@@ -109,11 +106,11 @@ type DebugNotificationProviderRemovedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *DebugNotificationProviderRemovedEvent) Data() interface{} {
|
||||
func (e *DebugNotificationProviderRemovedEvent) Payload() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *DebugNotificationProviderRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
func (e *DebugNotificationProviderRemovedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -123,7 +120,7 @@ func NewDebugNotificationProviderRemovedEvent(base *eventstore.BaseEvent) *Debug
|
||||
}
|
||||
}
|
||||
|
||||
func DebugNotificationProviderRemovedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
func DebugNotificationProviderRemovedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
||||
return &DebugNotificationProviderRemovedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
|
Reference in New Issue
Block a user