MCPcopy Create free account
hub / github.com/antgroup/vsag / TestHGraphConcurrentAdd

Function TestHGraphConcurrentAdd

tests/test_hgraph.cpp:1566–1608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1564}
1565
1566static void
1567TestHGraphConcurrentAdd(const fixtures::HGraphTestIndexPtr& test_index,
1568 const fixtures::HGraphResourcePtr& resource) {
1569 using namespace fixtures;
1570 auto origin_size = vsag::Options::Instance().block_size_limit();
1571 auto size = GENERATE(1024 * 1024 * 2);
1572 auto search_param = fmt::format(fixtures::search_param_tmp, 200, false);
1573
1574 for (auto metric_type : resource->metric_types) {
1575 for (auto dim : resource->dims) {
1576 for (auto& [base_quantization_str, recall] : resource->test_cases) {
1577 INFO(fmt::format("metric_type: {}, dim: {}, base_quantization_str: {}, recall: {}",
1578 metric_type,
1579 dim,
1580 base_quantization_str,
1581 recall));
1582 if (HGraphTestIndex::IsRaBitQ(base_quantization_str) &&
1583 dim < fixtures::RABITQ_MIN_RACALL_DIM) {
1584 dim = fixtures::RABITQ_MIN_RACALL_DIM;
1585 }
1586
1587 // Set block size limit for current test iteration
1588 vsag::Options::Instance().set_block_size_limit(size);
1589
1590 // Generate index parameters with attribute support enabled
1591 HGraphTestIndex::HGraphBuildParam build_param(
1592 metric_type, dim, base_quantization_str);
1593 auto param = HGraphTestIndex::GenerateHGraphBuildParametersString(build_param);
1594 auto index = TestIndex::TestFactory(test_index->name, param, true);
1595 auto dataset = HGraphTestIndex::pool.GetDatasetAndCreate(
1596 dim, resource->base_count, metric_type);
1597
1598 // Execute build test
1599 TestIndex::TestConcurrentAdd(index, dataset, true);
1600 if (index->CheckFeature(vsag::SUPPORT_ADD_CONCURRENT)) {
1601 HGraphTestIndex::TestGeneral(index, dataset, search_param, recall);
1602 }
1603 // Restore original block size limit
1604 vsag::Options::Instance().set_block_size_limit(origin_size);
1605 }
1606 }
1607 }
1608}
1609
1610TEST_CASE("(PR) HGraph Concurrent Add", "[ft][hgraph][pr][concurrent]") {
1611 auto test_index = std::make_shared<fixtures::HGraphTestIndex>();

Callers 1

test_hgraph.cppFile · 0.85

Calls 4

block_size_limitMethod · 0.80
set_block_size_limitMethod · 0.80
GetDatasetAndCreateMethod · 0.80
CheckFeatureMethod · 0.45

Tested by

no test coverage detected