Skip to content

INTERNAL: Check the index and vector dimensions before a lane - #19

Merged
jhpark816 merged 1 commit into
developfrom
precheck
Nov 9, 2026
Merged

jhpark816 merged 1 commit into
developfrom
precheck

Conversation

@ing-eoking

Copy link
Copy Markdown
Collaborator

🔗 Related Issue

⌨️ What I did

lane에 넘기기 전에 execute에서 인덱스와 벡터를 검사하고, 검색에 쓸 벡터를 lane에 넘깁니다.
아직 명령을 실제로 수행하지는 않습니다.

벡터 읽기

body를 받은 뒤 Pending::request()에서 벡터 구간을 잘라 인덱스 차원에 맞는 f32 벡터로 바꾸고, Request에 채웁니다.

형식 해석
bin (기본) little-endian f32 배열
str 공백으로 구분한 십진수

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ing-eoking ing-eoking changed the title Precheck INTERNAL: Check the index and vector dimensions before a lane Nov 2, 2026
@ing-eoking
ing-eoking marked this pull request as draft November 3, 2026 00:49
@ing-eoking
ing-eoking force-pushed the precheck branch 2 times, most recently from f77f60d to e398bcc Compare November 3, 2026 07:15
@ing-eoking
ing-eoking force-pushed the precheck branch 2 times, most recently from 24cb09e to e48351f Compare November 3, 2026 23:46
@ing-eoking
ing-eoking force-pushed the precheck branch 2 times, most recently from e96d658 to 72a0162 Compare November 5, 2026 15:15
@ing-eoking
ing-eoking force-pushed the lane-task branch 2 times, most recently from c323631 to f26390c Compare November 6, 2026 07:58
@ing-eoking
ing-eoking force-pushed the precheck branch 2 times, most recently from d986b8b to 852f103 Compare November 6, 2026 08:05
@ing-eoking
ing-eoking requested review from namsic and zhy2on November 7, 2026 09:26
@ing-eoking
ing-eoking marked this pull request as ready for review November 7, 2026 09:26
Comment thread src/cmd.rs Resolved
Comment thread src/protocol.rs Resolved
Comment thread src/aio/pool.rs Resolved
@ing-eoking

Copy link
Copy Markdown
Collaborator Author

추가 변경

이전에 프로토콜 결정 과정에서 vector와 meta의 위치를 변경하기로 했으나,
해당 내용이 기존 구현에 반영되지 않은 것을 확인하여 수정했습니다.

변경 사항은 meta와 vector의 위치를 서로 바꾼 것이며, 그 외 프로토콜 구조는 동일합니다.

기존

vop upsert ...\r\n
<meta>\r\n
<vector>\r\n

변경

vop upsert ...\r\n
<vector>\r\n
<meta>\r\n

Comment thread src/cmd.rs
Err(e) => e.reply(),
},
Ok(request) if !index::exists(request.index()) => Error::NotFound.reply(),
Ok(request) if index::dimensions(request.index()).is_none() => Error::NotFound.reply(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

메모: index 유무 검사는 일관성이 없는 상태임.

여기 구현은 모든 요청에서 인덱스 검사를 가장 먼저 한 뒤에 요청 타입 별 처리하는 것처럼 보이지만,
실제로는 body 해석 시점에 dimensions 확인을 위해 인덱스 체크 이미 한 경우도 있으며,
요청마다 인덱스를 확인하는 시점이나 방법이 다름

이후 한 요청에서 인덱스 여러 번 확인하는 경우 동시성 문제 없도록 신경써서 구현해야 함

Comment thread src/nread.rs
return Err(Error::BadDataChunk);
}
rest = tail;
segment.strip_suffix(b"\r\n").ok_or(Error::BadDataChunk)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위 rest.split_at_checked에서 Error::BadDataChunk 발생하지 않는 분기는
nread에서 길이 맞춰 읽었으므로 이 시점에 논리적으로 발생할 수 없는 분기이고,
단지 린트에서 panic 발생시키는 코드 막았기 때문에 일어나지 않을 상황에 대한 예외 처리를 하는 것임

@ing-eoking
ing-eoking requested a review from jhpark816 November 9, 2026 08:36
@jhpark816
jhpark816 merged commit 6184433 into develop Nov 9, 2026
4 checks passed

This branch was previously deployed

1 inactive deployment
ee — 12b0d208 Deployed Nov 9, 2026 by ing-eoking via Build arcus-memcached #78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants