-
Notifications
You must be signed in to change notification settings - Fork 173
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
dump all keys; count size of all/subset of keys based on prefix #150
base: master
Are you sure you want to change the base?
Conversation
re: race condition, could we do what Redis does for saving (a fork and copy-on-write)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add tests
src/storage/slab/item.c
Outdated
} | ||
|
||
bool | ||
item_dump(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not receive a prefix here as well?
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
727905b adding a new API to duration timer (twitter#152) 9406717 add missing "extern C" qualifiers to a few headers for C++ linking; (twitter#150) a0aafdf Add missing semicolon to ring array example code in documentation. (twitter#149) 9264bbb Zero byte (twitter#147) (emergency fix needed for pelikan) d4002d7 simplify cc_print_int64 (twitter#146) b164fcf Clean-up hash functions and introduce MurmurHash3 (twitter#145) b1babb2 change wheel's sleep timer to make it less flaky (twitter#143) ce0b9ea allow printing negative integers in cc_print (twitter#141) ab0edc8 add metrics to track buf_sock objects (twitter#138) ae02038 add travis ci (copied from pelikan) (twitter#139) 964645a Merge pull request twitter#135 from paegun/fix_cmake_install 70710c2 fixed and re-added cmake install instructions, w/ following notes: include directory made proper relative; opened pattern match b/c include directory should only contain files meant for inclusion. 5b095bc Merge pull request twitter#126 from kevyang/kevyang/120 426d56a return NULL when cc_alloc/cc_realloc is called with size == 0 ad271d4 Merge pull request twitter#133 from kevyang/132 47dbdba suppress unused parameter warning in debug_log_flush 648d19e Merge pull request twitter#127 from kevyang/56 780941a Merge pull request twitter#130 from kevyang/129 b8af6c0 Merge pull request twitter#131 from kevyang/128 6ecc318 fix duplicate symbols in cc_signal 080c41d cc_array - stop doing arithmetic on void * d526f7a add debug oriented memory management a4fb927 Update bool member rules in style guide 05c6e1e explicitly make ccommon a C project to avoid checking for CXX related variables git-subtree-dir: deps/ccommon git-subtree-split: 727905b
727905b adding a new API to duration timer (#152) 9406717 add missing "extern C" qualifiers to a few headers for C++ linking; (#150) a0aafdf Add missing semicolon to ring array example code in documentation. (#149) 9264bbb Zero byte (#147) (emergency fix needed for pelikan) d4002d7 simplify cc_print_int64 (#146) b164fcf Clean-up hash functions and introduce MurmurHash3 (#145) b1babb2 change wheel's sleep timer to make it less flaky (#143) ce0b9ea allow printing negative integers in cc_print (#141) ab0edc8 add metrics to track buf_sock objects (#138) ae02038 add travis ci (copied from pelikan) (#139) 964645a Merge pull request #135 from paegun/fix_cmake_install 70710c2 fixed and re-added cmake install instructions, w/ following notes: include directory made proper relative; opened pattern match b/c include directory should only contain files meant for inclusion. 5b095bc Merge pull request #126 from kevyang/kevyang/120 426d56a return NULL when cc_alloc/cc_realloc is called with size == 0 ad271d4 Merge pull request #133 from kevyang/132 47dbdba suppress unused parameter warning in debug_log_flush 648d19e Merge pull request #127 from kevyang/56 780941a Merge pull request #130 from kevyang/129 b8af6c0 Merge pull request #131 from kevyang/128 6ecc318 fix duplicate symbols in cc_signal 080c41d cc_array - stop doing arithmetic on void * d526f7a add debug oriented memory management a4fb927 Update bool member rules in style guide 05c6e1e explicitly make ccommon a C project to avoid checking for CXX related variables git-subtree-dir: deps/ccommon git-subtree-split: 727905b
dd56abd break up ASSERT in buf_sock_read (twitter#153) 727905b adding a new API to duration timer (twitter#152) 9406717 add missing "extern C" qualifiers to a few headers for C++ linking; (twitter#150) a0aafdf Add missing semicolon to ring array example code in documentation. (twitter#149) 9264bbb Zero byte (twitter#147) (emergency fix needed for pelikan) d4002d7 simplify cc_print_int64 (twitter#146) b164fcf Clean-up hash functions and introduce MurmurHash3 (twitter#145) b1babb2 change wheel's sleep timer to make it less flaky (twitter#143) ce0b9ea allow printing negative integers in cc_print (twitter#141) ab0edc8 add metrics to track buf_sock objects (twitter#138) ae02038 add travis ci (copied from pelikan) (twitter#139) 964645a Merge pull request twitter#135 from paegun/fix_cmake_install 70710c2 fixed and re-added cmake install instructions, w/ following notes: include directory made proper relative; opened pattern match b/c include directory should only contain files meant for inclusion. 5b095bc Merge pull request twitter#126 from kevyang/kevyang/120 426d56a return NULL when cc_alloc/cc_realloc is called with size == 0 ad271d4 Merge pull request twitter#133 from kevyang/132 47dbdba suppress unused parameter warning in debug_log_flush 648d19e Merge pull request twitter#127 from kevyang/56 780941a Merge pull request twitter#130 from kevyang/129 b8af6c0 Merge pull request twitter#131 from kevyang/128 6ecc318 fix duplicate symbols in cc_signal 080c41d cc_array - stop doing arithmetic on void * d526f7a add debug oriented memory management a4fb927 Update bool member rules in style guide 05c6e1e explicitly make ccommon a C project to avoid checking for CXX related variables git-subtree-dir: deps/ccommon git-subtree-split: dd56abd
* consolidate code a bit * Squashed 'deps/ccommon/' changes from bb298bc..dd56abd dd56abd break up ASSERT in buf_sock_read (#153) 727905b adding a new API to duration timer (#152) 9406717 add missing "extern C" qualifiers to a few headers for C++ linking; (#150) a0aafdf Add missing semicolon to ring array example code in documentation. (#149) 9264bbb Zero byte (#147) (emergency fix needed for pelikan) d4002d7 simplify cc_print_int64 (#146) b164fcf Clean-up hash functions and introduce MurmurHash3 (#145) b1babb2 change wheel's sleep timer to make it less flaky (#143) ce0b9ea allow printing negative integers in cc_print (#141) ab0edc8 add metrics to track buf_sock objects (#138) ae02038 add travis ci (copied from pelikan) (#139) 964645a Merge pull request #135 from paegun/fix_cmake_install 70710c2 fixed and re-added cmake install instructions, w/ following notes: include directory made proper relative; opened pattern match b/c include directory should only contain files meant for inclusion. 5b095bc Merge pull request #126 from kevyang/kevyang/120 426d56a return NULL when cc_alloc/cc_realloc is called with size == 0 ad271d4 Merge pull request #133 from kevyang/132 47dbdba suppress unused parameter warning in debug_log_flush 648d19e Merge pull request #127 from kevyang/56 780941a Merge pull request #130 from kevyang/129 b8af6c0 Merge pull request #131 from kevyang/128 6ecc318 fix duplicate symbols in cc_signal 080c41d cc_array - stop doing arithmetic on void * d526f7a add debug oriented memory management a4fb927 Update bool member rules in style guide 05c6e1e explicitly make ccommon a C project to avoid checking for CXX related variables git-subtree-dir: deps/ccommon git-subtree-split: dd56abd
a2d5c01 add a function that will reject all pending incoming connections (twitter#154) dd56abd break up ASSERT in buf_sock_read (twitter#153) 727905b adding a new API to duration timer (twitter#152) 9406717 add missing "extern C" qualifiers to a few headers for C++ linking; (twitter#150) a0aafdf Add missing semicolon to ring array example code in documentation. (twitter#149) 9264bbb Zero byte (twitter#147) (emergency fix needed for pelikan) d4002d7 simplify cc_print_int64 (twitter#146) b164fcf Clean-up hash functions and introduce MurmurHash3 (twitter#145) b1babb2 change wheel's sleep timer to make it less flaky (twitter#143) ce0b9ea allow printing negative integers in cc_print (twitter#141) ab0edc8 add metrics to track buf_sock objects (twitter#138) ae02038 add travis ci (copied from pelikan) (twitter#139) 964645a Merge pull request twitter#135 from paegun/fix_cmake_install 70710c2 fixed and re-added cmake install instructions, w/ following notes: include directory made proper relative; opened pattern match b/c include directory should only contain files meant for inclusion. 5b095bc Merge pull request twitter#126 from kevyang/kevyang/120 426d56a return NULL when cc_alloc/cc_realloc is called with size == 0 ad271d4 Merge pull request twitter#133 from kevyang/132 47dbdba suppress unused parameter warning in debug_log_flush 648d19e Merge pull request twitter#127 from kevyang/56 780941a Merge pull request twitter#130 from kevyang/129 b8af6c0 Merge pull request twitter#131 from kevyang/128 6ecc318 fix duplicate symbols in cc_signal 080c41d cc_array - stop doing arithmetic on void * d526f7a add debug oriented memory management a4fb927 Update bool member rules in style guide 05c6e1e explicitly make ccommon a C project to avoid checking for CXX related variables git-subtree-dir: deps/ccommon git-subtree-split: a2d5c01
6b59401 Rust build tweak (twitter#165) b39086d fix docs to new ring_array_destroy semantics (twitter#163) 95e04b0 Additional ring_array API (twitter#159) 3c994cc a single job in the travis-ci matrix for building with rust enabled (twitter#161) 1fe907e rust support - Native bstrings (twitter#160) b3de2ee add HAVE_RUST option defaulted to off (twitter#158) ffc70a8 Port travis ci changes - closes twitter#186 (twitter#155) a2d5c01 add a function that will reject all pending incoming connections (twitter#154) dd56abd break up ASSERT in buf_sock_read (twitter#153) 727905b adding a new API to duration timer (twitter#152) 9406717 add missing "extern C" qualifiers to a few headers for C++ linking; (twitter#150) a0aafdf Add missing semicolon to ring array example code in documentation. (twitter#149) 9264bbb Zero byte (twitter#147) (emergency fix needed for pelikan) d4002d7 simplify cc_print_int64 (twitter#146) b164fcf Clean-up hash functions and introduce MurmurHash3 (twitter#145) b1babb2 change wheel's sleep timer to make it less flaky (twitter#143) ce0b9ea allow printing negative integers in cc_print (twitter#141) ab0edc8 add metrics to track buf_sock objects (twitter#138) ae02038 add travis ci (copied from pelikan) (twitter#139) 964645a Merge pull request twitter#135 from paegun/fix_cmake_install 70710c2 fixed and re-added cmake install instructions, w/ following notes: include directory made proper relative; opened pattern match b/c include directory should only contain files meant for inclusion. 5b095bc Merge pull request twitter#126 from kevyang/kevyang/120 426d56a return NULL when cc_alloc/cc_realloc is called with size == 0 ad271d4 Merge pull request twitter#133 from kevyang/132 47dbdba suppress unused parameter warning in debug_log_flush 648d19e Merge pull request twitter#127 from kevyang/56 780941a Merge pull request twitter#130 from kevyang/129 b8af6c0 Merge pull request twitter#131 from kevyang/128 6ecc318 fix duplicate symbols in cc_signal 080c41d cc_array - stop doing arithmetic on void * d526f7a add debug oriented memory management a4fb927 Update bool member rules in style guide 05c6e1e explicitly make ccommon a C project to avoid checking for CXX related variables git-subtree-dir: deps/ccommon git-subtree-split: 6b59401
f5efe29 forgot to remove unused include (#167) 441934b update ring_array docs for new API, add multi threaded unit test for ring_array (#166) 67ce9c2 Adding issue and pull request templates to comply with twitter OSS policies (#151) 6b59401 Rust build tweak (#165) b39086d fix docs to new ring_array_destroy semantics (#163) 95e04b0 Additional ring_array API (#159) 3c994cc a single job in the travis-ci matrix for building with rust enabled (#161) 1fe907e rust support - Native bstrings (#160) b3de2ee add HAVE_RUST option defaulted to off (#158) ffc70a8 Port travis ci changes - closes #186 (#155) a2d5c01 add a function that will reject all pending incoming connections (#154) dd56abd break up ASSERT in buf_sock_read (#153) 727905b adding a new API to duration timer (#152) 9406717 add missing "extern C" qualifiers to a few headers for C++ linking; (#150) a0aafdf Add missing semicolon to ring array example code in documentation. (#149) 9264bbb Zero byte (#147) (emergency fix needed for pelikan) d4002d7 simplify cc_print_int64 (#146) b164fcf Clean-up hash functions and introduce MurmurHash3 (#145) b1babb2 change wheel's sleep timer to make it less flaky (#143) ce0b9ea allow printing negative integers in cc_print (#141) ab0edc8 add metrics to track buf_sock objects (#138) ae02038 add travis ci (copied from pelikan) (#139) 964645a Merge pull request #135 from paegun/fix_cmake_install 70710c2 fixed and re-added cmake install instructions, w/ following notes: include directory made proper relative; opened pattern match b/c include directory should only contain files meant for inclusion. 5b095bc Merge pull request #126 from kevyang/kevyang/120 426d56a return NULL when cc_alloc/cc_realloc is called with size == 0 ad271d4 Merge pull request #133 from kevyang/132 47dbdba suppress unused parameter warning in debug_log_flush 648d19e Merge pull request #127 from kevyang/56 780941a Merge pull request #130 from kevyang/129 b8af6c0 Merge pull request #131 from kevyang/128 6ecc318 fix duplicate symbols in cc_signal 080c41d cc_array - stop doing arithmetic on void * d526f7a add debug oriented memory management a4fb927 Update bool member rules in style guide 05c6e1e explicitly make ccommon a C project to avoid checking for CXX related variables git-subtree-dir: deps/ccommon git-subtree-split: f5efe29
src/storage/slab/item.c
Outdated
struct item *it; | ||
|
||
SLIST_FOREACH(it, entry, i_sle) { | ||
if (write(fd, item_key(it), it->klen) < it->klen) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would we also want to check for expiry?
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really sure how this can work without interfering with the worker thread; i am probably missing something. can you offer some insights here? possibly comment the explanation somewhere?
edit: nvm, just read your comment above.
…izes in addition to counts & total sizes
…witter#150) fix a few typos/style deviations
Yao Yue seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
I got a request to find out how many keys there are in cache that belong to a particular dataset (represented by a specific prefix). I thought about it for a bit and realized this feature might be generally useful to perform a total key dump for analysis or get an dataset level overview of the cache, so I checked this code it.
Not sure if this is ready for merge at this point: big issue is thread-safety. Since we perform the scanning on the admin thread, to avoid reading dirty keys (keys that are being updated by the worker thread) requires some kind of locking/synchronization. This we can do rather cheaply by using an atomic instruction to let worker thread alter a flag when an hashbucket is being actively modified, and having the admin thread blocked if it runs into a dirty hashtable entry. But the one-off usage I'm asked to provide can be done on a staging host after live traffic is shut off, so it doesn't seem to warrant the extra rigor for now.
I just want to have a place where this feature is visible/checked in.