Skip to content
Snippets Groups Projects
Commit c9491645 authored by jiangxinmeng1's avatar jiangxinmeng1 Committed by Yingfeng
Browse files

fix onReplayAppendCmd (#4431)

Fix onReplayAppendCmd. Check whether there exists active block before load data.

Approved by: @XuPeng-SH
parent 3e7249f7
No related branches found
No related tags found
No related merge requests found
......@@ -243,7 +243,35 @@ func (replayer *Replayer) OnReplayCmd(txncmd txnif.TxnCmd, idxCtx *wal.Index) {
}
func (db *DB) onReplayAppendCmd(cmd *txnimpl.AppendCmd, observer wal.ReplayObserver) {
hasActive := false
for _, info := range cmd.Infos {
database, err := db.Catalog.GetDatabaseByID(info.GetDBID())
if err != nil {
panic(err)
}
id := info.GetDest()
blk, err := database.GetBlockEntryByID(id)
if err != nil {
panic(err)
}
if !blk.IsActive() {
continue
}
if observer != nil {
observer.OnTimeStamp(blk.GetBlockData().GetMaxCheckpointTS())
}
if cmd.Ts <= blk.GetBlockData().GetMaxCheckpointTS() {
continue
}
hasActive = true
}
if !hasActive {
return
}
var data *containers.Batch
for _, subTxnCmd := range cmd.Cmds {
switch subCmd := subTxnCmd.(type) {
case *txnbase.BatchCmd:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment