You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Alexey Serbin (Code Review)" <ge...@cloudera.org> on 2026/10/28 02:22:48 UTC

[kudu-CR] [consensus] relax mem ordering on withhold votes until

Alexey Serbin has uploaded this change for review. ( http://gerrit.cloudera.org:8080/25229


Change subject: [consensus] relax mem ordering on withhold_votes_until_
......................................................................

[consensus] relax mem ordering on withhold_votes_until_

Relax memory ordering for atomic operations on 'withhold_votes_until_'
in the RaftConsensus implementation: it's enough to have
memory_order_release/memory_order_acquire for store/load operations,
and memory_order_release/memory_order_relaxed on compare_exchange_weak()
at RaftConsensus::WithholdVotes().  Also, use more lightweight approach
for computing the updated value for the 'withhold_votes_until_' field
when compare_exchange_weak() fails spuriously.

Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
---
M src/kudu/consensus/raft_consensus.cc
1 file changed, 37 insertions(+), 12 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/29/25229/1
-- 
To view, visit http://gerrit.cloudera.org:8080/25229
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
Gerrit-Change-Number: 25229
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <al...@apache.org>

[kudu-CR] [consensus] relax mem ordering on withhold votes until

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/25229 )

Change subject: [consensus] relax mem ordering on withhold_votes_until_
......................................................................


Patch Set 1: Verified+1

unrelated failure of known flaky Java test org.apache.kudu.spark.kudu.DefaultSourceTest in TSAN build


-- 
To view, visit http://gerrit.cloudera.org:8080/25229
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
Gerrit-Change-Number: 25229
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Zoltan Martonka <zm...@cloudera.com>
Gerrit-Comment-Date: Wed, 28 Oct 2026 03:46:11 +0000
Gerrit-HasComments: No

[kudu-CR] [consensus] relax mem ordering on withhold votes until

Posted by "Kudu Jenkins (Code Review)" <ge...@cloudera.org>.
Kudu Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/25229 )

Change subject: [consensus] relax mem ordering on withhold_votes_until_
......................................................................


Patch Set 2:

Build Started http://jenkins.kudu.apache.org/job/pre_commit/3196/


-- 
To view, visit http://gerrit.cloudera.org:8080/25229
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
Gerrit-Change-Number: 25229
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Zoltan Martonka <zm...@cloudera.com>
Gerrit-Comment-Date: Wed, 28 Oct 2026 16:42:20 +0000
Gerrit-HasComments: No

[kudu-CR] [consensus] relax mem ordering on withhold votes until

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/25229 )

Change subject: [consensus] relax mem ordering on withhold_votes_until_
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/25229/1/src/kudu/consensus/raft_consensus.cc
File src/kudu/consensus/raft_consensus.cc:

http://gerrit.cloudera.org:8080/#/c/25229/1/src/kudu/consensus/raft_consensus.cc@3048
PS1, Line 3048:   // timeout heartbeat is many orders of magnitude longer than kRetryDelta.
> I'm just wondering given that kRetryDelta is orders of magnitude below the 
It's a very good point -- given network latency and the Raft election timeout, we can safely get rid of this delta.

Thanks!



-- 
To view, visit http://gerrit.cloudera.org:8080/25229
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
Gerrit-Change-Number: 25229
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Zoltan Martonka <zm...@cloudera.com>
Gerrit-Comment-Date: Wed, 28 Oct 2026 16:45:45 +0000
Gerrit-HasComments: Yes

[kudu-CR] [consensus] relax mem ordering on withhold votes until

Posted by "Marton Greber (Code Review)" <ge...@cloudera.org>.
Marton Greber has posted comments on this change. ( http://gerrit.cloudera.org:8080/25229 )

Change subject: [consensus] relax mem ordering on withhold_votes_until_
......................................................................


Patch Set 2: Code-Review+2


-- 
To view, visit http://gerrit.cloudera.org:8080/25229
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
Gerrit-Change-Number: 25229
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Zoltan Martonka <zm...@cloudera.com>
Gerrit-Comment-Date: Thu, 29 Oct 2026 11:39:09 +0000
Gerrit-HasComments: No

[kudu-CR] [consensus] relax mem ordering on withhold votes until

Posted by "Kudu Jenkins (Code Review)" <ge...@cloudera.org>.
Kudu Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/25229 )

Change subject: [consensus] relax mem ordering on withhold_votes_until_
......................................................................


Patch Set 2: Verified-1

Build Failed 

http://jenkins.kudu.apache.org/job/pre_commit/3196/ : FAILURE


-- 
To view, visit http://gerrit.cloudera.org:8080/25229
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
Gerrit-Change-Number: 25229
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Zoltan Martonka <zm...@cloudera.com>
Gerrit-Comment-Date: Wed, 28 Oct 2026 17:28:40 +0000
Gerrit-HasComments: No

[kudu-CR] [consensus] relax mem ordering on withhold votes until

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has removed a vote on this change.

Change subject: [consensus] relax mem ordering on withhold_votes_until_
......................................................................


Removed Verified-1 by Kudu Jenkins (120)
-- 
To view, visit http://gerrit.cloudera.org:8080/25229
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: deleteVote
Gerrit-Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
Gerrit-Change-Number: 25229
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Zoltan Martonka <zm...@cloudera.com>

[kudu-CR] [consensus] relax mem ordering on withhold votes until

Posted by "Kudu Jenkins (Code Review)" <ge...@cloudera.org>.
Kudu Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/25229 )

Change subject: [consensus] relax mem ordering on withhold_votes_until_
......................................................................


Patch Set 1:

Build Started http://jenkins.kudu.apache.org/job/pre_commit/3190/


-- 
To view, visit http://gerrit.cloudera.org:8080/25229
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
Gerrit-Change-Number: 25229
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Comment-Date: Wed, 28 Oct 2026 02:22:57 +0000
Gerrit-HasComments: No

[kudu-CR] [consensus] relax mem ordering on withhold votes until

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/25229 )

Change subject: [consensus] relax mem ordering on withhold_votes_until_
......................................................................

[consensus] relax mem ordering on withhold_votes_until_

Relax memory ordering for atomic operations on 'withhold_votes_until_'
in the RaftConsensus implementation: it's enough to have
memory_order_release/memory_order_acquire for store/load operations,
and memory_order_release/memory_order_relaxed on compare_exchange_weak()
in RaftConsensus::WithholdVotes().  Also, use more lightweight approach
for setting the updated value for the 'withhold_votes_until_' field by
avoiding recurrent calls to clock_gettime() [1] upon spurious failures
of std::atomic::compare_exchange_weak().

[1] https://www.man7.org/linux/man-pages/man3/clock_gettime.3.html

Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
Reviewed-on: http://gerrit.cloudera.org:8080/25229
Tested-by: Alexey Serbin <al...@apache.org>
Reviewed-by: Marton Greber <gr...@gmail.com>
---
M src/kudu/consensus/raft_consensus.cc
1 file changed, 33 insertions(+), 15 deletions(-)

Approvals:
  Alexey Serbin: Verified
  Marton Greber: Looks good to me, approved

-- 
To view, visit http://gerrit.cloudera.org:8080/25229
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
Gerrit-Change-Number: 25229
Gerrit-PatchSet: 3
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Zoltan Martonka <zm...@cloudera.com>

[kudu-CR] [consensus] relax mem ordering on withhold votes until

Posted by "Kudu Jenkins (Code Review)" <ge...@cloudera.org>.
Kudu Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/25229 )

Change subject: [consensus] relax mem ordering on withhold_votes_until_
......................................................................


Patch Set 1: Verified-1

Build Failed 

http://jenkins.kudu.apache.org/job/pre_commit/3190/ : FAILURE


-- 
To view, visit http://gerrit.cloudera.org:8080/25229
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
Gerrit-Change-Number: 25229
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Zoltan Martonka <zm...@cloudera.com>
Gerrit-Comment-Date: Wed, 28 Oct 2026 03:03:42 +0000
Gerrit-HasComments: No

[kudu-CR] [consensus] relax mem ordering on withhold votes until

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/25229 )

Change subject: [consensus] relax mem ordering on withhold_votes_until_
......................................................................


Patch Set 2: Verified+1

unrelated failures of known flaky tests:
  * DEBUG: KUDU-3807
  * TSAN: KUDU-3821


-- 
To view, visit http://gerrit.cloudera.org:8080/25229
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
Gerrit-Change-Number: 25229
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Zoltan Martonka <zm...@cloudera.com>
Gerrit-Comment-Date: Wed, 28 Oct 2026 19:37:49 +0000
Gerrit-HasComments: No

[kudu-CR] [consensus] relax mem ordering on withhold votes until

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Hello Marton Greber, Zoltan Martonka, Kudu Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/25229

to look at the new patch set (#2).

Change subject: [consensus] relax mem ordering on withhold_votes_until_
......................................................................

[consensus] relax mem ordering on withhold_votes_until_

Relax memory ordering for atomic operations on 'withhold_votes_until_'
in the RaftConsensus implementation: it's enough to have
memory_order_release/memory_order_acquire for store/load operations,
and memory_order_release/memory_order_relaxed on compare_exchange_weak()
in RaftConsensus::WithholdVotes().  Also, use more lightweight approach
for setting the updated value for the 'withhold_votes_until_' field by
avoiding recurrent calls to clock_gettime() [1] upon spurious failures
of std::atomic::compare_exchange_weak().

[1] https://www.man7.org/linux/man-pages/man3/clock_gettime.3.html

Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
---
M src/kudu/consensus/raft_consensus.cc
1 file changed, 33 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/29/25229/2
-- 
To view, visit http://gerrit.cloudera.org:8080/25229
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
Gerrit-Change-Number: 25229
Gerrit-PatchSet: 2
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Zoltan Martonka <zm...@cloudera.com>

[kudu-CR] [consensus] relax mem ordering on withhold votes until

Posted by "Alexey Serbin (Code Review)" <ge...@cloudera.org>.
Alexey Serbin has removed a vote on this change.

Change subject: [consensus] relax mem ordering on withhold_votes_until_
......................................................................


Removed Verified-1 by Kudu Jenkins (120)
-- 
To view, visit http://gerrit.cloudera.org:8080/25229
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: deleteVote
Gerrit-Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
Gerrit-Change-Number: 25229
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Zoltan Martonka <zm...@cloudera.com>

[kudu-CR] [consensus] relax mem ordering on withhold votes until

Posted by "Marton Greber (Code Review)" <ge...@cloudera.org>.
Marton Greber has posted comments on this change. ( http://gerrit.cloudera.org:8080/25229 )

Change subject: [consensus] relax mem ordering on withhold_votes_until_
......................................................................


Patch Set 1: Code-Review+1

(1 comment)

http://gerrit.cloudera.org:8080/#/c/25229/1/src/kudu/consensus/raft_consensus.cc
File src/kudu/consensus/raft_consensus.cc:

http://gerrit.cloudera.org:8080/#/c/25229/1/src/kudu/consensus/raft_consensus.cc@3048
PS1, Line 3048:   // timeout heartbeat is many orders of magnitude longer than kRetryDelta.
I'm just wondering given that kRetryDelta is orders of magnitude below the election timeout, do we need next += kRetryDelta at all? Keeping next as computed before the loop seems simpler and equally accurate.



-- 
To view, visit http://gerrit.cloudera.org:8080/25229
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib404c9939421d280482f96dc4af64947fa1fbdc7
Gerrit-Change-Number: 25229
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <gr...@gmail.com>
Gerrit-Reviewer: Zoltan Martonka <zm...@cloudera.com>
Gerrit-Comment-Date: Wed, 28 Oct 2026 09:57:17 +0000
Gerrit-HasComments: Yes