tomp2p / TomP2P

A P2P-based high performance key-value pair storage library
http://tomp2p.net
Apache License 2.0
438 stars 122 forks source link

Method dataRemoved(locationKey) not implemented #129

Closed jaasilva closed 8 years ago

jaasilva commented 8 years ago

Method with signature public void dataRemoved(Number160 locationKey) from class net.tomp2p.replication.Replication.java is currently not implemented (it even still has the // TODO Auto-generated method stub comment on it).

This results that when issuing a remove request on a key (and using indirect replication), the key will be removed from the map, but the peer responsibilities will not be updated/removed for this key. Then, the responsible peer will continue to run the refresh for that key.

Is that a known bug?

Also, if due to configurations (routing and p2p request) I end up issuing a remove request on a peer that is not the responsible peer for the specified key, the responsible peer will never know that the key was removed and will continue to run the refresh for that key (making it reappear in the peer where the key was removed). This results that the remove request turn into something like a phantom update/remove.

Is this the expected behavior?

tbocek commented 8 years ago

I missed that, you are right. There should be a removeResponsibility when data is removed. Concerning the remove request from a different peer than the responsible peer: this is not an issue, as the routing will find the responsible peer, and the remove request will delete the data.

However, you still have the issue of phantom update/removes. If a peer was offline during the remove request and comes back online, then it starts replicating the data. You can issue the remove request multiple times to mitigate this, but there will always be a chance of phantom update/removes.

For that we have the deleted flag in Data, where you can set a tombstone, so that other peers joining will see that the data was removed.