Andrew Wong has submitted this change and it was merged. (
http://gerrit.cloudera.org:8080/14287 )
Change subject: KUDU-2952: fix TOCTOU race in reporting stats
......................................................................
KUDU-2952: fix TOCTOU race in reporting stats
It was possible for the following race to occur:
During CreateReportedTabletPB() as a follower:
1. T1 Get consensus state.
2. T1 Serialize the ConsensusStatePB under lock -- we are not the
leader.
3. T2 Become the leader.
4. T1 Check if we're leader so that we can generate stats. This check
succeeds.
5. T1 Populate the stats.
6. Our tablet report now contains stats even though the consensus state
says we aren't the leader.
7. F0924 00:08:46.821594 9670 catalog_manager.cc:4239] Check failed:
ts_desc->permanent_uuid() == report.consensus_state().leader_uuid()
This addresses this by checking leadership from the serialized consensus
state and adds a test that would fail pretty consistently without this
patch.
Change-Id: I29fe63cb42c82a08a4811d42b244abeb2fa86bd9
Reviewed-on: http://gerrit.cloudera.org:8080/14287
Reviewed-by: Adar Dembo <[email protected]>
Reviewed-by: Alexey Serbin <[email protected]>
Tested-by: Kudu Jenkins
---
M src/kudu/integration-tests/ts_tablet_manager-itest.cc
M src/kudu/tserver/ts_tablet_manager.cc
M src/kudu/tserver/ts_tablet_manager.h
3 files changed, 55 insertions(+), 17 deletions(-)
Approvals:
Adar Dembo: Looks good to me, approved
Alexey Serbin: Looks good to me, approved
Kudu Jenkins: Verified
--
To view, visit http://gerrit.cloudera.org:8080/14287
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I29fe63cb42c82a08a4811d42b244abeb2fa86bd9
Gerrit-Change-Number: 14287
Gerrit-PatchSet: 5
Gerrit-Owner: Andrew Wong <[email protected]>
Gerrit-Reviewer: Adar Dembo <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Andrew Wong <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <[email protected]>