@@ -679,14 +679,136 @@ TieredIndexParams CreateTieredParams(VecSimParams &primary_params,
679
679
return tiered_params;
680
680
}
681
681
682
- VecSimIndex *CreateNewTieredHNSWIndex (const HNSWParams &hnsw_params,
683
- tieredIndexMock &mock_thread_pool) {
684
- VecSimParams primary_params = CreateParams (hnsw_params);
685
- auto tiered_params = CreateTieredParams (primary_params, mock_thread_pool);
686
- VecSimParams params = CreateParams (tiered_params);
687
- VecSimIndex *index = VecSimIndex_New (¶ms);
688
- mock_thread_pool.ctx ->index_strong_ref .reset (index);
689
-
690
- return index;
682
+ namespace test_debug_info_iterator_order {
683
+ std::vector<std::string> getCommonFields () {
684
+ return {
685
+ VecSimCommonStrings::TYPE_STRING, // 1. TYPE
686
+ VecSimCommonStrings::DIMENSION_STRING, // 2. DIMENSION
687
+ VecSimCommonStrings::METRIC_STRING, // 3. METRIC
688
+ VecSimCommonStrings::IS_MULTI_STRING, // 4. IS_MULTI
689
+ VecSimCommonStrings::INDEX_SIZE_STRING, // 5. INDEX_SIZE
690
+ VecSimCommonStrings::INDEX_LABEL_COUNT_STRING, // 6. INDEX_LABEL_COUNT
691
+ VecSimCommonStrings::MEMORY_STRING, // 7. MEMORY
692
+ VecSimCommonStrings::SEARCH_MODE_STRING // 8. SEARCH_MODE
693
+ };
691
694
}
695
+
696
+ std::vector<std::string> getFlatFields () {
697
+ std::vector<std::string> fields;
698
+ fields.push_back (VecSimCommonStrings::ALGORITHM_STRING); // ALGORITHM
699
+ auto commonFields = getCommonFields ();
700
+ fields.insert (fields.end (), commonFields.begin (), commonFields.end ());
701
+ fields.push_back (VecSimCommonStrings::BLOCK_SIZE_STRING); // BLOCK_SIZE
702
+ return fields;
703
+ }
704
+
705
+ // Imitates HNSWIndex<DataType, DistType>::debugInfoIterator()
706
+ std::vector<std::string> getHNSWFields () {
707
+ std::vector<std::string> fields;
708
+ fields.push_back (VecSimCommonStrings::ALGORITHM_STRING); // ALGORITHM
709
+ auto commonFields = getCommonFields ();
710
+ fields.insert (fields.end (), commonFields.begin (), commonFields.end ());
711
+ // Then HNSW-specific fields:
712
+ fields.push_back (VecSimCommonStrings::BLOCK_SIZE_STRING);
713
+ fields.push_back (VecSimCommonStrings::HNSW_M_STRING);
714
+ fields.push_back (VecSimCommonStrings::HNSW_EF_CONSTRUCTION_STRING);
715
+ fields.push_back (VecSimCommonStrings::HNSW_EF_RUNTIME_STRING);
716
+ fields.push_back (VecSimCommonStrings::HNSW_MAX_LEVEL);
717
+ fields.push_back (VecSimCommonStrings::HNSW_ENTRYPOINT);
718
+ fields.push_back (VecSimCommonStrings::EPSILON_STRING);
719
+ fields.push_back (VecSimCommonStrings::NUM_MARKED_DELETED);
720
+ return fields;
721
+ }
722
+
723
+ // Imitates SVSIndex<DataType, DistType>::debugInfoIterator()
724
+ std::vector<std::string> getSVSFields () {
725
+ std::vector<std::string> fields;
726
+ fields.push_back (VecSimCommonStrings::ALGORITHM_STRING); // ALGORITHM
727
+ auto commonFields = getCommonFields ();
728
+ fields.insert (fields.end (), commonFields.begin (), commonFields.end ());
729
+ // Then SVS-specific fields:
730
+ fields.push_back (VecSimCommonStrings::BLOCK_SIZE_STRING);
731
+ fields.push_back (VecSimCommonStrings::SVS_QUANT_BITS_STRING);
732
+ fields.push_back (VecSimCommonStrings::SVS_ALPHA_STRING);
733
+ fields.push_back (VecSimCommonStrings::SVS_GRAPH_MAX_DEGREE_STRING);
734
+ fields.push_back (VecSimCommonStrings::SVS_CONSTRUCTION_WS_STRING);
735
+ fields.push_back (VecSimCommonStrings::SVS_MAX_CANDIDATE_POOL_SIZE_STRING);
736
+ fields.push_back (VecSimCommonStrings::SVS_PRUNE_TO_STRING);
737
+ fields.push_back (VecSimCommonStrings::SVS_USE_SEARCH_HISTORY_STRING);
738
+ fields.push_back (VecSimCommonStrings::SVS_NUM_THREADS_STRING);
739
+ fields.push_back (VecSimCommonStrings::NUM_MARKED_DELETED);
740
+ fields.push_back (VecSimCommonStrings::SVS_SEARCH_WS_STRING);
741
+ fields.push_back (VecSimCommonStrings::SVS_SEARCH_BC_STRING);
742
+ fields.push_back (VecSimCommonStrings::SVS_LEANVEC_DIM_STRING);
743
+ fields.push_back (VecSimCommonStrings::EPSILON_STRING);
744
+ return fields;
745
+ }
746
+
747
+ // Imitates VecSimTieredIndex<DataType, DistType>::debugInfoIterator()
748
+ std::vector<std::string> getTieredCommonFields () {
749
+ std::vector<std::string> fields;
750
+ fields.push_back (VecSimCommonStrings::ALGORITHM_STRING); // ALGORITHM (set to "TIERED")
751
+ auto commonFields = getCommonFields ();
752
+ fields.insert (fields.end (), commonFields.begin (),
753
+ commonFields.end ()); // backendIndex->addCommonInfoToIterator()
754
+ // Then tiered-specific fields:
755
+ fields.push_back (VecSimCommonStrings::TIERED_MANAGEMENT_MEMORY_STRING);
756
+ fields.push_back (VecSimCommonStrings::TIERED_BACKGROUND_INDEXING_STRING);
757
+ fields.push_back (VecSimCommonStrings::TIERED_BUFFER_LIMIT_STRING);
758
+ fields.push_back (VecSimCommonStrings::FRONTEND_INDEX_STRING);
759
+ fields.push_back (VecSimCommonStrings::BACKEND_INDEX_STRING);
760
+ return fields;
761
+ }
762
+
763
+ // Imitates TieredSVSIndex<DataType, DistType>::debugInfoIterator()
764
+ std::vector<std::string> getTieredSVSFields () {
765
+ auto fields = getTieredCommonFields ();
766
+ // Add SVS tiered-specific fields:
767
+ fields.push_back (
768
+ VecSimCommonStrings::TIERED_SVS_TRAINING_THRESHOLD_STRING); // 15.
769
+ // TIERED_SVS_TRAINING_THRESHOLD
770
+ fields.push_back (
771
+ VecSimCommonStrings::TIERED_SVS_UPDATE_THRESHOLD_STRING); // 16. TIERED_SVS_UPDATE_THRESHOLD
772
+ fields.push_back (
773
+ VecSimCommonStrings::
774
+ TIERED_SVS_THREADS_RESERVE_TIMEOUT_STRING); // 17. TIERED_SVS_THREADS_RESERVE_TIMEOUT
775
+ return fields;
776
+ }
777
+
778
+ // Imitates TieredHNSWIndex<DataType, DistType>::debugInfoIterator()
779
+ std::vector<std::string> getTieredHNSWFields () {
780
+ auto fields = getTieredCommonFields ();
781
+ // Add HNSW tiered-specific field:
782
+ fields.push_back (
783
+ VecSimCommonStrings::
784
+ TIERED_HNSW_SWAP_JOBS_THRESHOLD_STRING); // 15. TIERED_HNSW_SWAP_JOBS_THRESHOLD
785
+ return fields;
786
+ }
787
+
788
+ void testDebugInfoIteratorFieldOrder (VecSimDebugInfoIterator *infoIterator,
789
+ const std::vector<std::string> &expectedFieldOrder) {
790
+ // Verify the total number of fields matches expected
791
+ ASSERT_EQ (VecSimDebugInfoIterator_NumberOfFields (infoIterator), expectedFieldOrder.size ());
792
+
793
+ // Iterate through the fields and verify the order
794
+ size_t fieldIndex = 0 ;
795
+ while (VecSimDebugInfoIterator_HasNextField (infoIterator)) {
796
+ VecSim_InfoField *infoField = VecSimDebugInfoIterator_NextField (infoIterator);
797
+ ASSERT_LT (fieldIndex, expectedFieldOrder.size ())
798
+ << " More fields than expected. Field index: " << fieldIndex;
799
+
800
+ ASSERT_STREQ (infoField->fieldName , expectedFieldOrder[fieldIndex].c_str ())
801
+ << " Field order mismatch at index " << fieldIndex
802
+ << " . Expected: " << expectedFieldOrder[fieldIndex]
803
+ << " , Got: " << infoField->fieldName ;
804
+
805
+ fieldIndex++;
806
+ }
807
+
808
+ // Verify we processed all expected fields
809
+ ASSERT_EQ (fieldIndex, expectedFieldOrder.size ())
810
+ << " Fewer fields than expected. Processed: " << fieldIndex
811
+ << " , Expected: " << expectedFieldOrder.size ();
812
+ }
813
+ } // namespace test_debug_info_iterator_order
692
814
} // namespace test_utils
0 commit comments