数据结构WriteRequest的size为64字节时assert才会成功
Open
discussion
- Dominant language
- C++
- Stars
- 17.6k
- Forks
- 4.1k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 69
Description
不同的处理器架构下,cacheline的size不一定都是64字节。
src/brpc/socket.cpp文件:
将代码
BAIDU_CASSERT(sizeof(WriteRequest) == 64, sizeof_write_request_is_64);
改成
BAIDU_CASSERT(sizeof(WriteRequest) == BAIDU_CACHELINE_SIZE, sizeof_write_request_is_cacheline_size);
是否更合适。
Contributor guide
Research direction
Open src/brpc/socket.cpp and inspect the WriteRequest size assertion; then check how BAIDU_CACHELINE_SIZE is defined for supported architectures. Done means the assertion uses the cache-line-size constant and the project builds successfully with the change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100