mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:07:30 +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,31 +1,37 @@
|
||||
package eventstore
|
||||
|
||||
type EventUniqueConstraint struct {
|
||||
type UniqueConstraint struct {
|
||||
// UniqueType is the table name for the unique constraint
|
||||
UniqueType string
|
||||
//UniqueField is the unique key
|
||||
// UniqueField is the unique key
|
||||
UniqueField string
|
||||
//Action defines if unique constraint should be added or removed
|
||||
// Action defines if unique constraint should be added or removed
|
||||
Action UniqueConstraintAction
|
||||
//ErrorMessage defines the translation file key for the error message
|
||||
// ErrorMessage defines the translation file key for the error message
|
||||
ErrorMessage string
|
||||
//IsGlobal defines if the unique constraint is globally unique or just within a single instance
|
||||
// IsGlobal defines if the unique constraint is globally unique or just within a single instance
|
||||
IsGlobal bool
|
||||
}
|
||||
|
||||
type UniqueConstraintAction int32
|
||||
type UniqueConstraintAction int8
|
||||
|
||||
const (
|
||||
UniqueConstraintAdd UniqueConstraintAction = iota
|
||||
UniqueConstraintRemove
|
||||
UniqueConstraintInstanceRemove
|
||||
|
||||
uniqueConstraintActionCount
|
||||
)
|
||||
|
||||
func (f UniqueConstraintAction) Valid() bool {
|
||||
return f >= 0 && f < uniqueConstraintActionCount
|
||||
}
|
||||
|
||||
func NewAddEventUniqueConstraint(
|
||||
uniqueType,
|
||||
uniqueField,
|
||||
errMessage string) *EventUniqueConstraint {
|
||||
return &EventUniqueConstraint{
|
||||
errMessage string) *UniqueConstraint {
|
||||
return &UniqueConstraint{
|
||||
UniqueType: uniqueType,
|
||||
UniqueField: uniqueField,
|
||||
ErrorMessage: errMessage,
|
||||
@@ -33,27 +39,27 @@ func NewAddEventUniqueConstraint(
|
||||
}
|
||||
}
|
||||
|
||||
func NewRemoveEventUniqueConstraint(
|
||||
func NewRemoveUniqueConstraint(
|
||||
uniqueType,
|
||||
uniqueField string) *EventUniqueConstraint {
|
||||
return &EventUniqueConstraint{
|
||||
uniqueField string) *UniqueConstraint {
|
||||
return &UniqueConstraint{
|
||||
UniqueType: uniqueType,
|
||||
UniqueField: uniqueField,
|
||||
Action: UniqueConstraintRemove,
|
||||
}
|
||||
}
|
||||
|
||||
func NewRemoveInstanceUniqueConstraints() *EventUniqueConstraint {
|
||||
return &EventUniqueConstraint{
|
||||
func NewRemoveInstanceUniqueConstraints() *UniqueConstraint {
|
||||
return &UniqueConstraint{
|
||||
Action: UniqueConstraintInstanceRemove,
|
||||
}
|
||||
}
|
||||
|
||||
func NewAddGlobalEventUniqueConstraint(
|
||||
func NewAddGlobalUniqueConstraint(
|
||||
uniqueType,
|
||||
uniqueField,
|
||||
errMessage string) *EventUniqueConstraint {
|
||||
return &EventUniqueConstraint{
|
||||
errMessage string) *UniqueConstraint {
|
||||
return &UniqueConstraint{
|
||||
UniqueType: uniqueType,
|
||||
UniqueField: uniqueField,
|
||||
ErrorMessage: errMessage,
|
||||
@@ -62,10 +68,10 @@ func NewAddGlobalEventUniqueConstraint(
|
||||
}
|
||||
}
|
||||
|
||||
func NewRemoveGlobalEventUniqueConstraint(
|
||||
func NewRemoveGlobalUniqueConstraint(
|
||||
uniqueType,
|
||||
uniqueField string) *EventUniqueConstraint {
|
||||
return &EventUniqueConstraint{
|
||||
uniqueField string) *UniqueConstraint {
|
||||
return &UniqueConstraint{
|
||||
UniqueType: uniqueType,
|
||||
UniqueField: uniqueField,
|
||||
IsGlobal: true,
|
||||
|
Reference in New Issue
Block a user