docstr: target: test compact twice
  method: 1.create with shard_num=1
          2.insert and flush twice (two segments)
          3.compact
          4.insert new data
          5.compact
  expected: Merge into one segment
docstr_tok: ["target",":","test","compact","twice","method",":","1.create","with","shard_num=1","2.insert","and","flush","twice","(","two","segments",")","3.compact","4.insert","new","data","5.compact","expected",":","Merge","into","one","segment"]
code: def test_compact_twice(self):
      """
      target: test compact twice
      method: 1.create with shard_num=1
              2.insert and flush twice (two segments)
              3.compact
              4.insert new data
              5.compact
      expected: Merge into one segment
      """
      # init collection with one shard, insert into two segments
      pytest.skip(
          "DataCoord: for A, B -> C, will not compact segment C before A, B GCed, no method to check whether a segment is GCed"
      )
      collection_w = self.collection_insert_multi_segments_one_shard(
          prefix, nb_of_segment=tmp_nb
      )
  
      # first compact two segments
      collection_w.compact()
      collection_w.wait_for_compaction_completed()
      c_plans1 = collection_w.get_compaction_plans()[0]
      target_1 = c_plans1.plans[0].target
  
      # insert new data
      df = cf.gen_default_dataframe_data(tmp_nb)
      collection_w.insert(df)
      log.debug(collection_w.num_entities)
  
      # second compact
      collection_w.compact()
      collection_w.wait_for_compaction_completed()
      collection_w.get_compaction_state()
      c_plans2 = collection_w.get_compaction_plans()[0]
  
      assert target_1 in c_plans2.plans[0].sources
      log.debug(c_plans2.plans[0].target)
  
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 2 for calling the TestCompactionParams obj's underlying member method code with example usage: obj.test_compact_twice() without return types