mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-04 10:25:17 -06:00
go/libraries/doltcore/sqle/dsess: transactions.go: When merging working sets on call dolt_commit, ensure new commit also gets the merged commit root value.
This commit is contained in:
@@ -232,6 +232,9 @@ func (tx *DoltTransaction) doCommit(
|
||||
}
|
||||
|
||||
var newCommit *doltdb.Commit
|
||||
if commit != nil {
|
||||
commit.Roots.Staged = mergedWorkingSet.WorkingRoot()
|
||||
}
|
||||
mergedWorkingSet, newCommit, err = writeFn(ctx, tx, commit, mergedWorkingSet, existingWSHash)
|
||||
if err == datas.ErrOptimisticLockFailed {
|
||||
// this is effectively a `continue` in the loop
|
||||
|
||||
@@ -272,6 +272,13 @@ func TestDoltTransactionCommitTwoClients(t *testing.T) {
|
||||
Query: "/* client c */ SELECT * FROM x ORDER BY y;",
|
||||
Expected: []sql.Row{{1, 1}, {2, 2}, {3, 3}},
|
||||
},
|
||||
// After we commit both of these transactions, our working set should not have any pending changes.
|
||||
// In the past, we have merged the working set but failed to land the merged root value in the
|
||||
// commit itself.
|
||||
{
|
||||
Query: "/* client c */ SELECT COUNT(*) FROM DOLT_DIFF('HEAD', 'WORKING', 'x');",
|
||||
Expected: []sql.Row{{0}},
|
||||
},
|
||||
},
|
||||
})
|
||||
_, err := harness.NewEngine(t)
|
||||
|
||||
Reference in New Issue
Block a user