MCPcopy
hub / github.com/pingcap/tidb / MarshalLogRestoreTableIDsBlocklistFile

Function MarshalLogRestoreTableIDsBlocklistFile

br/pkg/restore/misc.go:131–146  ·  view source on GitHub ↗

MarshalLogRestoreTableIDsBlocklistFile generates an Blocklist file and marshals it. It returns its filename and the marshaled data.

(restoreCommitTs, restoreStartTs, rewriteTs uint64, tableIds, dbIds []int64)

Source from the content-addressed store, hash-verified

129
130// MarshalLogRestoreTableIDsBlocklistFile generates an Blocklist file and marshals it. It returns its filename and the marshaled data.
131func MarshalLogRestoreTableIDsBlocklistFile(restoreCommitTs, restoreStartTs, rewriteTs uint64, tableIds, dbIds []int64) (string, []byte, error) {
132 blocklistFile := &LogRestoreTableIDsBlocklistFile{
133 RestoreCommitTs: restoreCommitTs,
134 RestoreStartTs: restoreStartTs,
135 RewriteTs: rewriteTs,
136 TableIds: tableIds,
137 DbIds: dbIds,
138 }
139 blocklistFile.setChecksumLogRestoreTableIDsBlocklistFile()
140 filename := blocklistFile.filename()
141 data, err := proto.Marshal(blocklistFile)
142 if err != nil {
143 return "", nil, errors.Trace(err)
144 }
145 return filename, data, nil
146}
147
148// unmarshalLogRestoreTableIDsBlocklistFile unmarshals the given blocklist file.
149func unmarshalLogRestoreTableIDsBlocklistFile(data []byte) (*LogRestoreTableIDsBlocklistFile, error) {

Callers 4

writeBlocklistFileFunction · 0.92
RunRestoreFunction · 0.92

Calls 3

filenameMethod · 0.95
MarshalMethod · 0.65

Tested by 3

writeBlocklistFileFunction · 0.74