Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2239#discussion_r185718131
--- Diff: store/search/src/main/scala/org/apache/spark/rpc/Master.scala ---
@@ -80,9 +83,32 @@ class Master(sparkConf: SparkConf, port: Int) {
rpcEnv = new NettyRpcEnvFactory().create(config)
val registryEndpoint: RpcEndpoint = new Registry(rpcEnv,
Master.this)
rpcEnv.setupEndpoint("registry-service", registryEndpoint)
+ if (isStarted.compareAndSet(false, false)) {
+ synchronized {
+ if (isStarted.compareAndSet(false, false)) {
+ isStarted.set(true)
+ }
+ }
+ }
rpcEnv.awaitTermination()
}
}).start()
+ var count = 0
+ val countThreshold = 5000
+ while (isStarted.compareAndSet(false, false) && count <
countThreshold) {
+ LOG.info(s"Waiting search mode master to start, retrying $count
times")
+ Thread.sleep(10)
+ count = count + 1;
+ }
+ if (count >= countThreshold) {
+ LOG.error(s"Search mode try $countThreshold times to start master
but failed")
+ throw new RuntimeException(
+ s"Search mode try $countThreshold times to start master but
failed")
+ } else {
+ LOG.info("Search mode master started")
+ }
+ } else {
+ LOG.info("Search mode master has already existed before.")
--- End diff --
change to `Search mode master has already started`
---