Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list容量的问题,极端情况下,一直rpush,并且lpop, 可能list只有几个元素,但是却无法rpush新的元素 #1404

Closed
lqxhub opened this issue Jul 31, 2021 · 1 comment

Comments

@lqxhub
Copy link

lqxhub commented Jul 31, 2021

const uint64_t QFRONT_SEQ = 2;
const uint64_t QBACK_SEQ  = 3;
const uint64_t QITEM_MIN_SEQ = 10000;
const uint64_t QITEM_MAX_SEQ = 9223372036854775807ULL;
const uint64_t QITEM_SEQ_INIT = QITEM_MAX_SEQ/2;

我在 t_queue.h 文件中看到了这些定义, list在leveldb中是通过seq计算list元素中的位置的, 极端情况下 一直rpush,并且lpop, 最后可能list中只有很少的几个元素, 但是seq已经到了 max值, 导致 list无法rpush

@ideawu
Copy link
Owner

ideawu commented Aug 1, 2021

你的理论分析得很对, 但实践上不可能遇到, 因为63位整数在所有能想到的实际场景中永远不会被用完.

@ideawu ideawu closed this as completed Aug 1, 2021
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

No branches or pull requests

2 participants