@@ -416,7 +416,7 @@ func (c *checkpointCleaner) Replay(inputCtx context.Context) (err error) {
416416 )
417417 return
418418 }
419- var snapshots map [ uint32 ]containers. Vector
419+ var snapshots * logtail. SnapshotInfo
420420 var pitrs * logtail.PitrInfo
421421 pitrs , err = c .GetPITRsLocked (ctx )
422422 if err != nil {
@@ -440,8 +440,6 @@ func (c *checkpointCleaner) Replay(inputCtx context.Context) (err error) {
440440 )
441441 return
442442 }
443- accountSnapshots := TransformToTSList (snapshots )
444- logtail .CloseSnapshotList (snapshots )
445443 _ , sarg , _ := fault .TriggerFault ("replay error UT" )
446444 if sarg != "" {
447445 err = moerr .NewInternalErrorNoCtxf ("GC-REPLAY-GET-CHECKPOINT-DATA-ERROR %s" , sarg )
@@ -464,13 +462,12 @@ func (c *checkpointCleaner) Replay(inputCtx context.Context) (err error) {
464462 c .checkpointCli .GetCatalog ().GetUsageMemo ().(* logtail.TNUsageMemo ),
465463 ckpBatch ,
466464 c .mutation .snapshotMeta ,
467- accountSnapshots ,
465+ snapshots ,
468466 pitrs ,
469467 0 )
470468 logutil .Info (
471469 "GC-REPLAY-COLLECT-SNAPSHOT-SIZE" ,
472470 zap .String ("task" , c .TaskNameLocked ()),
473- zap .Int ("size" , len (accountSnapshots )),
474471 zap .Duration ("duration" , time .Since (start )),
475472 zap .String ("checkpoint" , compacted .String ()),
476473 zap .Int ("count" , ckpBatch .RowCount ()),
@@ -777,7 +774,7 @@ func (c *checkpointCleaner) mergeCheckpointFilesLocked(
777774 ctx context.Context ,
778775 checkpointLowWaterMark * types.TS ,
779776 memoryBuffer * containers.OneSchemaBatchBuffer ,
780- accountSnapshots map [ uint32 ][]types. TS ,
777+ snapshots * logtail. SnapshotInfo ,
781778 pitrs * logtail.PitrInfo ,
782779 gcFileCount int ,
783780) (err error ) {
@@ -888,7 +885,7 @@ func (c *checkpointCleaner) mergeCheckpointFilesLocked(
888885 c .checkpointCli .GetCatalog ().GetUsageMemo ().(* logtail.TNUsageMemo ),
889886 newCkpData ,
890887 c .mutation .snapshotMeta ,
891- accountSnapshots ,
888+ snapshots ,
892889 pitrs ,
893890 gcFileCount )
894891 if newCkp == nil {
@@ -1069,10 +1066,9 @@ func (c *checkpointCleaner) tryGCAgainstGCKPLocked(
10691066 memoryBuffer * containers.OneSchemaBatchBuffer ,
10701067) (err error ) {
10711068 now := time .Now ()
1072- var snapshots map [ uint32 ]containers. Vector
1069+ var snapshots * logtail. SnapshotInfo
10731070 var extraErrMsg string
10741071 defer func () {
1075- logtail .CloseSnapshotList (snapshots )
10761072 logutil .Info (
10771073 "GC-TRACE-TRY-GC-AGAINST-GCKP" ,
10781074 zap .String ("task" , c .TaskNameLocked ()),
@@ -1092,9 +1088,8 @@ func (c *checkpointCleaner) tryGCAgainstGCKPLocked(
10921088 extraErrMsg = "GetSnapshot failed"
10931089 return
10941090 }
1095- accountSnapshots := TransformToTSList (snapshots )
10961091 filesToGC , err := c .doGCAgainstGlobalCheckpointLocked (
1097- ctx , gckp , accountSnapshots , pitrs , memoryBuffer ,
1092+ ctx , gckp , snapshots , pitrs , memoryBuffer ,
10981093 )
10991094 if err != nil {
11001095 extraErrMsg = "doGCAgainstGlobalCheckpointLocked failed"
@@ -1132,7 +1127,7 @@ func (c *checkpointCleaner) tryGCAgainstGCKPLocked(
11321127 waterMark = scanMark
11331128 }
11341129 err = c .mergeCheckpointFilesLocked (
1135- ctx , & waterMark , memoryBuffer , accountSnapshots , pitrs , len (filesToGC ),
1130+ ctx , & waterMark , memoryBuffer , snapshots , pitrs , len (filesToGC ),
11361131 )
11371132 if err != nil {
11381133 extraErrMsg = fmt .Sprintf ("mergeCheckpointFilesLocked %v failed" , waterMark .ToString ())
@@ -1145,7 +1140,7 @@ func (c *checkpointCleaner) tryGCAgainstGCKPLocked(
11451140func (c * checkpointCleaner ) doGCAgainstGlobalCheckpointLocked (
11461141 ctx context.Context ,
11471142 gckp * checkpoint.CheckpointEntry ,
1148- accountSnapshots map [ uint32 ][]types. TS ,
1143+ snapshots * logtail. SnapshotInfo ,
11491144 pitrs * logtail.PitrInfo ,
11501145 memoryBuffer * containers.OneSchemaBatchBuffer ,
11511146) ([]string , error ) {
@@ -1189,7 +1184,7 @@ func (c *checkpointCleaner) doGCAgainstGlobalCheckpointLocked(
11891184 if filesToGC , metafile , err = scannedWindow .ExecuteGlobalCheckpointBasedGC (
11901185 ctx ,
11911186 gckp ,
1192- accountSnapshots ,
1187+ snapshots ,
11931188 pitrs ,
11941189 c .mutation .snapshotMeta ,
11951190 iscp ,
@@ -1232,7 +1227,7 @@ func (c *checkpointCleaner) doGCAgainstGlobalCheckpointLocked(
12321227 now = time .Now ()
12331228 // TODO:
12341229 c .updateGCWaterMark (gckp )
1235- c .mutation .snapshotMeta .MergeTableInfo (accountSnapshots , pitrs )
1230+ c .mutation .snapshotMeta .MergeTableInfo (snapshots , pitrs )
12361231 mergeDuration = time .Since (now )
12371232 return filesToGC , nil
12381233}
@@ -1324,7 +1319,7 @@ func (c *checkpointCleaner) DoCheck(ctx context.Context) error {
13241319 // TODO
13251320 return err
13261321 }
1327- var snapshots map [ uint32 ]containers. Vector
1322+ var snapshots * logtail. SnapshotInfo
13281323 snapshots , err = c .GetSnapshotsLocked ()
13291324 if err != nil {
13301325 logutil .Error (
@@ -1334,7 +1329,6 @@ func (c *checkpointCleaner) DoCheck(ctx context.Context) error {
13341329 )
13351330 return err
13361331 }
1337- defer logtail .CloseSnapshotList (snapshots )
13381332 var pitr * logtail.PitrInfo
13391333 pitr , err = c .GetPITRsLocked (c .ctx )
13401334 if err != nil {
@@ -1348,8 +1342,6 @@ func (c *checkpointCleaner) DoCheck(ctx context.Context) error {
13481342
13491343 mergeWindow := c .GetScannedWindowLocked ().Clone ()
13501344 defer mergeWindow .Close ()
1351-
1352- accoutSnapshots := TransformToTSList (snapshots )
13531345 logutil .Info (
13541346 "GC-TRACE-MERGE-WINDOW" ,
13551347 zap .String ("task" , c .TaskNameLocked ()),
@@ -1362,7 +1354,7 @@ func (c *checkpointCleaner) DoCheck(ctx context.Context) error {
13621354 if _ , _ , err = mergeWindow .ExecuteGlobalCheckpointBasedGC (
13631355 c .ctx ,
13641356 gCkp ,
1365- accoutSnapshots ,
1357+ snapshots ,
13661358 pitr ,
13671359 c .mutation .snapshotMeta ,
13681360 iscp ,
@@ -1386,7 +1378,7 @@ func (c *checkpointCleaner) DoCheck(ctx context.Context) error {
13861378 if _ , _ , err = debugWindow .ExecuteGlobalCheckpointBasedGC (
13871379 c .ctx ,
13881380 gCkp ,
1389- accoutSnapshots ,
1381+ snapshots ,
13901382 pitr ,
13911383 c .mutation .snapshotMeta ,
13921384 iscp ,
@@ -1468,7 +1460,7 @@ func (c *checkpointCleaner) DoCheck(ctx context.Context) error {
14681460 }
14691461 collectObjectsFromCheckpointData (c .ctx , ckpReader , cptCkpObjects )
14701462
1471- tList , pList := c .mutation .snapshotMeta .AccountToTableSnapshots (accoutSnapshots , pitr )
1463+ tList , pList := c .mutation .snapshotMeta .AccountToTableSnapshots (snapshots , pitr )
14721464 for name , tables := range ickpObjects {
14731465 for _ , entry := range tables {
14741466 if cptCkpObjects [name ] != nil {
@@ -1840,12 +1832,13 @@ func (c *checkpointCleaner) mutUpdateSnapshotMetaLocked(
18401832 )
18411833}
18421834
1843- func (c * checkpointCleaner ) GetSnapshots () (map [ uint32 ]containers. Vector , error ) {
1835+ func (c * checkpointCleaner ) GetSnapshots () (* logtail. SnapshotInfo , error ) {
18441836 c .mutation .Lock ()
18451837 defer c .mutation .Unlock ()
18461838 return c .mutation .snapshotMeta .GetSnapshot (c .ctx , c .sid , c .fs , c .mp )
18471839}
1848- func (c * checkpointCleaner ) GetSnapshotsLocked () (map [uint32 ]containers.Vector , error ) {
1840+
1841+ func (c * checkpointCleaner ) GetSnapshotsLocked () (* logtail.SnapshotInfo , error ) {
18491842 return c .mutation .snapshotMeta .GetSnapshot (c .ctx , c .sid , c .fs , c .mp )
18501843}
18511844func (c * checkpointCleaner ) GetTablePK (tid uint64 ) string {
0 commit comments