mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 11:59:00 +08:00
2b58a1d64f
Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>
1.5 KiB
1.5 KiB
Time Travel Implementation (Segment Level)
Currently,There are two paths to implement time travel:
- Restrict with vec_count, used in growing segment
- Generate bitmask and combine it with DSL calculation results. It is mainly used in sealed segment
Growing Segment Time Travel
- When inserting, ensure that the inserted data is in ascending time order
- Find the location of timestamp with binary search and record it as vec_count
- Call vector_serch interface and rest is handled inside sement, no need to handle bitmask generated by DSL
SealedSegment Time Travel
-
During load, data is placed in a continuous memory area named chunk, with following properties:
- Data is divided into multiple segments
- The data in one segment is ordered by primary key
- Data between Segment is in timestamp order. Namely that the ts of any entity of the previous segment must be less than the timestamp of the first entity in next segment
-
The Algorithm for time travel is
- Use get_active_count interface, find the last segment containing a legal ts, and return the last element position of this segment as vec_count
- Calculate the bitset mask with timestamp. Due to the above properties, all the entities of the previous segment meet the conditions, and all the subsequent segments do not meet the conditions. Only the "last segment" needs to be calculated.
- the calculated results of Bitset and DSL are conbined and sent to vectorsearch interface