@@ -176,7 +176,8 @@ func TestCompactor_SkipCompactionWhenCmkError(t *testing.T) {
176
176
bucketClient .MockGet (userID + "/bucket-index.json.gz" , "" , nil )
177
177
bucketClient .MockUpload (userID + "/bucket-index-sync-status.json" , nil )
178
178
bucketClient .MockUpload (userID + "/bucket-index.json.gz" , nil )
179
- bucketClient .MockExists (path .Join (userID , cortex_tsdb .TenantDeletionMarkPath ), false , nil )
179
+ bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath (userID ), false , nil )
180
+ bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath (userID ), false , nil )
180
181
181
182
cfg := prepareConfig ()
182
183
c , _ , _ , logs , _ := prepare (t , cfg , bucketClient , nil )
@@ -500,7 +501,8 @@ func TestCompactor_ShouldIncrementCompactionErrorIfFailedToCompactASingleTenant(
500
501
bucketClient .MockIter ("" , []string {userID }, nil )
501
502
bucketClient .MockIter (userID + "/" , []string {userID + "/01DTVP434PA9VFXSW2JKB3392D/meta.json" , userID + "/01FN6CDF3PNEWWRY5MPGJPE3EX/meta.json" }, nil )
502
503
bucketClient .MockIter (userID + "/markers/" , nil , nil )
503
- bucketClient .MockExists (path .Join (userID , cortex_tsdb .TenantDeletionMarkPath ), false , nil )
504
+ bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath (userID ), false , nil )
505
+ bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath (userID ), false , nil )
504
506
bucketClient .MockGet (userID + "/01DTVP434PA9VFXSW2JKB3392D/meta.json" , mockBlockMetaJSON ("01DTVP434PA9VFXSW2JKB3392D" ), nil )
505
507
bucketClient .MockGet (userID + "/01DTVP434PA9VFXSW2JKB3392D/no-compact-mark.json" , "" , nil )
506
508
bucketClient .MockGet (userID + "/01DTVP434PA9VFXSW2JKB3392D/deletion-mark.json" , "" , nil )
@@ -549,7 +551,8 @@ func TestCompactor_ShouldIncrementCompactionErrorIfFailedToCompactASingleTenant(
549
551
func TestCompactor_ShouldCompactAndRemoveUserFolder (t * testing.T ) {
550
552
bucketClient := & bucket.ClientMock {}
551
553
bucketClient .MockIter ("" , []string {"user-1" }, nil )
552
- bucketClient .MockExists (path .Join ("user-1" , cortex_tsdb .TenantDeletionMarkPath ), false , nil )
554
+ bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-1" ), false , nil )
555
+ bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath ("user-1" ), false , nil )
553
556
bucketClient .MockIter ("user-1/" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D/meta.json" , "user-1/01FN6CDF3PNEWWRY5MPGJPE3EX/meta.json" }, nil )
554
557
bucketClient .MockIter ("user-1/markers/" , nil , nil )
555
558
bucketClient .MockGet ("user-1/01DTVP434PA9VFXSW2JKB3392D/meta.json" , mockBlockMetaJSON ("01DTVP434PA9VFXSW2JKB3392D" ), nil )
@@ -593,8 +596,10 @@ func TestCompactor_ShouldIterateOverUsersAndRunCompaction(t *testing.T) {
593
596
// Mock the bucket to contain two users, each one with one block.
594
597
bucketClient := & bucket.ClientMock {}
595
598
bucketClient .MockIter ("" , []string {"user-1" , "user-2" }, nil )
596
- bucketClient .MockExists (path .Join ("user-1" , cortex_tsdb .TenantDeletionMarkPath ), false , nil )
597
- bucketClient .MockExists (path .Join ("user-2" , cortex_tsdb .TenantDeletionMarkPath ), false , nil )
599
+ bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-1" ), false , nil )
600
+ bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath ("user-1" ), false , nil )
601
+ bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-2" ), false , nil )
602
+ bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath ("user-2" ), false , nil )
598
603
bucketClient .MockIter ("user-1/" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D/meta.json" , "user-1/01FN6CDF3PNEWWRY5MPGJPE3EX/meta.json" }, nil )
599
604
bucketClient .MockIter ("user-2/" , []string {"user-2/01DTW0ZCPDDNV4BV83Q2SV4QAZ/meta.json" , "user-2/01FN3V83ABR9992RF8WRJZ76ZQ/meta.json" }, nil )
600
605
bucketClient .MockIter ("user-1/markers/" , nil , nil )
@@ -734,7 +739,8 @@ func TestCompactor_ShouldNotCompactBlocksMarkedForDeletion(t *testing.T) {
734
739
bucketClient := & bucket.ClientMock {}
735
740
bucketClient .MockIter ("" , []string {"user-1" }, nil )
736
741
bucketClient .MockIter ("user-1/" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D" , "user-1/01DTW0ZCPDDNV4BV83Q2SV4QAZ" }, nil )
737
- bucketClient .MockExists (path .Join ("user-1" , cortex_tsdb .TenantDeletionMarkPath ), false , nil )
742
+ bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-1" ), false , nil )
743
+ bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath ("user-1" ), false , nil )
738
744
739
745
// Block that has just been marked for deletion. It will not be deleted just yet, and it also will not be compacted.
740
746
bucketClient .MockGet ("user-1/01DTVP434PA9VFXSW2JKB3392D/meta.json" , mockBlockMetaJSON ("01DTVP434PA9VFXSW2JKB3392D" ), nil )
@@ -856,8 +862,10 @@ func TestCompactor_ShouldNotCompactBlocksMarkedForSkipCompact(t *testing.T) {
856
862
// Mock the bucket to contain two users, each one with one block.
857
863
bucketClient := & bucket.ClientMock {}
858
864
bucketClient .MockIter ("" , []string {"user-1" , "user-2" }, nil )
859
- bucketClient .MockExists (path .Join ("user-1" , cortex_tsdb .TenantDeletionMarkPath ), false , nil )
860
- bucketClient .MockExists (path .Join ("user-2" , cortex_tsdb .TenantDeletionMarkPath ), false , nil )
865
+ bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-1" ), false , nil )
866
+ bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath ("user-1" ), false , nil )
867
+ bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-2" ), false , nil )
868
+ bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath ("user-2" ), false , nil )
861
869
bucketClient .MockIter ("user-1/" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D/meta.json" , "user-1/01FN6CDF3PNEWWRY5MPGJPE3EX/meta.json" }, nil )
862
870
bucketClient .MockIter ("user-2/" , []string {"user-2/01DTW0ZCPDDNV4BV83Q2SV4QAZ/meta.json" , "user-2/01FN3V83ABR9992RF8WRJZ76ZQ/meta.json" }, nil )
863
871
bucketClient .MockIter ("user-1/markers/" , nil , nil )
@@ -933,8 +941,8 @@ func TestCompactor_ShouldNotCompactBlocksForUsersMarkedForDeletion(t *testing.T)
933
941
bucketClient := & bucket.ClientMock {}
934
942
bucketClient .MockIter ("" , []string {"user-1" }, nil )
935
943
bucketClient .MockIter ("user-1/" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D" }, nil )
936
- bucketClient .MockGet (path . Join ("user-1" , cortex_tsdb . TenantDeletionMarkPath ), `{"deletion_time": 1}` , nil )
937
- bucketClient .MockUpload (path . Join ("user-1" , cortex_tsdb . TenantDeletionMarkPath ), nil )
944
+ bucketClient .MockGet (cortex_tsdb . GetGlobalDeletionMarkPath ("user-1" ), `{"deletion_time": 1}` , nil )
945
+ bucketClient .MockUpload (cortex_tsdb . GetGlobalDeletionMarkPath ("user-1" ), nil )
938
946
939
947
bucketClient .MockIter ("user-1/01DTVP434PA9VFXSW2JKB3392D" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D/meta.json" , "user-1/01DTVP434PA9VFXSW2JKB3392D/index" }, nil )
940
948
bucketClient .MockGet ("user-1/01DTVP434PA9VFXSW2JKB3392D/meta.json" , mockBlockMetaJSON ("01DTVP434PA9VFXSW2JKB3392D" ), nil )
@@ -1094,8 +1102,10 @@ func TestCompactor_ShouldCompactAllUsersOnShardingEnabledButOnlyOneInstanceRunni
1094
1102
// Mock the bucket to contain two users, each one with one block.
1095
1103
bucketClient := & bucket.ClientMock {}
1096
1104
bucketClient .MockIter ("" , []string {"user-1" , "user-2" }, nil )
1097
- bucketClient .MockExists (path .Join ("user-1" , cortex_tsdb .TenantDeletionMarkPath ), false , nil )
1098
- bucketClient .MockExists (path .Join ("user-2" , cortex_tsdb .TenantDeletionMarkPath ), false , nil )
1105
+ bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-1" ), false , nil )
1106
+ bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath ("user-1" ), false , nil )
1107
+ bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath ("user-2" ), false , nil )
1108
+ bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath ("user-2" ), false , nil )
1099
1109
bucketClient .MockIter ("user-1/" , []string {"user-1/01DTVP434PA9VFXSW2JKB3392D/meta.json" , "user-1/01FN6CDF3PNEWWRY5MPGJPE3EX/meta.json" }, nil )
1100
1110
bucketClient .MockIter ("user-2/" , []string {"user-2/01DTW0ZCPDDNV4BV83Q2SV4QAZ/meta.json" , "user-2/01FN3V83ABR9992RF8WRJZ76ZQ/meta.json" }, nil )
1101
1111
bucketClient .MockIter ("user-1/markers/" , nil , nil )
@@ -1202,7 +1212,8 @@ func TestCompactor_ShouldCompactOnlyUsersOwnedByTheInstanceOnShardingEnabledAndM
1202
1212
for _ , userID := range userIDs {
1203
1213
bucketClient .MockIter (userID + "/" , []string {userID + "/01DTVP434PA9VFXSW2JKB3392D" }, nil )
1204
1214
bucketClient .MockIter (userID + "/markers/" , nil , nil )
1205
- bucketClient .MockExists (path .Join (userID , cortex_tsdb .TenantDeletionMarkPath ), false , nil )
1215
+ bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath (userID ), false , nil )
1216
+ bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath (userID ), false , nil )
1206
1217
bucketClient .MockGet (userID + "/01DTVP434PA9VFXSW2JKB3392D/meta.json" , mockBlockMetaJSON ("01DTVP434PA9VFXSW2JKB3392D" ), nil )
1207
1218
bucketClient .MockGet (userID + "/01DTVP434PA9VFXSW2JKB3392D/deletion-mark.json" , "" , nil )
1208
1219
bucketClient .MockGet (userID + "/01DTVP434PA9VFXSW2JKB3392D/no-compact-mark.json" , "" , nil )
@@ -1334,7 +1345,8 @@ func TestCompactor_ShouldCompactOnlyShardsOwnedByTheInstanceOnShardingEnabledWit
1334
1345
1335
1346
bucketClient .MockIter (userID + "/" , blockFiles , nil )
1336
1347
bucketClient .MockIter (userID + "/markers/" , nil , nil )
1337
- bucketClient .MockExists (path .Join (userID , cortex_tsdb .TenantDeletionMarkPath ), false , nil )
1348
+ bucketClient .MockExists (cortex_tsdb .GetGlobalDeletionMarkPath (userID ), false , nil )
1349
+ bucketClient .MockExists (cortex_tsdb .GetLocalDeletionMarkPath (userID ), false , nil )
1338
1350
bucketClient .MockGet (userID + "/bucket-index.json.gz" , "" , nil )
1339
1351
bucketClient .MockUpload (userID + "/bucket-index.json.gz" , nil )
1340
1352
bucketClient .MockUpload (userID + "/bucket-index-sync-status.json" , nil )
0 commit comments