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

@@ -10,18 +10,23 @@ import (
)
var (
prepareFailedEventsStmt = `SELECT projections.failed_events.projection_name,` +
` projections.failed_events.failed_sequence,` +
` projections.failed_events.failure_count,` +
` projections.failed_events.last_failed,` +
` projections.failed_events.error,` +
prepareFailedEventsStmt = `SELECT` +
` projections.failed_events2.projection_name,` +
` projections.failed_events2.failed_sequence,` +
` projections.failed_events2.aggregate_type,` +
` projections.failed_events2.aggregate_id,` +
` projections.failed_events2.failure_count,` +
` projections.failed_events2.last_failed,` +
` projections.failed_events2.error,` +
` COUNT(*) OVER ()` +
` FROM projections.failed_events` +
` FROM projections.failed_events2` +
` AS OF SYSTEM TIME '-1 ms'`
prepareFailedEventsCols = []string{
"projection_name",
"failed_sequence",
"aggregate_type",
"aggregate_id",
"failure_count",
"last_failed",
"error",
@@ -63,6 +68,8 @@ func Test_FailedEventsPrepares(t *testing.T) {
{
"projection-name",
uint64(20211108),
"agg-type",
"agg-id",
uint64(2),
testNow,
"error",
@@ -81,6 +88,8 @@ func Test_FailedEventsPrepares(t *testing.T) {
FailureCount: 2,
LastFailed: testNow,
Error: "error",
AggregateType: "agg-type",
AggregateID: "agg-id",
},
},
},
@@ -96,6 +105,8 @@ func Test_FailedEventsPrepares(t *testing.T) {
{
"projection-name",
uint64(20211108),
"agg-type",
"agg-id",
2,
testNow,
"error",
@@ -103,6 +114,8 @@ func Test_FailedEventsPrepares(t *testing.T) {
{
"projection-name-2",
uint64(20211108),
"agg-type",
"agg-id",
2,
nil,
"error",
@@ -121,12 +134,16 @@ func Test_FailedEventsPrepares(t *testing.T) {
FailureCount: 2,
LastFailed: testNow,
Error: "error",
AggregateType: "agg-type",
AggregateID: "agg-id",
},
{
ProjectionName: "projection-name-2",
FailedSequence: 20211108,
FailureCount: 2,
Error: "error",
AggregateType: "agg-type",
AggregateID: "agg-id",
},
},
},