MCPcopy
hub / github.com/uber/aresdb / cleanOldSnapshotAndLogs

Method cleanOldSnapshotAndLogs

memstore/recovery.go:90–111  ·  view source on GitHub ↗
(redoLogFile int64, offset uint32)

Source from the content-addressed store, hash-verified

88}
89
90func (shard *TableShard) cleanOldSnapshotAndLogs(redoLogFile int64, offset uint32) {
91 tableName := shard.Schema.Schema.Name
92 // snapshot won't care about the cutoff.
93 if err := shard.LiveStore.RedoLogManager.CheckpointRedolog(math.MaxUint32, redoLogFile, offset); err != nil {
94 utils.GetLogger().With(
95 "job", "snapshot_cleanup",
96 "table", tableName).Errorf(
97 "Purge redologs failed, shard: %d, error: %v", shard.ShardID, err)
98 }
99
100 if shard.options.bootstrapToken.AcquireToken(tableName, uint32(shard.ShardID)) {
101 defer shard.options.bootstrapToken.ReleaseToken(tableName, uint32(shard.ShardID))
102
103 // delete old snapshots
104 if err := shard.diskStore.DeleteSnapshot(shard.Schema.Schema.Name, shard.ShardID, redoLogFile, offset); err != nil {
105 utils.GetLogger().With(
106 "job", "snapshot_cleanup",
107 "table", tableName).Errorf(
108 "Delete snapshots failed, shard: %d, error: %v", shard.ShardID, err)
109 }
110 }
111}
112
113// LoadMetaData loads metadata for the table Shard from metastore.
114func (shard *TableShard) LoadMetaData() error {

Callers 2

recovery_test.goFile · 0.80
SnapshotMethod · 0.80

Calls 7

GetLoggerFunction · 0.92
CheckpointRedologMethod · 0.65
ErrorfMethod · 0.65
WithMethod · 0.65
AcquireTokenMethod · 0.65
ReleaseTokenMethod · 0.65
DeleteSnapshotMethod · 0.65

Tested by

no test coverage detected