docstr: target: test compact both delete and merge
  method: 1.create collection with shard_num=1
          2.insert data into two segments
          3.delete and flush (new insert)
          4.compact
          5.load and search
  expected: Triggre two types compaction
docstr_tok: ["target",":","test","compact","both","delete","and","merge","method",":","1.create","collection","with","shard_num=1","2.insert","data","into","two","segments","3.delete","and","flush","(","new","insert",")","4.compact","5.load","and","search","expected",":","Triggre","two","types","compaction"]
code: def test_compact_both_delete_merge(self):
      """
      target: test compact both delete and merge
      method: 1.create collection with shard_num=1
              2.insert data into two segments
              3.delete and flush (new insert)
              4.compact
              5.load and search
      expected: Triggre two types compaction
      """
      collection_w = self.init_collection_wrap(
          cf.gen_unique_str(prefix), shards_num=1
      )
      ids = []
      for i in range(2):
          df = cf.gen_default_dataframe_data(tmp_nb, start=i * tmp_nb)
          insert_res, _ = collection_w.insert(df)
          assert collection_w.num_entities == (i + 1) * tmp_nb
          ids.extend(insert_res.primary_keys)
  
      # delete_ids = ids[:tmp_nb]
      delete_ids = [0, tmp_nb // 2]
      expr = f"{ct.default_int64_field_name} in {delete_ids}"
      collection_w.delete(expr)
  
      collection_w.insert(
          cf.gen_default_dataframe_data(1, start=2 * tmp_nb)
      )
      assert collection_w.num_entities == 2 * tmp_nb + 1
  
      sleep(ct.compact_retention_duration + 1)
  
      collection_w.compact()
      collection_w.wait_for_compaction_completed()
      c_plans = collection_w.get_compaction_plans()[0]
  
      # assert len(c_plans.plans) == 2
      # todo assert two types compaction plan
  
      # search
      ids.pop(0)
      ids.pop(-1)
      collection_w.load()
      search_res, _ = collection_w.search(
          cf.gen_vectors(ct.default_nq, ct.default_dim),
          ct.default_float_vec_field_name,
          ct.default_search_params,
          ct.default_limit,
          check_items={
              "nq": ct.default_nq,
              "ids": ids,
              "limit": ct.default_limit,
          },
      )
      collection_w.query(
          f"{ct.default_int64_field_name} in {delete_ids}",
          check_task=CheckTasks.check_query_empty,
      )
  
imports: import threading
  from time import time, sleep
  import pytest
  from pymilvus.grpc_gen.common_pb2 import SegmentState
  from pymilvus.exceptions import MilvusException
  from base.client_base import TestcaseBase
  from common import common_func
  from common import common_type
  from common.common_type import CaseLabel, CheckTasks
  from utils.util_log import test_log
label_desc: Use image node_id 1 for calling the TestCompactionOperation obj's underlying member method code with example usage: obj.test_compact_both_delete_merge() without return types