pinterest/pymemcache

Delete key from every node

Nerdyvedi opened this issue · 9 comments

Hi, I am trying to ensure there's 0 possibility of having stale data with a particular key.
I am trying to solve this problem for the following scenario:

  • key1 is mapped to Node 1.
  • I delete key1 as it's now stale
  • Node 1 goes down
  • key1 is set again with new value, This time on Node 2(as Node 1 is down)
  • Node is back up
  • I want to delete key1, but don't have anything to delete on Node 1.

Now, if Node 1 goes down again, there is a possibility that I return data from Node 2 , which is stale.

jogo commented

Hi @Nerdyvedi, if you think this is a bug in pymemcache mind sharing the steps to reproduce the issue?

@jogo , Don't think it's a bug. I want to know if there's a feature that could allow me to delete key from a specific server?

jogo commented

@jogo , Don't think it's a bug. I want to know if there's a feature that could allow me to delete key from a specific server?

got it, it depends on which specific client you are using. For the HashClient you can find all the individual clients in self.clients

And let's say I want to delete a key from each server, I'll iterate through each client and call delete ?

@jogo At this moment thr _run_cmd function takes in the cmd and the key.
It then find the client from the key, and then runs the command.

There is no public function I can access that would allow me to delete key from specific client

Do you think it makes sense to create a function something like delete_from_client, and pass in the client we want to delete the key from?

jogo commented

can you just do something like?

for client in my_hash_client.clients:
    client.delete(...)

Got it, Thanks. Client has a delete function itself.

@jogo Is there a way I can delete from individual clients using the builtin RetryingClient module?