IMPALA-5031: Fix use of uninitialised var in SendTopicUpdate() When SendTopicUpdate() returns an error, it does not set update_skipped, so the variable is uninitialised. This means that the duration between topic updates will depend on the uninitialised value.
Change-Id: I373c6f65854244fe90889412b38b0260fe1d1f13 Reviewed-on: http://gerrit.cloudera.org:8080/11957 Reviewed-by: Tim Armstrong <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/impala/repo Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/a78a8d62 Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/a78a8d62 Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/a78a8d62 Branch: refs/heads/master Commit: a78a8d62ae7a7fe6800c4eec93eed0e082a3ff07 Parents: 09c2514 Author: Tim Armstrong <[email protected]> Authored: Mon Nov 19 11:52:00 2018 -0800 Committer: Impala Public Jenkins <[email protected]> Committed: Tue Nov 20 01:50:58 2018 +0000 ---------------------------------------------------------------------- be/src/statestore/statestore.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/impala/blob/a78a8d62/be/src/statestore/statestore.cc ---------------------------------------------------------------------- diff --git a/be/src/statestore/statestore.cc b/be/src/statestore/statestore.cc index 70183d7..234c63c 100644 --- a/be/src/statestore/statestore.cc +++ b/be/src/statestore/statestore.cc @@ -930,7 +930,9 @@ void Statestore::DoSubscriberUpdate(UpdateKind update_kind, int thread_id, deadline_ms = UnixMillis() + FLAGS_statestore_heartbeat_frequency_ms; } else { - bool update_skipped; + // Initialize to false so that we don't consider the update skipped when + // SendTopicUpdate() fails. + bool update_skipped = false; status = SendTopicUpdate(subscriber.get(), update_kind, &update_skipped); if (status.code() == TErrorCode::RPC_RECV_TIMEOUT) { // Add details to status to make it more useful, while preserving the stack
