Adding getDbSize functionality#135
Conversation
| } | ||
|
|
||
| func (bdb *badgerDB) GetKeySpaceSize() (int64, error) { | ||
| return 0, nil |
There was a problem hiding this comment.
| rpc CompareAndSet (CompareAndSetRequest) returns (CompareAndSetResponse); | ||
|
|
||
| //GetKeySpaceSize returns the estimated number of keys the db | ||
| rpc GetKeySpaceSize (google.protobuf.Empty) returns (KeySpaceSizeResponse); |
There was a problem hiding this comment.
Can be renamed to GetKeySpaceCount to avoid ambiguity between size and count, as most lsm based stores uses term size to denote mem/disk used in bytes
There was a problem hiding this comment.
IMO we should have consistency in name of the exposed command and the rpc method name.
| * This methods returns the approximate count of keys in the DKV database | ||
| * @return retunrn the count of keys | ||
| */ | ||
| long getDbSize(); |
There was a problem hiding this comment.
We don't need to add get as a prefix as its implicit that dBSize is a read-only operation
| {"removeNode", "<nexusUrl>", "Remove a master node from DKV cluster", (*cmd).removeNode, "", false}, | ||
| {"listNodes", "", "Lists the various DKV nodes that are part of the Nexus cluster", (*cmd).listNodes, "", true}, | ||
| {"getClusterInfo", "<dcId> <database> <vBucket>", "Gets the latest cluster info", (*cmd).getStatus, "", true}, | ||
| {"getDbSize", "", "Fetches the approximate count of keys in the db", (*cmd).getDbSize, "", true}, |
There was a problem hiding this comment.
Same here, let's name this as dbsize to simplify.
| // If the expected value is `nil`, then the key is created and | ||
| // initialized with the given value, atomically. | ||
| CompareAndSet(key, expect, update []byte) (bool, error) | ||
| //GetKeySpaceSize returns the estimated number of keys the db |
| } | ||
|
|
||
| func (ms *memStore) GetKeySpaceSize() (int64, error) { | ||
| return 0, nil |
There was a problem hiding this comment.
This could be the count of keys in the db.
| // Status indicates the result of the Get operation | ||
| Status status = 1; | ||
| //Estimated number of keys in the db | ||
| int64 dbSize = 2; |
| } | ||
|
|
||
| func (rdb *rocksDB) GetKeySpaceSize() (int64, error) { | ||
| defer rdb.opts.statsCli.Timing("rocksdb.property.latency.dbSize", time.Now()) |
There was a problem hiding this comment.
The metric name doesn't match function name. Let's be consistent.
| Status status = 1; | ||
| //Estimated number of keys in the db | ||
| int64 dbSize = 2; | ||
| } No newline at end of file |
There was a problem hiding this comment.
Empty line at end of file missing.
| } | ||
|
|
||
| // GetDbSize returns the approximate count of the number of the keys in the db | ||
| func (dkvClnt *DKVClient) GetDbSize() (*serverpb.KeySpaceSizeResponse, error) { |
There was a problem hiding this comment.
Could be better named as DBSize
|
|
||
| @Override | ||
| public long getDbSize() { | ||
| //TODO: implement this behaviour |
There was a problem hiding this comment.
Probably this shouldn't even be exposed to java client unless its an exact value.
| rpc CompareAndSet (CompareAndSetRequest) returns (CompareAndSetResponse); | ||
|
|
||
| //GetKeySpaceSize returns the estimated number of keys the db | ||
| rpc GetKeySpaceSize (google.protobuf.Empty) returns (KeySpaceSizeResponse); |
There was a problem hiding this comment.
IMO we should have consistency in name of the exposed command and the rpc method name.
No description provided.