Skip to content
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

del key #4487

Open
opt-m opened this issue Feb 22, 2024 · 2 comments
Open

del key #4487

opt-m opened this issue Feb 22, 2024 · 2 comments
Assignees

Comments

@opt-m
Copy link

opt-m commented Feb 22, 2024

FT.DROPINDEX index DD will delete key as well,but i found this delete process use del instead of unlink which cause redis block。

    DocTable *dt = &sp->docs;
    DOCTABLE_FOREACH(dt, Redis_DeleteKeyC(ctx, dmd->keyPtr));
---

int Redis_DeleteKey(RedisModuleCtx *ctx, RedisModuleString *s) {
  RedisModuleCallReply *rep = RedisModule_Call(ctx, "DEL", "s", s);
  RedisModule_Assert(RedisModule_CallReplyType(rep) == REDISMODULE_REPLY_INTEGER);
  long long res = RedisModule_CallReplyInteger(rep);
  RedisModule_FreeCallReply(rep);
  return res;
}

int Redis_DeleteKeyC(RedisModuleCtx *ctx, char *cstr) {
  RedisModuleCallReply *rep;
  if (!isCrdt) {
    rep = RedisModule_Call(ctx, "DEL", "c!", cstr);
  } else {
    rep = RedisModule_Call(ctx, "DEL", "c", cstr);
  }
  RedisModule_Assert(RedisModule_CallReplyType(rep) == REDISMODULE_REPLY_INTEGER);
  long long res = RedisModule_CallReplyInteger(rep);
  RedisModule_FreeCallReply(rep);
  return res;
}
  1. Can it be adjusted to "UNLINK" ?
  2. DOCTABLE_FOREACH will send large command to redis core , can it adjusted to batch call in async way?
@freecw
Copy link

freecw commented Feb 22, 2024

meet the same issue. It seems that the root cause is that before master deletes key, it remove spec, so it will not involve index udpate. However, when master deletes key, del is replicated to slave whose spec is still there. So slave involves index update, which is slow. And slave drag down the whole process. Maybe we can do dropindex in slave and then master. It seems it works.

Copy link

This issue is stale because it has been open for 60 days with no activity.

@github-actions github-actions bot added the stale label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants