Skip to content

Commit

Permalink
Merge pull request pingcap#7 from knull-cn/hack5.3
Browse files Browse the repository at this point in the history
Hack5.3: bug fix
  • Loading branch information
lichunzhu committed Jan 5, 2022
2 parents f79ac8b + a8e9967 commit d61c7c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ddl/sst/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ func (ec *engineCache) releaseRef(startTs uint64) {
ec.mtx.RLock()
ei := ec.cache[startTs]
ec.mtx.RUnlock()
if ei == nil {
return
}
atomic.CompareAndSwapInt32(&ei.ref, 1, 0)
}

Expand Down
4 changes: 3 additions & 1 deletion ddl/sst/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ func FinishIndexOp(ctx context.Context, startTs uint64, exec sqlexec.RestrictedS
if err != nil {
return err
}
defer ec.releaseRef(startTs)
flushKvs(ctx, ei)
defer ec.releaseRef(startTs)
//
LogInfo("FinishIndexOp %d;kvs=%d.", startTs, ei.size)
//
Expand Down Expand Up @@ -196,6 +196,8 @@ func FinishIndexOp(ctx context.Context, startTs uint64, exec sqlexec.RestrictedS
if err != nil {
return fmt.Errorf("engine.Cleanup err:%w", err)
}
// should release before ReleaseEngine
ec.releaseRef(startTs)
ec.ReleaseEngine(startTs)
return nil
}

0 comments on commit d61c7c2

Please sign in to comment.