Fix TSAN race in log throttler After adding new log throttling code, some tests became flaky in TSAN. This should fix the warnings by annotating the benign race.
Change-Id: Iabc063435e7f5c4f33ca1f195bf1920044a7913a Reviewed-on: http://gerrit.cloudera.org:8080/4324 Tested-by: Kudu Jenkins Reviewed-by: Mike Percy <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/94ec3d51 Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/94ec3d51 Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/94ec3d51 Branch: refs/heads/master Commit: 94ec3d515261b877617460be07f1639d2ef17f85 Parents: 859cf31 Author: Todd Lipcon <[email protected]> Authored: Wed Sep 7 08:56:42 2016 -0700 Committer: Todd Lipcon <[email protected]> Committed: Wed Sep 7 18:47:36 2016 +0000 ---------------------------------------------------------------------- src/kudu/util/logging.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/94ec3d51/src/kudu/util/logging.h ---------------------------------------------------------------------- diff --git a/src/kudu/util/logging.h b/src/kudu/util/logging.h index 78fdf0b..48234be 100644 --- a/src/kudu/util/logging.h +++ b/src/kudu/util/logging.h @@ -223,7 +223,7 @@ namespace logging { class LogThrottler { public: LogThrottler() : num_suppressed_(0), last_ts_(0), last_tag_(nullptr) { - ANNOTATE_BENIGN_RACE(&last_ts_, "OK to be sloppy with log throttling"); + ANNOTATE_BENIGN_RACE_SIZED(this, sizeof(*this), "OK to be sloppy with log throttling"); } bool ShouldLog(int n_secs, const char* tag, int* num_suppressed) {
