@@ -80,7 +80,7 @@ func (suite *APIsTestSuite) SetupTest() {
80
80
collection .Name = "collection_" + suite .T ().Name () + strconv .Itoa (index )
81
81
}
82
82
ctx := context .Background ()
83
- c , err := NewCoordinator (ctx , SoftDelete , suite .s3MetaStore , true )
83
+ c , err := NewCoordinator (ctx , suite .s3MetaStore , true )
84
84
if err != nil {
85
85
suite .T ().Fatalf ("error creating coordinator: %v" , err )
86
86
}
@@ -111,7 +111,7 @@ func (suite *APIsTestSuite) TearDownTest() {
111
111
func testCollection (t * rapid.T ) {
112
112
dbcore .ConfigDatabaseForTesting ()
113
113
ctx := context .Background ()
114
- c , err := NewCoordinator (ctx , HardDelete , nil , false )
114
+ c , err := NewCoordinator (ctx , nil , false )
115
115
if err != nil {
116
116
t .Fatalf ("error creating coordinator: %v" , err )
117
117
}
@@ -164,7 +164,7 @@ func testCollection(t *rapid.T) {
164
164
func testSegment (t * rapid.T ) {
165
165
dbcore .ConfigDatabaseForTesting ()
166
166
ctx := context .Background ()
167
- c , err := NewCoordinator (ctx , HardDelete , nil , false )
167
+ c , err := NewCoordinator (ctx , nil , false )
168
168
if err != nil {
169
169
t .Fatalf ("error creating coordinator: %v" , err )
170
170
}
@@ -486,7 +486,7 @@ func (suite *APIsTestSuite) TestCreateGetDeleteCollections() {
486
486
DatabaseName : suite .databaseName ,
487
487
TenantID : suite .tenantName ,
488
488
}
489
- err = suite .coordinator .DeleteCollection (ctx , deleteCollection )
489
+ err = suite .coordinator .SoftDeleteCollection (ctx , deleteCollection )
490
490
suite .NoError (err )
491
491
492
492
results , err = suite .coordinator .GetCollections (ctx , types .NilUniqueID (), nil , suite .tenantName , suite .databaseName , nil , nil )
@@ -508,7 +508,7 @@ func (suite *APIsTestSuite) TestCreateGetDeleteCollections() {
508
508
suite .Empty (byIDResult )
509
509
510
510
// Duplicate delete throws an exception
511
- err = suite .coordinator .DeleteCollection (ctx , deleteCollection )
511
+ err = suite .coordinator .SoftDeleteCollection (ctx , deleteCollection )
512
512
suite .Error (err )
513
513
514
514
// Re-create the deleted collection
@@ -560,7 +560,7 @@ func (suite *APIsTestSuite) TestCreateGetDeleteCollections() {
560
560
DatabaseName : suite .databaseName ,
561
561
TenantID : suite .tenantName ,
562
562
}
563
- err = suite .coordinator .DeleteCollection (ctx , deleteCollection )
563
+ err = suite .coordinator .SoftDeleteCollection (ctx , deleteCollection )
564
564
suite .NoError (err )
565
565
566
566
// Verify collection and segment were deleted
@@ -572,68 +572,11 @@ func (suite *APIsTestSuite) TestCreateGetDeleteCollections() {
572
572
segments , err = suite .coordinator .GetSegments (ctx , segment .ID , nil , nil , createCollection .ID )
573
573
suite .NoError (err )
574
574
suite .NotEmpty (segments )
575
- suite .coordinator .deleteMode = HardDelete
576
- err = suite .coordinator .DeleteCollection (ctx , deleteCollection )
575
+ err = suite .coordinator .FinishCollectionDeletion (ctx , deleteCollection )
577
576
suite .NoError (err )
578
577
segments , err = suite .coordinator .GetSegments (ctx , segment .ID , nil , nil , createCollection .ID )
579
578
suite .NoError (err )
580
579
suite .Empty (segments )
581
-
582
- // Check for forward and backward compatibility with soft and hard delete.
583
- // 1. Create a collection with soft delete enabled.
584
- // 2. Delete the collection (i.e. it will be marked as is_deleted)
585
- // 3. Disable soft delete.
586
- // 4. Query for the deleted collection. It should not be found.
587
- // 5. Enable soft delete.
588
- // 6. Query for the deleted collection. It should be found.
589
-
590
- suite .coordinator .deleteMode = SoftDelete
591
- collectionId := types .NewUniqueID ()
592
- suite .coordinator .CreateCollection (ctx , & model.CreateCollection {
593
- ID : collectionId ,
594
- Name : "test_coll_fwd_bkwd_compat" ,
595
- TenantID : suite .tenantName ,
596
- DatabaseName : suite .databaseName ,
597
- })
598
- suite .coordinator .DeleteCollection (ctx , & model.DeleteCollection {
599
- ID : collectionId ,
600
- DatabaseName : suite .databaseName ,
601
- TenantID : suite .tenantName ,
602
- })
603
- collection , err := suite .coordinator .GetCollections (ctx , collectionId , nil , suite .tenantName , suite .databaseName , nil , nil )
604
- suite .NoError (err )
605
- // Check that the collection is deleted
606
- suite .Empty (collection )
607
- // Toggle the mode.
608
- suite .coordinator .deleteMode = HardDelete
609
- collection , err = suite .coordinator .GetCollections (ctx , collectionId , nil , suite .tenantName , suite .databaseName , nil , nil )
610
- suite .NoError (err )
611
- // Check that the collection is still deleted
612
- suite .Empty (collection )
613
- // Create a collection and delete while being in HardDelete mode.
614
- anotherCollectionId := types .NewUniqueID ()
615
- suite .coordinator .CreateCollection (ctx , & model.CreateCollection {
616
- ID : anotherCollectionId ,
617
- Name : "test_coll_fwd_bkwd_compat" ,
618
- TenantID : suite .tenantName ,
619
- DatabaseName : suite .databaseName ,
620
- })
621
- suite .coordinator .DeleteCollection (ctx , & model.DeleteCollection {
622
- ID : anotherCollectionId ,
623
- DatabaseName : suite .databaseName ,
624
- TenantID : suite .tenantName ,
625
- })
626
-
627
- // Toggle the mode.
628
- suite .coordinator .deleteMode = SoftDelete
629
- collection , err = suite .coordinator .GetCollections (ctx , collectionId , nil , suite .tenantName , suite .databaseName , nil , nil )
630
- suite .NoError (err )
631
- // Check that the collection is still deleted
632
- suite .Empty (collection )
633
- collection , err = suite .coordinator .GetCollections (ctx , anotherCollectionId , nil , suite .tenantName , suite .databaseName , nil , nil )
634
- suite .NoError (err )
635
- // Check that another collection is still deleted
636
- suite .Empty (collection )
637
580
}
638
581
639
582
func (suite * APIsTestSuite ) TestCollectionSize () {
@@ -1310,7 +1253,6 @@ func (suite *APIsTestSuite) TestSoftAndHardDeleteCollection() {
1310
1253
ctx := context .Background ()
1311
1254
1312
1255
// Test Hard Delete scenario
1313
- suite .coordinator .deleteMode = HardDelete
1314
1256
// Create test collection
1315
1257
testCollection2 := & model.CreateCollection {
1316
1258
ID : types .NewUniqueID (),
@@ -1324,7 +1266,13 @@ func (suite *APIsTestSuite) TestSoftAndHardDeleteCollection() {
1324
1266
suite .NoError (err )
1325
1267
1326
1268
// Hard delete the collection
1327
- err = suite .coordinator .DeleteCollection (ctx , & model.DeleteCollection {
1269
+ err = suite .coordinator .SoftDeleteCollection (ctx , & model.DeleteCollection {
1270
+ ID : testCollection2 .ID ,
1271
+ TenantID : testCollection2 .TenantID ,
1272
+ DatabaseName : testCollection2 .DatabaseName ,
1273
+ })
1274
+ suite .NoError (err )
1275
+ err = suite .coordinator .FinishCollectionDeletion (ctx , & model.DeleteCollection {
1328
1276
ID : testCollection2 .ID ,
1329
1277
TenantID : testCollection2 .TenantID ,
1330
1278
DatabaseName : testCollection2 .DatabaseName ,
@@ -1343,7 +1291,6 @@ func (suite *APIsTestSuite) TestSoftAndHardDeleteCollection() {
1343
1291
suite .Empty (softDeletedResults )
1344
1292
1345
1293
// Test Soft Delete scenario
1346
- suite .coordinator .deleteMode = SoftDelete
1347
1294
// Create a test collection
1348
1295
testCollection := & model.CreateCollection {
1349
1296
ID : types .NewUniqueID (),
@@ -1357,7 +1304,7 @@ func (suite *APIsTestSuite) TestSoftAndHardDeleteCollection() {
1357
1304
suite .NoError (err )
1358
1305
1359
1306
// Soft delete the collection
1360
- err = suite .coordinator .DeleteCollection (ctx , & model.DeleteCollection {
1307
+ err = suite .coordinator .SoftDeleteCollection (ctx , & model.DeleteCollection {
1361
1308
ID : testCollection .ID ,
1362
1309
TenantID : testCollection .TenantID ,
1363
1310
DatabaseName : testCollection .DatabaseName ,
0 commit comments