mirror of
https://github.com/dolthub/dolt.git
synced 2026-03-21 00:42:25 -05:00
Rebase on transaction start
This commit is contained in:
@@ -1129,6 +1129,12 @@ func (ddb *DoltDB) DeleteWorkspace(ctx context.Context, workRef ref.DoltRef) err
|
||||
return err
|
||||
}
|
||||
|
||||
// Rebase rebases the underlying db from disk, re-loading the manifest. Useful when another process might have made
|
||||
// changes to the database we need to read.
|
||||
func (ddb *DoltDB) Rebase(ctx context.Context) error {
|
||||
return ddb.db.Rebase(ctx)
|
||||
}
|
||||
|
||||
// GC performs garbage collection on this ddb. Values passed in |uncommitedVals| will be temporarily saved during gc.
|
||||
func (ddb *DoltDB) GC(ctx context.Context, uncommitedVals ...hash.Hash) error {
|
||||
collector, ok := ddb.db.(datas.GarbageCollector)
|
||||
|
||||
@@ -281,8 +281,14 @@ func (sess *Session) StartTransaction(ctx *sql.Context, dbName string) (sql.Tran
|
||||
return DisabledTransaction{}, nil
|
||||
}
|
||||
|
||||
err = sessionState.dbData.Ddb.Rebase(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
wsRef := sessionState.WorkingSet.Ref()
|
||||
ws, err := sessionState.dbData.Ddb.ResolveWorkingSet(ctx, wsRef)
|
||||
// TODO: every HEAD needs a working set created when it is. We can get rid of this in a 1.0 release when this is fixed
|
||||
if err == doltdb.ErrWorkingSetNotFound {
|
||||
ws, err = sess.newWorkingSetForHead(ctx, wsRef, dbName)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user