Comments (9)
I'm trying to implement this. During my impl, I found a problem that:
- Get random set size
- Get all indices, counting the random fetching indices
- Traverse the set
The command 1-3 should be done in one snapshot, otherwise, the case might be:
- Get all indices, size == 10
- Random need to access 10th member
- User delete an element
- 10th cannot be fetched
So, GetMetadata and traversing the set should be done in one rocksdb snapshot. Would you think this is safe and ok? @git-hulk @PragmaTwice
from kvrocks.
I'm wondering if it'd be better to sacrifice the scope of the candidate set to simplify the implementation like below:
- if size <= N(e.g. 128/256), then iterate all members and randomly pick one of them.
- if size > N, random among the first N elements if the cached random point is empty. Otherwise, seek from the cached random point and then random among the next N elements, then cache the random point again or remove the cache random point if it reaches the end.
from kvrocks.
if size > N, random among the first N elements if the cached random point is empty. Otherwise, seek from the cached random point and then random among the next N elements, then cache the random point again or remove the cache random point if it reaches the end.
I thought of using this previously, and this is named "statistics" in this issue. but where should we storing this and how do updating this?
from kvrocks.
but where should we storing this and how do updating this?
We're now using a LRU to cache the iterator key while scanning the DB/hash/set, maybe we can do this in the same way.
from kvrocks.
That's a bit complex π€, in my current impl I may just need to iter the set with one snapshot...
from kvrocks.
That's a bit complex π€, in my current impl I may just need to iter the set with one snapshot...
Yes, it should be more complex than the current implementation. Then I think the implementation with the same snapshot is good.
from kvrocks.
Yeah, another point is that support get meta by snapshot can enhance our isolation. It might slightly affect LSM-Tree Garbage collection, but I think it's ok
from kvrocks.
Related Issues (20)
- Add redis query parser for RediSearch
- lua script import error HOT 5
- Add support for `flags` parameter of `redis.register_function`
- set sync option to true for WriteOptions HOT 5
- Failed to start server: rename file encounter error: Resource busy HOT 3
- subkey column family name HOT 2
- add options for set compress level HOT 2
- kvrocks2redis test scripts fail HOT 6
- Go test in macos-14 (M1) runner failed
- PubSub with Lettuce not working as expected HOT 4
- PubSub publish behaves differently with Redis in cluster mode HOT 5
- pubsub bug
- Optimization of Lua Global Locks HOT 2
- can kvrocks have a winows sln to comiple in wondows serverοΌ
- Add option to disable incremental sync in kvrocks2redis
- Add support of the command READONLY & READWRITE HOT 4
- kvrocks2redis migrate kvrocks to kvrocks-cluster
- Add support of the command ASKING HOT 5
- Introducing Get Metadata with rocksdb::Snapshot HOT 1
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.