Repository: qdrant/qdrant
File: lib/shard/src/proxy_segment/segment_entry.rs (Rust)

Code before:
                    );
                    was_deleted = prev.is_none();
                    if let Some(prev) = prev {
                        debug_assert!(
                            prev.operation_version < op_num,
                            "Overriding deleted flag {:?} with older op_num:{}",
                            prev,
                            op_num
                        )
                    }
                }
                point_offset
            }
            LockedSegment::Proxy(proxy) => {
                if proxy.read().has_point(point_id) {
                    let prev = self.deleted_points.write().insert(
                        point_id,
                        ProxyDeletedPoint {
                            local_version: op_num,
                            operation_version: op_num,
                        },
                    );
                    was_deleted = prev.is_none();
                    if let Some(prev) = prev {
                        debug_assert!(
                            prev.operation_version < op_num,
                            "Overriding deleted flag {:?} with older op_num:{}",
                            prev,
                            op_num
                        )
                    }
                }
                None
            }
        };

        self.set_deleted_offset(point_offset);
        let mut write_segment_guard = self.write_segment.get().write();
        let point_version_in_write_segment = write_segment_guard
            .point_version(point_id)
            .unwrap_or_default();
        let mut was_deleted_in_writable = write_segment_guard.has_point(point_id);
        // Make sure deletion operation is not stale
        if op_num > point_version_in_write_segment {
            was_deleted_in_writable =
                write_segment_guard.delete_point(op_num, point_id, hw_counter)?;
        }
        Ok(was_deleted || was_deleted_in_writable)
    }

    fn update_vectors(

Review comment (bug):
```suggestion
                        debug_assert!(
                            prev.operation_version < op_num,
                            "Overriding deleted flag {prev:?} with older op_num:{op_num}",
                        )
```

Code after:
                    );
                    was_deleted = prev.is_none();
                    if let Some(prev) = prev {
                        debug_assert!(
                            prev.operation_version < op_num,
                            "Overriding deleted flag {prev:?} with older op_num:{op_num}",
                        )
                    }
                }
                point_offset
            }
            LockedSegment::Proxy(proxy) => {
                if proxy.read().has_point(point_id) {
                    let prev = self.deleted_points.write().insert(
                        point_id,
                        ProxyDeletedPoint {
                            local_version: op_num,
                            operation_version: op_num,
                        },
                    );
                    was_deleted = prev.is_none();
                    if let Some(prev) = prev {
                        debug_assert!(
                            prev.operation_version < op_num,
                            "Overriding deleted flag {prev:?} with older op_num:{op_num}",
                        )
                    }
                }
                None
            }
        };

        self.set_deleted_offset(point_offset);

        let was_deleted_in_writable = self
            .write_segment
            .get()
            .write()
            .delete_point(op_num, point_id, hw_counter)?;

        Ok(was_deleted || was_deleted_in_writable)
    }

    fn update_vectors(
        &mut self,
        op_num: SeqNumberType,
        point_id: PointIdType,
        vectors: NamedVectors,
        hw_counter: &HardwareCounterCell,
    ) -> OperationResult<bool> {
        self.move_if_exists(op_num, point_id, hw_counter)?;