fix: improve performance by reducing full table scans (#4684)

* use instance id on update in projections

* create index on domain in instance_domain projection

* add missing instanceID filter to app queries
This commit is contained in:
Livio Spring
2022-11-10 11:59:33 +01:00
committed by GitHub
parent ac66a54df9
commit 78ae64471a
71 changed files with 683 additions and 399 deletions

View File

@@ -24,7 +24,7 @@ func TestIDPProjection_reduces(t *testing.T) {
want wantReduce
}{
{
name: "instance.reduceIDPAdded",
name: "instance reduceIDPAdded",
args: args{
event: getEvent(testEvent(
repository.EventType(instance.IDPConfigAddedEventType),
@@ -66,7 +66,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "instance.reduceIDPChanged",
name: "instance reduceIDPChanged",
args: args{
event: getEvent(testEvent(
repository.EventType(instance.IDPConfigChangedEventType),
@@ -103,7 +103,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "instance.reduceIDPDeactivated",
name: "instance reduceIDPDeactivated",
args: args{
event: getEvent(testEvent(
repository.EventType(instance.IDPConfigDeactivatedEventType),
@@ -135,7 +135,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "instance.reduceIDPReactivated",
name: "instance reduceIDPReactivated",
args: args{
event: getEvent(testEvent(
repository.EventType(instance.IDPConfigReactivatedEventType),
@@ -167,7 +167,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "instance.reduceIDPRemoved",
name: "instance reduceIDPRemoved",
args: args{
event: getEvent(testEvent(
repository.EventType(instance.IDPConfigRemovedEventType),
@@ -196,7 +196,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "instance.reduceInstanceRemoved",
name: "instance reduceInstanceRemoved",
args: args{
event: getEvent(testEvent(
repository.EventType(instance.InstanceRemovedEventType),
@@ -222,7 +222,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "instance.reduceOIDCConfigAdded",
name: "instance reduceOIDCConfigAdded",
args: args{
event: getEvent(testEvent(
repository.EventType(instance.IDPOIDCConfigAddedEventType),
@@ -281,7 +281,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "instance.reduceOIDCConfigChanged",
name: "instance reduceOIDCConfigChanged",
args: args{
event: getEvent(testEvent(
repository.EventType(instance.IDPOIDCConfigChangedEventType),
@@ -339,7 +339,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "instance.reduceOIDCConfigChanged: no op",
name: "instance reduceOIDCConfigChanged: no op",
args: args{
event: getEvent(testEvent(
repository.EventType(instance.IDPOIDCConfigChangedEventType),
@@ -358,7 +358,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "instance.reduceJWTConfigAdded",
name: "instance reduceJWTConfigAdded",
args: args{
event: getEvent(testEvent(
repository.EventType(instance.IDPJWTConfigAddedEventType),
@@ -405,7 +405,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "instance.reduceJWTConfigChanged",
name: "instance reduceJWTConfigChanged",
args: args{
event: getEvent(testEvent(
repository.EventType(instance.IDPJWTConfigChangedEventType),
@@ -451,7 +451,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "instance.reduceJWTConfigChanged: no op",
name: "instance reduceJWTConfigChanged: no op",
args: args{
event: getEvent(testEvent(
repository.EventType(instance.IDPJWTConfigChangedEventType),
@@ -470,7 +470,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "org.reduceIDPAdded",
name: "org reduceIDPAdded",
args: args{
event: getEvent(testEvent(
repository.EventType(org.IDPConfigAddedEventType),
@@ -512,7 +512,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "org.reduceIDPChanged",
name: "org reduceIDPChanged",
args: args{
event: getEvent(testEvent(
repository.EventType(org.IDPConfigChangedEventType),
@@ -549,7 +549,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "org.reduceIDPDeactivated",
name: "org reduceIDPDeactivated",
args: args{
event: getEvent(testEvent(
repository.EventType(org.IDPConfigDeactivatedEventType),
@@ -581,7 +581,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "org.reduceIDPReactivated",
name: "org reduceIDPReactivated",
args: args{
event: getEvent(testEvent(
repository.EventType(org.IDPConfigReactivatedEventType),
@@ -613,7 +613,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "org.reduceIDPRemoved",
name: "org reduceIDPRemoved",
args: args{
event: getEvent(testEvent(
repository.EventType(org.IDPConfigRemovedEventType),
@@ -642,7 +642,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "org.reduceOIDCConfigAdded",
name: "org reduceOIDCConfigAdded",
args: args{
event: getEvent(testEvent(
repository.EventType(org.IDPOIDCConfigAddedEventType),
@@ -701,7 +701,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "org.reduceOIDCConfigChanged",
name: "org reduceOIDCConfigChanged",
args: args{
event: getEvent(testEvent(
repository.EventType(org.IDPOIDCConfigChangedEventType),
@@ -759,7 +759,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "org.reduceOIDCConfigChanged: no op",
name: "org reduceOIDCConfigChanged: no op",
args: args{
event: getEvent(testEvent(
repository.EventType(org.IDPOIDCConfigChangedEventType),
@@ -778,7 +778,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "org.reduceJWTConfigAdded",
name: "org reduceJWTConfigAdded",
args: args{
event: getEvent(testEvent(
repository.EventType(org.IDPJWTConfigAddedEventType),
@@ -825,7 +825,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "org.reduceJWTConfigChanged",
name: "org reduceJWTConfigChanged",
args: args{
event: getEvent(testEvent(
repository.EventType(org.IDPJWTConfigChangedEventType),
@@ -871,7 +871,7 @@ func TestIDPProjection_reduces(t *testing.T) {
},
},
{
name: "org.reduceJWTConfigChanged: no op",
name: "org reduceJWTConfigChanged: no op",
args: args{
event: getEvent(testEvent(
repository.EventType(org.IDPJWTConfigChangedEventType),