mirror of
https://github.com/dolthub/dolt.git
synced 2026-03-11 01:55:08 -05:00
Caching bug fix
This commit is contained in:
@@ -726,7 +726,9 @@ func (p DoltDatabaseProvider) databaseForRevision(ctx *sql.Context, revisionQual
|
||||
dbCache, ok := sess.DatabaseCache(ctx, baseName)
|
||||
if ok {
|
||||
db, ok := dbCache.GetCachedRevisionDb(revisionQualifiedName)
|
||||
if ok {
|
||||
// The db cache is keyed by the revision qualified name, but the request name must also match for it to be a
|
||||
// cache hit
|
||||
if ok && db.RequestedName() == requestedName {
|
||||
return db, true, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,24 +174,14 @@ func (d *DoltSession) lookupDbState(ctx *sql.Context, dbName string) (*branchSta
|
||||
revisionQualifiedName = revisionDbName(baseName, rev)
|
||||
}
|
||||
|
||||
// Try to get the session from the cache before going to the provider
|
||||
var database SqlDatabase
|
||||
if dbStateFound {
|
||||
database, _ = dbState.databaseCache.GetCachedRevisionDb(revisionQualifiedName)
|
||||
database, ok, err := d.provider.SessionDatabase(ctx, revisionQualifiedName)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
if !ok {
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
if database == nil {
|
||||
var err error
|
||||
var ok bool
|
||||
database, ok, err = d.provider.SessionDatabase(ctx, revisionQualifiedName)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
if !ok {
|
||||
return nil, false, nil
|
||||
}
|
||||
}
|
||||
|
||||
// Add the initial state to the session for future reuse
|
||||
if err := d.addDB(ctx, database); err != nil {
|
||||
return nil, false, err
|
||||
|
||||
Reference in New Issue
Block a user