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,12 +1,8 @@
|
||||
package policy
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/errors"
|
||||
"github.com/zitadel/zitadel/internal/eventstore/repository"
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -22,11 +18,11 @@ type LockoutPolicyAddedEvent struct {
|
||||
ShowLockOutFailures bool `json:"showLockOutFailures,omitempty"`
|
||||
}
|
||||
|
||||
func (e *LockoutPolicyAddedEvent) Data() interface{} {
|
||||
func (e *LockoutPolicyAddedEvent) Payload() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func (e *LockoutPolicyAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
func (e *LockoutPolicyAddedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -43,12 +39,12 @@ func NewLockoutPolicyAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func LockoutPolicyAddedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
func LockoutPolicyAddedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
||||
e := &LockoutPolicyAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
|
||||
err := json.Unmarshal(event.Data, e)
|
||||
err := event.Unmarshal(e)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "POLIC-8XiVd", "unable to unmarshal policy")
|
||||
}
|
||||
@@ -63,11 +59,11 @@ type LockoutPolicyChangedEvent struct {
|
||||
ShowLockOutFailures *bool `json:"showLockOutFailures,omitempty"`
|
||||
}
|
||||
|
||||
func (e *LockoutPolicyChangedEvent) Data() interface{} {
|
||||
func (e *LockoutPolicyChangedEvent) Payload() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func (e *LockoutPolicyChangedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
func (e *LockoutPolicyChangedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -101,12 +97,12 @@ func ChangeShowLockOutFailures(showLockOutFailures bool) func(*LockoutPolicyChan
|
||||
}
|
||||
}
|
||||
|
||||
func LockoutPolicyChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
func LockoutPolicyChangedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
||||
e := &LockoutPolicyChangedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
|
||||
err := json.Unmarshal(event.Data, e)
|
||||
err := event.Unmarshal(e)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "POLIC-lWGRc", "unable to unmarshal policy")
|
||||
}
|
||||
@@ -118,11 +114,11 @@ type LockoutPolicyRemovedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *LockoutPolicyRemovedEvent) Data() interface{} {
|
||||
func (e *LockoutPolicyRemovedEvent) Payload() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *LockoutPolicyRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
|
||||
func (e *LockoutPolicyRemovedEvent) UniqueConstraints() []*eventstore.UniqueConstraint {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -132,7 +128,7 @@ func NewLockoutPolicyRemovedEvent(base *eventstore.BaseEvent) *LockoutPolicyRemo
|
||||
}
|
||||
}
|
||||
|
||||
func LockoutPolicyRemovedEventMapper(event *repository.Event) (eventstore.Event, error) {
|
||||
func LockoutPolicyRemovedEventMapper(event eventstore.Event) (eventstore.Event, error) {
|
||||
return &LockoutPolicyRemovedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
|
Reference in New Issue
Block a user