-
Notifications
You must be signed in to change notification settings - Fork 125
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
Fix multiple data sources for a single conversation #11509
Fix multiple data sources for a single conversation #11509
Conversation
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
@@ -1,45 +1,37 @@ | |||
export class Lock { | |||
private static locks = new Map<string, Promise<void>>(); |
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.
So wait the issue stems from the fact that the lock was in memory rather than on Redis?
@@ -0,0 +1,6 @@ | |||
DROP INDEX CONCURRENTLY "data_sources_workspace_id_conversation_id"; |
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.
So we drop the index before creating the new one?
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.
Yep, seems that we can't update.
"Successfully processed file" | ||
); | ||
} catch (error) { | ||
logger.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.
Don't want to throw/exit if we hit those errors? I guess if we have a lot of volume, those errors might end up being "unnoticed".
continue; | ||
} | ||
|
||
await hardDeleteDataSource(tempAuth, ds); |
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.
You need to soft delete them first!
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.
Really ? Why ? (it was working just fine in my test)
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.
IIRC, we had a check to ensure data sources were soft deleted first.
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.
If you look at the soft delete, it does delete directly the data source view, to ensure it's not visible anymore in the product:
protected async softDelete( |
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.
Also it's probably best, to simply use the softDeleteDataSourceAndLaunchScrubWorkflow
.
Description
Enforce unique index, add distributed lock, create backfill script.
Tests
Run locally (i had duplicates)
Risk
Low
Deploy Plan
Run backfill, apply migration, deploy
front