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

Fix transaction in UpdateAndFindMinSyncedVersionVector #1050

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions server/backend/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ type Database interface {
serverSeq int64,
) (*time.Ticket, error)

// UpdateAndFindMinSyncedVersionVectorAfterPushPull updates the given serverSeq of the given client
// UpdateAndFindMinSyncedVersionVector updates the given serverSeq of the given client
// and returns the SyncedVersionVector of the document.
UpdateAndFindMinSyncedVersionVectorAfterPushPull(
UpdateAndFindMinSyncedVersionVector(
ctx context.Context,
clientInfo *ClientInfo,
docRefKey types.DocRefKey,
Expand Down
6 changes: 3 additions & 3 deletions server/backend/database/memory/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -1312,9 +1312,9 @@ func (d *DB) UpdateVersionVector(
return nil
}

// UpdateAndFindMinSyncedVersionVectorAfterPushPull updates the given serverSeq of the given client
// UpdateAndFindMinSyncedVersionVector updates the given serverSeq of the given client
// and returns the SyncedVersionVector of the document.
func (d *DB) UpdateAndFindMinSyncedVersionVectorAfterPushPull(
func (d *DB) UpdateAndFindMinSyncedVersionVector(
ctx context.Context,
clientInfo *database.ClientInfo,
docRefKey types.DocRefKey,
Expand All @@ -1338,7 +1338,7 @@ func (d *DB) UpdateAndFindMinSyncedVersionVectorAfterPushPull(
}

// 02. Find all version vectors of the given document from DB.
txn := d.db.Txn(true)
txn := d.db.Txn(false)
defer txn.Abort()
iterator, err := txn.Get(tblVersionVectors, "doc_id", docRefKey.DocID.String())
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions server/backend/database/mongo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1197,8 +1197,8 @@ func (c *Client) UpdateAndFindMinSyncedTicket(
), nil
}

// UpdateAndFindMinSyncedVersionVectorAfterPushPull returns min synced version vector
func (c *Client) UpdateAndFindMinSyncedVersionVectorAfterPushPull(
// UpdateAndFindMinSyncedVersionVector returns min synced version vector
func (c *Client) UpdateAndFindMinSyncedVersionVector(
ctx context.Context,
clientInfo *database.ClientInfo,
docRefKey types.DocRefKey,
Expand Down
2 changes: 1 addition & 1 deletion server/packs/packs.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func PushPull(
// 05. update and find min synced version vector for garbage collection.
// NOTE(hackerwins): Since the client could not receive the response, the
// requested seq(reqPack) is stored instead of the response seq(resPack).
minSyncedVersionVector, err := be.DB.UpdateAndFindMinSyncedVersionVectorAfterPushPull(
minSyncedVersionVector, err := be.DB.UpdateAndFindMinSyncedVersionVector(
ctx,
clientInfo,
docRefKey,
Expand Down
Loading