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

@@ -2,13 +2,10 @@ package user
import (
"context"
"encoding/json"
"github.com/zitadel/zitadel/internal/eventstore"
"github.com/zitadel/zitadel/internal/domain"
"github.com/zitadel/zitadel/internal/errors"
"github.com/zitadel/zitadel/internal/eventstore/repository"
"github.com/zitadel/zitadel/internal/eventstore"
"golang.org/x/text/language"
)
@@ -28,11 +25,11 @@ type HumanProfileChangedEvent struct {
Gender *domain.Gender `json:"gender,omitempty"`
}
func (e *HumanProfileChangedEvent) Data() interface{} {
func (e *HumanProfileChangedEvent) Payload() interface{} {
return e
}
func (e *HumanProfileChangedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
func (e *HumanProfileChangedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
return nil
}
@@ -95,11 +92,11 @@ func ChangeGender(gender domain.Gender) func(event *HumanProfileChangedEvent) {
}
}
func HumanProfileChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
func HumanProfileChangedEventMapper(event eventstore.Event) (eventstore.Event, error) {
profileChanged := &HumanProfileChangedEvent{
BaseEvent: *eventstore.BaseEventFromRepo(event),
}
err := json.Unmarshal(event.Data, profileChanged)
err := event.Unmarshal(profileChanged)
if err != nil {
return nil, errors.ThrowInternal(err, "USER-5M0pd", "unable to unmarshal human profile changed")
}