-
Notifications
You must be signed in to change notification settings - Fork 320
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
feat: fetch remote schema async #5347
base: master
Are you sure you want to change the base?
Conversation
05f985f
to
59ae13c
Compare
59ae13c
to
842a746
Compare
7883385
to
9415887
Compare
9415887
to
229b4c8
Compare
1c7ebd9
to
29e1254
Compare
29e1254
to
649b4a7
Compare
57579b5
to
1161fbb
Compare
420a53e
to
5702ec8
Compare
63cb186
to
bfc0ab2
Compare
24afc54
to
cd29d05
Compare
4ad3f26
to
6ac93e5
Compare
6ac93e5
to
b013c87
Compare
7e43ff9
to
4117ad2
Compare
392f793
to
30d0f23
Compare
4db5814
to
f27fb84
Compare
if rs.DB == nil { | ||
return | ||
} |
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.
minor:
if rs.DB != nil {
_ = rs.DB.Close()
}
CC: @achettyiitr common interface might help reduce some duplicate code per warehouse. Just keeping a note of it.
FetchSchemaFromWarehouse(ctx context.Context, m schema.FetchSchemaRepo) (model.Schema, error) | ||
} | ||
|
||
func (r *Router) sync(ctx context.Context) error { |
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.
@cisse21 Thinking of tracking below list as a backlog task:
- Metric for failures
- How long it takes for a schema sync job to run for all warehouse models
- Consider if we would want any parallelism more so for MT or even hosted.
CC: @achettyiitr
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.
Will add metrics... didn't add parallelism in the first iteration as we plan to sync for every 12hrs or more
// HasSchemaChanged compares the localSchema with the schemaInWarehouse | ||
func (sh *Schema) HasSchemaChanged(schema model.Schema) bool { | ||
return !reflect.DeepEqual(schema, sh.localSchema) |
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.
@cisse21 Is the comment correct now? It will compare the schema with localSchema now?
func (sh *Schema) UpdateLocalSchemaWithWarehouse(ctx context.Context, warehouseSchema model.Schema) error { | ||
return sh.updateSchema(ctx, warehouseSchema) | ||
} | ||
|
||
func (sh *Schema) UpdateLocalSchema(ctx context.Context) error { | ||
return sh.updateSchema(ctx, sh.localSchema) | ||
} | ||
|
||
func (sh *Schema) UpdateLocalSchema(ctx context.Context, updatedSchema model.Schema) error { | ||
return sh.updateLocalSchema(ctx, updatedSchema) | ||
func (sh *Schema) UpdateSchema(ctx context.Context, updatedSchema model.Schema) error { |
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.
@cisse21
Too many functions with same name 😅
UpdateLocalSchemaWithWarehouse - Seems clear with func name.
UpdateLocalSchema - Seems to update in DB whatever is in memory?
UpdateSchema - ? Update in local and DB with whatever is passed?
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 already had many functions with similar names :/ didn't want to get into much more refactoring in this PR
f072690
to
195f9b2
Compare
195f9b2
to
86fab9b
Compare
6725913
to
6521210
Compare
Description
Linear Ticket
Fixes WAR-151
Security