db,view: remove duplicate entries from the list of target endpoints

If a list of target endpoints for sending view updates contains
duplicates, it results in benign (but annoying) broken promise
errors happening due to duplicated write response handlers being
instantiated for a single endpoint.
In order to avoid such errors, target remote endpoints are deduplicated
from the list of pending endpoints.
A similar issue (#5459) solved the case for duplicated local endpoints,
but that didn't solve the general case.

Fixes #7572

Closes #7641

(cherry picked from commit c0d72b4491)
This commit is contained in:
Piotr Sarna
2020-11-18 11:04:30 +01:00
committed by Avi Kivity
parent 9c7ff01c5d
commit 1ec4f50e3c

View File

@@ -1241,6 +1241,14 @@ future<> mutate_MV(
}
}
}
// It's still possible that a target endpoint is dupliated in the remote endpoints list,
// so let's get rid of the duplicate if it exists
if (target_endpoint) {
auto remote_it = std::find(remote_endpoints.begin(), remote_endpoints.end(), *target_endpoint);
if (remote_it != remote_endpoints.end()) {
remote_endpoints.erase(remote_it);
}
}
if (target_endpoint && *target_endpoint == my_address) {
++stats.view_updates_pushed_local;