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:
@@ -1,13 +1,10 @@
|
||||
package policy
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"golang.org/x/text/language"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/errors"
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
"github.com/zitadel/zitadel/internal/eventstore/repository"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -26,11 +23,11 @@ type CustomTextSetEvent struct {
|
||||
Text string `json:"text,omitempty"`
|
||||
}
|
||||
|
||||
func (e *CustomTextSetEvent) Data() interface{} {
|
||||
func (e *CustomTextSetEvent) Payload() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func (e *CustomTextSetEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
func (e *CustomTextSetEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -50,12 +47,12 @@ func NewCustomTextSetEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func CustomTextSetEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
func CustomTextSetEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
||||
e := &CustomTextSetEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
|
||||
err := json.Unmarshal(event.Data, e)
|
||||
err := event.Unmarshal(e)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "TEXT-28dwe", "unable to unmarshal custom text")
|
||||
}
|
||||
@@ -71,11 +68,11 @@ type CustomTextRemovedEvent struct {
|
||||
Language language.Tag `json:"language,omitempty"`
|
||||
}
|
||||
|
||||
func (e *CustomTextRemovedEvent) Data() interface{} {
|
||||
func (e *CustomTextRemovedEvent) Payload() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func (e *CustomTextRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
func (e *CustomTextRemovedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -88,12 +85,12 @@ func NewCustomTextRemovedEvent(base *eventstore.BaseEvent, template, key string,
|
||||
}
|
||||
}
|
||||
|
||||
func CustomTextRemovedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
func CustomTextRemovedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
||||
e := &CustomTextRemovedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
|
||||
err := json.Unmarshal(event.Data, e)
|
||||
err := event.Unmarshal(e)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "TEXT-28sMf", "unable to unmarshal custom text removed")
|
||||
}
|
||||
@@ -108,11 +105,11 @@ type CustomTextTemplateRemovedEvent struct {
|
||||
Language language.Tag `json:"language,omitempty"`
|
||||
}
|
||||
|
||||
func (e *CustomTextTemplateRemovedEvent) Data() interface{} {
|
||||
func (e *CustomTextTemplateRemovedEvent) Payload() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func (e *CustomTextTemplateRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
func (e *CustomTextTemplateRemovedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -124,12 +121,12 @@ func NewCustomTextTemplateRemovedEvent(base *eventstore.BaseEvent, template stri
|
||||
}
|
||||
}
|
||||
|
||||
func CustomTextTemplateRemovedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
func CustomTextTemplateRemovedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
||||
e := &CustomTextTemplateRemovedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
|
||||
err := json.Unmarshal(event.Data, e)
|
||||
err := event.Unmarshal(e)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "TEXT-mKKRs", "unable to unmarshal custom text message removed")
|
||||
}
|
||||
|
Reference in New Issue
Block a user