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

@@ -4,41 +4,22 @@ import (
"google.golang.org/protobuf/types/known/timestamppb"
"github.com/zitadel/zitadel/internal/query"
"github.com/zitadel/zitadel/internal/view/model"
system_pb "github.com/zitadel/zitadel/pkg/grpc/system"
)
func ViewsToPb(views []*model.View) []*system_pb.View {
v := make([]*system_pb.View, len(views))
for i, view := range views {
v[i] = ViewToPb(view)
}
return v
}
func ViewToPb(view *model.View) *system_pb.View {
return &system_pb.View{
Database: view.Database,
ViewName: view.ViewName,
LastSuccessfulSpoolerRun: timestamppb.New(view.LastSuccessfulSpoolerRun),
ProcessedSequence: view.CurrentSequence,
EventTimestamp: timestamppb.New(view.EventTimestamp),
}
}
func CurrentSequencesToPb(database string, currentSequences *query.CurrentSequences) []*system_pb.View {
v := make([]*system_pb.View, len(currentSequences.CurrentSequences))
for i, currentSequence := range currentSequences.CurrentSequences {
func CurrentSequencesToPb(database string, currentSequences *query.CurrentStates) []*system_pb.View {
v := make([]*system_pb.View, len(currentSequences.CurrentStates))
for i, currentSequence := range currentSequences.CurrentStates {
v[i] = CurrentSequenceToPb(database, currentSequence)
}
return v
}
func CurrentSequenceToPb(database string, currentSequence *query.CurrentSequence) *system_pb.View {
func CurrentSequenceToPb(database string, currentSequence *query.CurrentState) *system_pb.View {
return &system_pb.View{
Database: database,
ViewName: currentSequence.ProjectionName,
ProcessedSequence: currentSequence.CurrentSequence,
LastSuccessfulSpoolerRun: timestamppb.New(currentSequence.Timestamp),
ProcessedSequence: currentSequence.Sequence,
LastSuccessfulSpoolerRun: timestamppb.New(currentSequence.LastRun),
}
}