You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Yingchun Lai (Code Review)" <ge...@cloudera.org> on 2023/05/29 06:24:24 UTC

[kudu-CR](branch-1.17.x) KUDU-3248 improve replica selection initialization

Hello Alexey Serbin, Abhishek Chennaka, Wenzhe Zhou,

I'd like you to do a code review. Please visit

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

to review the following change.


Change subject: KUDU-3248 improve replica selection initialization
......................................................................

KUDU-3248 improve replica selection initialization

Since the original implementation stored the random choice for replica
selection integer in a variable that was initialized statically, the
corresponding calls to libstdc++/libc++ runtime had been issued before
the process called the main() function.  That means some SSE4.2-specific
instructions might be called since libkudu_client is unconditionally
compiled with -msse4.2 flag, and there'd been no chance to call
KuduClientBuilder::Build() that would verify the required features are
present by calling CheckCPUFlags().  As a result, an attempt to run
an application linked with kudu_client library at a machine lacking
SSE4.2 support would result in a crash with SIGILL signal and a stack
trace like below:

  #0  0x00007fc4b1b58162 in std::mersenne_twister_engine<...>::_M_gen_rand
      at include/c++/7.5.0/bits/random.tcc:408
  #1  std::mersenne_twister_engine<...>::operator()
      at include/c++/7.5.0/bits/random.tcc:459
  #2  0x00007fc4b1b1d65d in kudu::client::(anonymous namespace)::InitRandomSelectionInt
      at ../../../../../src/kudu/client/client-internal.cc:196
  #3  0x00007fc4b1b1d6ef in __static_initialization_and_destruction_0
      at ../../../../../src/kudu/client/client-internal.cc:198
  #4  _GLOBAL__sub_I_client_internal.cc(void)
      at ../../../../../src/kudu/client/client-internal.cc:871

This patch addresses that deficiency, so now instead of unexpectedly
crashing, the application would return an error upon at attempt to
create an instance of KuduClient object.

This is a follow-up to ccbbfb3006314f2c37f3a40bfec355db9fc90e02.

Change-Id: I11c2a29ef69a8c97c68330d261fdff64accebb0b
Reviewed-on: http://gerrit.cloudera.org:8080/19828
Reviewed-by: Abhishek Chennaka <ac...@cloudera.com>
Reviewed-by: Wenzhe Zhou <wz...@cloudera.com>
Tested-by: Alexey Serbin <al...@apache.org>
---
M src/kudu/client/client-internal.cc
1 file changed, 18 insertions(+), 11 deletions(-)



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

Gerrit-Project: kudu
Gerrit-Branch: branch-1.17.x
Gerrit-MessageType: newchange
Gerrit-Change-Id: I11c2a29ef69a8c97c68330d261fdff64accebb0b
Gerrit-Change-Number: 19948
Gerrit-PatchSet: 1
Gerrit-Owner: Yingchun Lai <la...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>

[kudu-CR](branch-1.17.x) KUDU-3248 improve replica selection initialization

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

Change subject: KUDU-3248 improve replica selection initialization
......................................................................

KUDU-3248 improve replica selection initialization

Since the original implementation stored the random choice for replica
selection integer in a variable that was initialized statically, the
corresponding calls to libstdc++/libc++ runtime had been issued before
the process called the main() function.  That means some SSE4.2-specific
instructions might be called since libkudu_client is unconditionally
compiled with -msse4.2 flag, and there'd been no chance to call
KuduClientBuilder::Build() that would verify the required features are
present by calling CheckCPUFlags().  As a result, an attempt to run
an application linked with kudu_client library at a machine lacking
SSE4.2 support would result in a crash with SIGILL signal and a stack
trace like below:

  #0  0x00007fc4b1b58162 in std::mersenne_twister_engine<...>::_M_gen_rand
      at include/c++/7.5.0/bits/random.tcc:408
  #1  std::mersenne_twister_engine<...>::operator()
      at include/c++/7.5.0/bits/random.tcc:459
  #2  0x00007fc4b1b1d65d in kudu::client::(anonymous namespace)::InitRandomSelectionInt
      at ../../../../../src/kudu/client/client-internal.cc:196
  #3  0x00007fc4b1b1d6ef in __static_initialization_and_destruction_0
      at ../../../../../src/kudu/client/client-internal.cc:198
  #4  _GLOBAL__sub_I_client_internal.cc(void)
      at ../../../../../src/kudu/client/client-internal.cc:871

This patch addresses that deficiency, so now instead of unexpectedly
crashing, the application would return an error upon at attempt to
create an instance of KuduClient object.

This is a follow-up to ccbbfb3006314f2c37f3a40bfec355db9fc90e02.

Change-Id: I11c2a29ef69a8c97c68330d261fdff64accebb0b
Reviewed-on: http://gerrit.cloudera.org:8080/19828
Reviewed-by: Abhishek Chennaka <ac...@cloudera.com>
Reviewed-by: Wenzhe Zhou <wz...@cloudera.com>
Tested-by: Alexey Serbin <al...@apache.org>
Reviewed-on: http://gerrit.cloudera.org:8080/19948
Reviewed-by: Yingchun Lai <la...@apache.org>
Tested-by: Kudu Jenkins
Reviewed-by: Yuqi Du <sh...@gmail.com>
Reviewed-by: Yifan Zhang <ch...@163.com>
---
M src/kudu/client/client-internal.cc
1 file changed, 18 insertions(+), 11 deletions(-)

Approvals:
  Yingchun Lai: Looks good to me, but someone else must approve
  Kudu Jenkins: Verified
  Yuqi Du: Looks good to me, but someone else must approve
  Yifan Zhang: Looks good to me, approved

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

Gerrit-Project: kudu
Gerrit-Branch: branch-1.17.x
Gerrit-MessageType: merged
Gerrit-Change-Id: I11c2a29ef69a8c97c68330d261fdff64accebb0b
Gerrit-Change-Number: 19948
Gerrit-PatchSet: 2
Gerrit-Owner: Yingchun Lai <la...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yifan Zhang <ch...@163.com>
Gerrit-Reviewer: Yingchun Lai <la...@apache.org>
Gerrit-Reviewer: Yuqi Du <sh...@gmail.com>

[kudu-CR](branch-1.17.x) KUDU-3248 improve replica selection initialization

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

Change subject: KUDU-3248 improve replica selection initialization
......................................................................


Patch Set 1: Code-Review+1


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

Gerrit-Project: kudu
Gerrit-Branch: branch-1.17.x
Gerrit-MessageType: comment
Gerrit-Change-Id: I11c2a29ef69a8c97c68330d261fdff64accebb0b
Gerrit-Change-Number: 19948
Gerrit-PatchSet: 1
Gerrit-Owner: Yingchun Lai <la...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yingchun Lai <la...@apache.org>
Gerrit-Comment-Date: Mon, 29 May 2023 06:31:18 +0000
Gerrit-HasComments: No

[kudu-CR](branch-1.17.x) KUDU-3248 improve replica selection initialization

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

Change subject: KUDU-3248 improve replica selection initialization
......................................................................


Patch Set 1: Code-Review+2


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

Gerrit-Project: kudu
Gerrit-Branch: branch-1.17.x
Gerrit-MessageType: comment
Gerrit-Change-Id: I11c2a29ef69a8c97c68330d261fdff64accebb0b
Gerrit-Change-Number: 19948
Gerrit-PatchSet: 1
Gerrit-Owner: Yingchun Lai <la...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yifan Zhang <ch...@163.com>
Gerrit-Reviewer: Yingchun Lai <la...@apache.org>
Gerrit-Reviewer: Yuqi Du <sh...@gmail.com>
Gerrit-Comment-Date: Wed, 31 May 2023 04:11:58 +0000
Gerrit-HasComments: No

[kudu-CR](branch-1.17.x) KUDU-3248 improve replica selection initialization

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

Change subject: KUDU-3248 improve replica selection initialization
......................................................................


Patch Set 1: Code-Review+1


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

Gerrit-Project: kudu
Gerrit-Branch: branch-1.17.x
Gerrit-MessageType: comment
Gerrit-Change-Id: I11c2a29ef69a8c97c68330d261fdff64accebb0b
Gerrit-Change-Number: 19948
Gerrit-PatchSet: 1
Gerrit-Owner: Yingchun Lai <la...@apache.org>
Gerrit-Reviewer: Abhishek Chennaka <ac...@cloudera.com>
Gerrit-Reviewer: Alexey Serbin <al...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Wenzhe Zhou <wz...@cloudera.com>
Gerrit-Reviewer: Yingchun Lai <la...@apache.org>
Gerrit-Reviewer: Yuqi Du <sh...@gmail.com>
Gerrit-Comment-Date: Wed, 31 May 2023 02:53:35 +0000
Gerrit-HasComments: No