Skip to content

feat: buffer storage write#414

Open
iaojnh wants to merge 57 commits into
alibaba:mainfrom
iaojnh:feat/buffer-write
Open

feat: buffer storage write#414
iaojnh wants to merge 57 commits into
alibaba:mainfrom
iaojnh:feat/buffer-write

Conversation

@iaojnh
Copy link
Copy Markdown
Collaborator

@iaojnh iaojnh commented May 19, 2026

base on #406

@iaojnh iaojnh marked this pull request as ready for review May 22, 2026 07:39
@iaojnh iaojnh requested a review from zhourrr as a code owner May 25, 2026 02:59
@iaojnh iaojnh changed the title feat: buffer write feat: buffer storage write May 26, 2026
@iaojnh iaojnh force-pushed the feat/buffer-write branch 2 times, most recently from 14cc3fe to 235cffd Compare May 27, 2026 09:50
@zhourrr
Copy link
Copy Markdown
Collaborator

zhourrr commented May 28, 2026

collection unit test 里可以加一下 enable mmap = false 的测试,可以复用已有的,把 collection 初始化参数改下

Comment thread src/ailego/buffer/vector_page_table.cc Outdated
VecBufferPool::VecBufferPool(const std::string &filename, bool writable,
bool create) {
file_name_ = filename;
writable_ = writable || create;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这里writable等于false,create 等于 true 会把writable设置为true,是否符合预期,还是要增加校验

Copy link
Copy Markdown
Collaborator Author

@iaojnh iaojnh May 29, 2026

Choose a reason for hiding this comment

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

create这个参数在这里没用,文件初始化在buffer storage的open方法完成。
这里只区分是否可写入,create参数移除。

char *buf, size_t sz,
size_t off) -> int {
#if defined(_MSC_VER)
ssize_t w = zvec_pwrite(fd, buf, sz, off);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这个宏判断可以放到zvec_pwrite里

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done,外层统一调用zvec_pwrite,具体平台用宏判断。

// size to be a multiple of alignment.
const size_t kAlign = 4096UL;
size_t alloc_size = (len + (kAlign - 1UL)) & ~(kAlign - 1UL);
char *tmp =
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

统一成int8_t?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

这个后面单独开个pr改吧,这里就不添加pr的复杂度了

Comment thread src/core/utility/buffer_storage.cc Outdated
}
if (ailego::Crc32c::Hash(&header_, sizeof(header_), header_.header_crc) !=
header_.header_crc) {
if (ailego::Crc32c::Hash(out, sizeof(*out), out->header_crc) !=
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

sizeof(IndexFormat::MetaHeader)容易理解

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

constexpr size_t kHeaderSize = sizeof(IndexFormat::MetaHeader);
统一成了kHeaderSize。

@iaojnh iaojnh force-pushed the feat/buffer-write branch from c63c009 to 3d15476 Compare May 29, 2026 16:06
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.

3 participants