@@ -80,7 +80,7 @@ func (suite *APIsTestSuite) SetupTest() {
8080 collection .Name = "collection_" + suite .T ().Name () + strconv .Itoa (index )
8181 }
8282 ctx := context .Background ()
83- c , err := NewCoordinator (ctx , SoftDelete , suite .s3MetaStore , true )
83+ c , err := NewCoordinator (ctx , suite .s3MetaStore , true )
8484 if err != nil {
8585 suite .T ().Fatalf ("error creating coordinator: %v" , err )
8686 }
@@ -111,7 +111,7 @@ func (suite *APIsTestSuite) TearDownTest() {
111111func testCollection (t * rapid.T ) {
112112 dbcore .ConfigDatabaseForTesting ()
113113 ctx := context .Background ()
114- c , err := NewCoordinator (ctx , HardDelete , nil , false )
114+ c , err := NewCoordinator (ctx , nil , false )
115115 if err != nil {
116116 t .Fatalf ("error creating coordinator: %v" , err )
117117 }
@@ -164,7 +164,7 @@ func testCollection(t *rapid.T) {
164164func testSegment (t * rapid.T ) {
165165 dbcore .ConfigDatabaseForTesting ()
166166 ctx := context .Background ()
167- c , err := NewCoordinator (ctx , HardDelete , nil , false )
167+ c , err := NewCoordinator (ctx , nil , false )
168168 if err != nil {
169169 t .Fatalf ("error creating coordinator: %v" , err )
170170 }
@@ -486,7 +486,7 @@ func (suite *APIsTestSuite) TestCreateGetDeleteCollections() {
486486 DatabaseName : suite .databaseName ,
487487 TenantID : suite .tenantName ,
488488 }
489- err = suite .coordinator .DeleteCollection (ctx , deleteCollection )
489+ err = suite .coordinator .SoftDeleteCollection (ctx , deleteCollection )
490490 suite .NoError (err )
491491
492492 results , err = suite .coordinator .GetCollections (ctx , types .NilUniqueID (), nil , suite .tenantName , suite .databaseName , nil , nil )
@@ -508,7 +508,7 @@ func (suite *APIsTestSuite) TestCreateGetDeleteCollections() {
508508 suite .Empty (byIDResult )
509509
510510 // Duplicate delete throws an exception
511- err = suite .coordinator .DeleteCollection (ctx , deleteCollection )
511+ err = suite .coordinator .SoftDeleteCollection (ctx , deleteCollection )
512512 suite .Error (err )
513513
514514 // Re-create the deleted collection
@@ -560,7 +560,7 @@ func (suite *APIsTestSuite) TestCreateGetDeleteCollections() {
560560 DatabaseName : suite .databaseName ,
561561 TenantID : suite .tenantName ,
562562 }
563- err = suite .coordinator .DeleteCollection (ctx , deleteCollection )
563+ err = suite .coordinator .SoftDeleteCollection (ctx , deleteCollection )
564564 suite .NoError (err )
565565
566566 // Verify collection and segment were deleted
@@ -572,68 +572,11 @@ func (suite *APIsTestSuite) TestCreateGetDeleteCollections() {
572572 segments , err = suite .coordinator .GetSegments (ctx , segment .ID , nil , nil , createCollection .ID )
573573 suite .NoError (err )
574574 suite .NotEmpty (segments )
575- suite .coordinator .deleteMode = HardDelete
576- err = suite .coordinator .DeleteCollection (ctx , deleteCollection )
575+ err = suite .coordinator .FinishCollectionDeletion (ctx , deleteCollection )
577576 suite .NoError (err )
578577 segments , err = suite .coordinator .GetSegments (ctx , segment .ID , nil , nil , createCollection .ID )
579578 suite .NoError (err )
580579 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 )
637580}
638581
639582func (suite * APIsTestSuite ) TestCollectionSize () {
@@ -1310,7 +1253,6 @@ func (suite *APIsTestSuite) TestSoftAndHardDeleteCollection() {
13101253 ctx := context .Background ()
13111254
13121255 // Test Hard Delete scenario
1313- suite .coordinator .deleteMode = HardDelete
13141256 // Create test collection
13151257 testCollection2 := & model.CreateCollection {
13161258 ID : types .NewUniqueID (),
@@ -1324,7 +1266,13 @@ func (suite *APIsTestSuite) TestSoftAndHardDeleteCollection() {
13241266 suite .NoError (err )
13251267
13261268 // 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 {
13281276 ID : testCollection2 .ID ,
13291277 TenantID : testCollection2 .TenantID ,
13301278 DatabaseName : testCollection2 .DatabaseName ,
@@ -1343,7 +1291,6 @@ func (suite *APIsTestSuite) TestSoftAndHardDeleteCollection() {
13431291 suite .Empty (softDeletedResults )
13441292
13451293 // Test Soft Delete scenario
1346- suite .coordinator .deleteMode = SoftDelete
13471294 // Create a test collection
13481295 testCollection := & model.CreateCollection {
13491296 ID : types .NewUniqueID (),
@@ -1357,7 +1304,7 @@ func (suite *APIsTestSuite) TestSoftAndHardDeleteCollection() {
13571304 suite .NoError (err )
13581305
13591306 // Soft delete the collection
1360- err = suite .coordinator .DeleteCollection (ctx , & model.DeleteCollection {
1307+ err = suite .coordinator .SoftDeleteCollection (ctx , & model.DeleteCollection {
13611308 ID : testCollection .ID ,
13621309 TenantID : testCollection .TenantID ,
13631310 DatabaseName : testCollection .DatabaseName ,
0 commit comments