Skip to content

Commit

Permalink
close file and refactor function (talent-plan#185)
Browse files Browse the repository at this point in the history
* close file
  • Loading branch information
xiongjiwei authored May 28, 2020
1 parent bc06cdf commit 16b8058
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kv/raftstore/cmd_resp.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func ErrRespRegionNotFound(regionID uint64) *raft_cmdpb.RaftCmdResponse {
}
}

func newCmdRespForReq(req *raft_cmdpb.RaftCmdRequest) *raft_cmdpb.RaftCmdResponse {
func newCmdResp() *raft_cmdpb.RaftCmdResponse {
return &raft_cmdpb.RaftCmdResponse{
Header: &raft_cmdpb.RaftResponseHeader{},
}
Expand Down
3 changes: 3 additions & 0 deletions kv/raftstore/snap/snap.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,9 @@ func (s *Snap) Apply(opts ApplyOptions) error {
externalFiles = append(externalFiles, file)
}
n, err := opts.DB.IngestExternalFiles(externalFiles)
for _, file := range externalFiles {
file.Close()
}
if err != nil {
log.Errorf("ingest sst failed (first %d files succeeded): %s", n, err)
return err
Expand Down

0 comments on commit 16b8058

Please sign in to comment.