mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 17: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:
@@ -30,7 +30,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
{
|
||||
name: "append user password check succeeded event",
|
||||
args: args{
|
||||
event: &es_models.Event{CreationDate: now(), Type: es_models.EventType(user.UserV1PasswordCheckSucceededType)},
|
||||
event: &es_models.Event{CreationDate: now(), Typ: user.UserV1PasswordCheckSucceededType},
|
||||
userView: &UserSessionView{},
|
||||
},
|
||||
result: &UserSessionView{ChangeDate: now(), PasswordVerification: now()},
|
||||
@@ -38,7 +38,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
{
|
||||
name: "append human password check succeeded event",
|
||||
args: args{
|
||||
event: &es_models.Event{CreationDate: now(), Type: es_models.EventType(user.HumanPasswordCheckSucceededType)},
|
||||
event: &es_models.Event{CreationDate: now(), Typ: user.HumanPasswordCheckSucceededType},
|
||||
userView: &UserSessionView{},
|
||||
},
|
||||
result: &UserSessionView{ChangeDate: now(), PasswordVerification: now()},
|
||||
@@ -46,7 +46,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
{
|
||||
name: "append user password check failed event",
|
||||
args: args{
|
||||
event: &es_models.Event{CreationDate: now(), Type: es_models.EventType(user.UserV1PasswordCheckFailedType)},
|
||||
event: &es_models.Event{CreationDate: now(), Typ: user.UserV1PasswordCheckFailedType},
|
||||
userView: &UserSessionView{PasswordVerification: now()},
|
||||
},
|
||||
result: &UserSessionView{ChangeDate: now(), PasswordVerification: time.Time{}},
|
||||
@@ -54,7 +54,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
{
|
||||
name: "append human password check failed event",
|
||||
args: args{
|
||||
event: &es_models.Event{CreationDate: now(), Type: es_models.EventType(user.HumanPasswordCheckFailedType)},
|
||||
event: &es_models.Event{CreationDate: now(), Typ: user.HumanPasswordCheckFailedType},
|
||||
userView: &UserSessionView{PasswordVerification: now()},
|
||||
},
|
||||
result: &UserSessionView{ChangeDate: now(), PasswordVerification: time.Time{}},
|
||||
@@ -64,7 +64,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
args: args{
|
||||
event: &es_models.Event{
|
||||
CreationDate: now(),
|
||||
Type: es_models.EventType(user.UserV1PasswordChangedType),
|
||||
Typ: user.UserV1PasswordChangedType,
|
||||
Data: func() []byte {
|
||||
d, _ := json.Marshal(&es_model.Password{
|
||||
Secret: &crypto.CryptoValue{Crypted: []byte("test")},
|
||||
@@ -81,7 +81,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
args: args{
|
||||
event: &es_models.Event{
|
||||
CreationDate: now(),
|
||||
Type: es_models.EventType(user.HumanPasswordChangedType),
|
||||
Typ: user.HumanPasswordChangedType,
|
||||
Data: func() []byte {
|
||||
d, _ := json.Marshal(&es_model.PasswordChange{
|
||||
Password: es_model.Password{
|
||||
@@ -100,7 +100,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
args: args{
|
||||
event: &es_models.Event{
|
||||
CreationDate: now(),
|
||||
Type: es_models.EventType(user.HumanPasswordChangedType),
|
||||
Typ: user.HumanPasswordChangedType,
|
||||
Data: func() []byte {
|
||||
d, _ := json.Marshal(&es_model.PasswordChange{
|
||||
Password: es_model.Password{
|
||||
@@ -120,7 +120,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
args: args{
|
||||
event: &es_models.Event{
|
||||
CreationDate: now(),
|
||||
Type: es_models.EventType(user.HumanMFAOTPVerifiedType),
|
||||
Typ: user.HumanMFAOTPVerifiedType,
|
||||
Data: nil,
|
||||
},
|
||||
userView: &UserSessionView{UserAgentID: "id"},
|
||||
@@ -132,7 +132,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
args: args{
|
||||
event: &es_models.Event{
|
||||
CreationDate: now(),
|
||||
Type: es_models.EventType(user.HumanMFAOTPVerifiedType),
|
||||
Typ: user.HumanMFAOTPVerifiedType,
|
||||
Data: func() []byte {
|
||||
d, _ := json.Marshal(&es_model.OTPVerified{
|
||||
UserAgentID: "id",
|
||||
@@ -147,7 +147,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
{
|
||||
name: "append user otp check succeeded event",
|
||||
args: args{
|
||||
event: &es_models.Event{CreationDate: now(), Type: es_models.EventType(user.UserV1MFAOTPCheckSucceededType)},
|
||||
event: &es_models.Event{CreationDate: now(), Typ: user.UserV1MFAOTPCheckSucceededType},
|
||||
userView: &UserSessionView{},
|
||||
},
|
||||
result: &UserSessionView{ChangeDate: now(), SecondFactorVerification: now()},
|
||||
@@ -155,7 +155,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
{
|
||||
name: "append human otp check succeeded event",
|
||||
args: args{
|
||||
event: &es_models.Event{CreationDate: now(), Type: es_models.EventType(user.HumanMFAOTPCheckSucceededType)},
|
||||
event: &es_models.Event{CreationDate: now(), Typ: user.HumanMFAOTPCheckSucceededType},
|
||||
userView: &UserSessionView{},
|
||||
},
|
||||
result: &UserSessionView{ChangeDate: now(), SecondFactorVerification: now()},
|
||||
@@ -163,7 +163,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
{
|
||||
name: "append user otp check failed event",
|
||||
args: args{
|
||||
event: &es_models.Event{CreationDate: now(), Type: es_models.EventType(user.UserV1MFAOTPCheckFailedType)},
|
||||
event: &es_models.Event{CreationDate: now(), Typ: user.UserV1MFAOTPCheckFailedType},
|
||||
userView: &UserSessionView{SecondFactorVerification: now()},
|
||||
},
|
||||
result: &UserSessionView{ChangeDate: now(), SecondFactorVerification: time.Time{}},
|
||||
@@ -171,7 +171,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
{
|
||||
name: "append human otp check failed event",
|
||||
args: args{
|
||||
event: &es_models.Event{CreationDate: now(), Type: es_models.EventType(user.HumanMFAOTPCheckFailedType)},
|
||||
event: &es_models.Event{CreationDate: now(), Typ: user.HumanMFAOTPCheckFailedType},
|
||||
userView: &UserSessionView{SecondFactorVerification: now()},
|
||||
},
|
||||
result: &UserSessionView{ChangeDate: now(), SecondFactorVerification: time.Time{}},
|
||||
@@ -179,7 +179,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
{
|
||||
name: "append user otp removed event",
|
||||
args: args{
|
||||
event: &es_models.Event{CreationDate: now(), Type: es_models.EventType(user.UserV1MFAOTPRemovedType)},
|
||||
event: &es_models.Event{CreationDate: now(), Typ: user.UserV1MFAOTPRemovedType},
|
||||
userView: &UserSessionView{SecondFactorVerification: now()},
|
||||
},
|
||||
result: &UserSessionView{ChangeDate: now(), SecondFactorVerification: time.Time{}},
|
||||
@@ -187,7 +187,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
{
|
||||
name: "append human otp removed event",
|
||||
args: args{
|
||||
event: &es_models.Event{CreationDate: now(), Type: es_models.EventType(user.HumanMFAOTPRemovedType)},
|
||||
event: &es_models.Event{CreationDate: now(), Typ: user.HumanMFAOTPRemovedType},
|
||||
userView: &UserSessionView{SecondFactorVerification: now()},
|
||||
},
|
||||
result: &UserSessionView{ChangeDate: now(), SecondFactorVerification: time.Time{}},
|
||||
@@ -195,7 +195,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
{
|
||||
name: "append user signed out event",
|
||||
args: args{
|
||||
event: &es_models.Event{CreationDate: now(), Type: es_models.EventType(user.UserV1SignedOutType)},
|
||||
event: &es_models.Event{CreationDate: now(), Typ: user.UserV1SignedOutType},
|
||||
userView: &UserSessionView{PasswordVerification: now(), SecondFactorVerification: now()},
|
||||
},
|
||||
result: &UserSessionView{ChangeDate: now(), PasswordVerification: time.Time{}, SecondFactorVerification: time.Time{}, State: 1},
|
||||
@@ -203,7 +203,7 @@ func TestAppendEvent(t *testing.T) {
|
||||
{
|
||||
name: "append human signed out event",
|
||||
args: args{
|
||||
event: &es_models.Event{CreationDate: now(), Type: es_models.EventType(user.HumanSignedOutType)},
|
||||
event: &es_models.Event{CreationDate: now(), Typ: user.HumanSignedOutType},
|
||||
userView: &UserSessionView{PasswordVerification: now(), SecondFactorVerification: now()},
|
||||
},
|
||||
result: &UserSessionView{ChangeDate: now(), PasswordVerification: time.Time{}, SecondFactorVerification: time.Time{}, State: 1},
|
||||
|
Reference in New Issue
Block a user