From 55e47ea555faac2dcf773ead2721e2f0b1945cd9 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Tue, 12 Dec 2023 16:41:56 -0800 Subject: [PATCH] Print out stack track on ReplicaThread calling getBootstrapReplica (#2673) We are seeing getBootstrapReplica being called in ReplicaThread somehow. And we can't figure out how it's been called. This PR adds a stacktrace for that. Will remove it when we know the call chain. --- .../com/github/ambry/clustermap/HelixClusterManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixClusterManager.java b/ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixClusterManager.java index c56bc18a70..868a511f35 100644 --- a/ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixClusterManager.java +++ b/ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixClusterManager.java @@ -834,6 +834,11 @@ private ReplicaId getBootstrapReplicaInSemiAuto(String partitionIdStr, DataNodeI bootstrapReplica = new AmbryServerReplica(clusterMapConfig, currentPartition, targetDisk, true, replicaCapacity, ReplicaSealStatus.NOT_SEALED); logger.info("Created bootstrap replica {} for Partition {}", bootstrapReplica, partitionIdStr); + Thread currentThread = Thread.currentThread(); + // TODO: Remove this code after figuring out why ReplicaThread is calling this method. + if (currentThread.getName().contains("ReplicaThread")) { + logger.error("Method invocation in wrong thread {}", currentThread.getName(), new Exception("")); + } } catch (Exception e) { logger.error("Failed to create bootstrap replica for partition {} on {} due to exception: ", partitionIdStr, instanceName, e);