-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
purge status events #232
purge status events #232
Conversation
@@ -22,7 +22,7 @@ func addConsumers() *gormigrate.Migration { | |||
} | |||
|
|||
if err := CreateFK(tx, fkMigration{ | |||
"resources", "consumers", "consumer_name", "consumers(name)", | |||
"resources", "consumers", "consumer_name", "consumers(name)", "ON DELETE RESTRICT ON UPDATE RESTRICT", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from SRE comments, we can't modify existing migrations, we need to create new migration to ensure their data can migrated to new schema.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change will not effect the db, the change due to refact the CreateFK
(make it can support configing constrains )
For the event-instances part, I create a new migration to ensure the db update
99fe3fe
to
da93fe9
Compare
/ok-to-test |
pkg/dao/mocks/instance.go
Outdated
@@ -136,6 +136,10 @@ func (d *instanceDaoMock) FindByUpdatedTime(ctx context.Context, updatedTime tim | |||
return instances, nil | |||
} | |||
|
|||
func (d *instanceDaoMock) FindReadyIDs(ctx context.Context) ([]string, error) { | |||
return []string{}, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can check if instance Ready == true from instances list, instead of return empty slice. this is useful for testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
"event_instances", "server_instances", "instance_id", "server_instances(id)", "ON DELETE CASCADE", | ||
}, fkMigration{ | ||
"event_instances", "status_events", "event_id", "status_events(id)", "ON DELETE CASCADE", | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would you alse add foreign key for spec_event_id
on events
table?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
5996bb1
to
645bb12
Compare
/ok-to-test |
/retest |
/ok-to-test |
/retest |
|
||
// batch delete the handled status events | ||
batchSize := 500 | ||
for i := 0; i < len(statusEventIDs); i += batchSize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may need to add UT to test this method. It may have problem if the length of statusEventIDs is 800.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
Signed-off-by: Wei Liu <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/ok-to-test |
No description provided.