HFE to support AOF and replicas#13285
Conversation
I will handle it on the next commit. |
| /* Delete all the expired fields in one go */ | ||
| if (r.expired > 0) | ||
| lpt->lp = lpDeleteRange(lpt->lp, 0, r.expired * 3); | ||
| ptr = lpNext(lpt->lp, ptr); |
There was a problem hiding this comment.
Just a note to all of us, maybe we can implement this logic with lpFindCb() in future to avoid performance cost of lpNext() calls.
| int isHashDeleted; | ||
| int exists = hashTypeExists(key->db, key->value, field->ptr, &isHashDeleted); | ||
| /* hash-field-expiration is not exposed to modules */ | ||
| serverAssert(isHashDeleted == 0); |
There was a problem hiding this comment.
if i use hexpire command to create a hash with TTL fields, then operate the hash with RM_HashSet, will thia assertion be triggered?
There was a problem hiding this comment.
Regarding this matter, I am seeking input from those experienced with modules:
- We likely need to pass the mode/flags of the opened key and respond appropriately.
- Should we update the opened key if the key was deleted due to last field expiration?
@MeirShpilraien, perhaps you can assist. Thanks.
| shared.hdel, | ||
| createStringObject((char*) key, sdslen(key)), | ||
| createStringObject(field, fieldLen) | ||
| }; |
There was a problem hiding this comment.
Note: Later, maybe we can add a check to avoid creating these objects if we are not going to propagate anything.
* For replica sake, rewrite commands `H*EXPIRE*` , `HSETF`, `HGETF` to have absolute unix time in msec. * On active-expiration of field, propagate HDEL to replica (`propagateHashFieldDeletion()`) * On lazy-expiration, propagate HDEL to replica (`hashTypeGetValue()` now calls `hashTypeDelete()`. It also takes care to call `propagateHashFieldDeletion()`). * Fix `H*EXPIRE*` command such that if it gets flag `LT` and it doesn’t have any expiration on the field then it will considered as valid condition. Note, replicas doesn’t make any active expiration, and should avoid lazy expiration. On `hashTypeGetValue()` it doesn't check expiration (As long as the master didn’t request to delete the field, it is valid) TODO: * Attach `dbid` to HASH metadata. See [here](redis#13209 (comment)) --------- Co-authored-by: debing.sun <[email protected]>
H*EXPIRE*,HSETF,HGETFto have absolute unix time in msec.propagateHashFieldDeletion())hashTypeGetValue()now callshashTypeDelete(). It also takes care to callpropagateHashFieldDeletion()).H*EXPIRE*command such that if it gets flagLTand it doesn’t have any expiration on the field then it will considered as valid condition.Note, replicas doesn’t make any active expiration, and should avoid lazy expiration. On
hashTypeGetValue()it doesn't check expiration (As long as the master didn’t request to delete the field, it is valid)TODO:
dbidto HASH metadata. See here