Comments (10)
Without additional indexing, such query is quite inefficient: it will probably trigger a full namespace scanning.
I'm not sure if we should add them without any option to control the behavior.
from kvrocks.
@iushas Thanks for your feedback!
from kvrocks.
Without additional indexing, such query is quite inefficient: it will probably trigger a full namespace scanning.
If there are too many scans, we can return early before filling up the list. The indication of the end of a SCAN is cursor 0, not the list count matching the desired number.
from kvrocks.
Perhaps you misunderstood my point.
For instance, if a user inputs the pattern string *hehehehe
, it may search through all keys in the database without finding any matches.
Iterating through all keys in the database can be time-consuming, leading to inconsistent execution times for this command.
from kvrocks.
I means we can do this:
redis 127.0.0.1:6379> SCAN key 0 match *hehe
1) "17"
2) (empty list or set)
redis 127.0.0.1:6379> SCAN key 17 match *hehe
1) "21"
2) (empty list or set)
redis 127.0.0.1:6379> SCAN key 21 match *hehe
1) "0"
2) 1) "xxhehe"
We can set a max scan keys num if more than this num directly returns the empty list.
from kvrocks.
I'm a beginner programmer and I'd like to try tackling this "good first issue", but I'm uncertain about how to get started with this project. Could you provide some advice on reading the source code, such as parts I might need to modify, as well as information I need to know about the Redis SCAN syntax (or any relevant resources)?
from kvrocks.
Hi @baobaomaomeng thank you!
You can read Redis DOC and get Redis SCAN syntax.
You can read the code from CommandScan.
We have 4 types of scan commands: SCAN, HSCAN, SSCAN and ZSCAN, you can fix SCAN first.
If you have any other problem, please ask me.
from kvrocks.
Hi @baobaomaomeng thank you! You can read Redis DOC and get Redis SCAN syntax. You can read the code from CommandScan.
We have 4 types of scan commands: SCAN, HSCAN, SSCAN and ZSCAN, you can fix SCAN first.
If you have any other problem, please ask me.
I have some ideas on how to add this feature, but before getting started, I would like to seek your advice. I plan to first modify the SCAN operator, and I will modify the ParseMatchAndCountParam code in the common base class CommandScanBase. Then, I noticed that the redis::Database::scan function is called in execute, and the iter->key().starts_with used in scan is to determine whether it is a prefix match. I need to change this part, but I am not sure what would be the best way to do it. Because I need to know whether I want prefix matching, suffix matching, or (key) pattern matching. I am not sure whether I should add a parameter to this function to determine which match I need, but I feel that this is not elegant enough. Perhaps a better way is to turn it into a template function, pass the scan judgment function through the template, and add a pointer to the function in CommandScanBase, similar to templaterocksdb::Status Database::Scan(), and then determine in ParseMatchAndCountParam which scan function needs to be used.
from kvrocks.
I have added substring matching and suffix matching for the scan operation, and have done some simple self-tests. Now I want to write some test cases for it, but I don't know how to add tests for it in Go. I want to know if there are any documents or resources that can help me. In addition, I hope you can assign this good first issue to me.
from kvrocks.
Related Issues (20)
- Add support of the command READONLY & READWRITE HOT 4
- kvrocks2redis migrate kvrocks to kvrocks-cluster
- Add support of the command ASKING HOT 7
- Introducing Get Metadata with rocksdb::Snapshot HOT 1
- JSON.SET cant add a new field HOT 3
- kvrocks2redis can't sync flush commands HOT 5
- The slave of the kvrocks cluster failed to synchronize data from the master HOT 3
- Add support of the XAUTOCLAIM command HOT 4
- Add support of the command CLUSTER RESET
- CLUSTERX SETNODES - ERR Slot is out of range HOT 2
- KVRocks cluster does not support failover. HOT 2
- Reduce the number of write buffers for infrequently used column families HOT 9
- Memory issue of kvrocks2redis detected by ASan/TSan HOT 12
- Don't allow to import the cluster slot which belongs to itself
- Add support FT (Searching and querying Redis data) HOT 1
- Check iterator status after quit loop HOT 5
- Fix GetOptions initializer to make it valid in C++17 HOT 1
- Slave does not sync key updates during downtime after restart HOT 8
- error: unused variable ‘_’ [-Werror=unused-variable]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kvrocks.