You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/02/25 03:01:54 UTC

[GitHub] [pulsar] merlimat commented on a change in pull request #9702: [C++] SinglePartition message router is always picking the same partition

merlimat commented on a change in pull request #9702:
URL: https://github.com/apache/pulsar/pull/9702#discussion_r582465760



##########
File path: pulsar-client-cpp/lib/SinglePartitionMessageRouter.cc
##########
@@ -18,9 +18,23 @@
  */
 #include "SinglePartitionMessageRouter.h"
 
+#include <boost/random/mersenne_twister.hpp>
+#include <boost/random/uniform_int_distribution.hpp>
+#include <chrono>
+
 namespace pulsar {
 SinglePartitionMessageRouter::~SinglePartitionMessageRouter() {}
+
+SinglePartitionMessageRouter::SinglePartitionMessageRouter(const int numberOfPartitions,
+                                                           ProducerConfiguration::HashingScheme hashingScheme)
+    : MessageRouterBase(hashingScheme) {
+    boost::random::mt19937 rng(std::chrono::high_resolution_clock::now().time_since_epoch().count());
+    boost::random::uniform_int_distribution<int> dist;

Review comment:
       Good point. Fixed. 
   
   There are also other places where we use it. They should get converted as well .




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org