Skip to content
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

[server][file-data] Fix query to mark replication as done #2679

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions server/pkg/repo/filedata/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,10 @@ func (r *Repository) GetPendingSyncDataAndExtendLock(ctx context.Context, newSyn
return &fileData, nil
}

// MarkReplicationAsDone marks the pending_sync as false for the file data row
// MarkReplicationAsDone marks the pending_sync as false for the file data row, while
// ensuring that the row is not deleted
func (r *Repository) MarkReplicationAsDone(ctx context.Context, row filedata.Row) error {
query := `UPDATE file_data SET pending_sync = false WHERE is_deleted=true and file_id = $1 AND data_type = $2 AND user_id = $3`
query := `UPDATE file_data SET pending_sync = false WHERE is_deleted=false and file_id = $1 AND data_type = $2 AND user_id = $3`
_, err := r.DB.ExecContext(ctx, query, row.FileID, string(row.Type), row.UserID)
if err != nil {
return stacktrace.Propagate(err, "")
Expand Down
Loading