fix parallel external sort defend too strict issue
This commit is contained in:
		@ -1889,7 +1889,7 @@ int ObExternalSort<T, Compare>::get_next_item(const T *&item)
 | 
			
		||||
  if (OB_SUCC(ret)) {
 | 
			
		||||
    get_count_++;
 | 
			
		||||
  }
 | 
			
		||||
  if (common::OB_ITER_END == ret && add_count_ != get_count_) {
 | 
			
		||||
  if (common::OB_ITER_END == ret && is_sorted_ && add_count_ != get_count_) {
 | 
			
		||||
    ret = common::OB_ERR_SYS;
 | 
			
		||||
    STORAGE_LOG(WARN, "add count not match get count", K(ret), K_(add_count), K_(get_count));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -951,6 +951,29 @@ TEST_F(TestParallelExternalSort, test_multi_task_sort)
 | 
			
		||||
  test_multi_task_sort(buf_mem_limit, file_buf_size, 10000, task_cnt);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST_F(TestParallelExternalSort, test_get_before_sort)
 | 
			
		||||
{
 | 
			
		||||
  int ret = OB_SUCCESS;
 | 
			
		||||
  const int64_t file_buf_size = MACRO_BLOCK_SIZE;
 | 
			
		||||
  const int64_t buf_mem_limit = 8 * 1024 * 1024L;
 | 
			
		||||
  typedef ObExternalSort<TestItem, TestItemCompare> ExternalSort;
 | 
			
		||||
  ExternalSort external_sort;
 | 
			
		||||
  ObVector<TestItem *>total_items;
 | 
			
		||||
  TestItemCompare compare(ret);
 | 
			
		||||
  const int64_t expire_timestamp = 0;
 | 
			
		||||
  ret = external_sort.init(buf_mem_limit, file_buf_size, expire_timestamp, OB_SYS_TENANT_ID, &compare);
 | 
			
		||||
  ASSERT_EQ(OB_SUCCESS, ret);
 | 
			
		||||
  ret = generate_items(10, false, total_items);
 | 
			
		||||
  ASSERT_EQ(OB_SUCCESS, ret);
 | 
			
		||||
  for (int64_t i = 0; OB_SUCC(ret) && i < total_items.size(); ++i) {
 | 
			
		||||
    ret = external_sort.add_item(*total_items.at(i));
 | 
			
		||||
    ASSERT_EQ(OB_SUCCESS, ret);
 | 
			
		||||
  }
 | 
			
		||||
  const TestItem *item = NULL;
 | 
			
		||||
  ret = external_sort.get_next_item(item);
 | 
			
		||||
  ASSERT_EQ(OB_ITER_END, ret);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}  // end namespace common
 | 
			
		||||
}  // end namespace oceanbase
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user