diff --git a/ambry-store/src/main/java/com/github/ambry/store/BlobStore.java b/ambry-store/src/main/java/com/github/ambry/store/BlobStore.java index 3a72a26d31..7f0c9fb96b 100644 --- a/ambry-store/src/main/java/com/github/ambry/store/BlobStore.java +++ b/ambry-store/src/main/java/com/github/ambry/store/BlobStore.java @@ -1643,6 +1643,7 @@ private void checkPartition(List infos) { if (storeKey instanceof BlobId && replicaId != null) { BlobId blobId = (BlobId) storeKey; if (blobId.getPartition().getId() != replicaId.getPartitionId().getId()) { + metrics.blobPartitionUnmatchError.inc(); throw new IllegalArgumentException( "WriteSet contains unexpected blob id : " + info.getStoreKey() + ", it belongs to partition " + blobId.getPartition() + " but this blobstore's partition is " + replicaId.getPartitionId()); diff --git a/ambry-store/src/main/java/com/github/ambry/store/StoreMetrics.java b/ambry-store/src/main/java/com/github/ambry/store/StoreMetrics.java index 3b7d4f80f0..2fdd08ab76 100644 --- a/ambry-store/src/main/java/com/github/ambry/store/StoreMetrics.java +++ b/ambry-store/src/main/java/com/github/ambry/store/StoreMetrics.java @@ -95,6 +95,7 @@ public class StoreMetrics { public final Counter undeleteAuthorizationFailureCount; public final Counter keyInFindEntriesAbsent; public final Counter duplicateKeysInBatch; + public final Counter blobPartitionUnmatchError; public final Counter storeIoErrorTriggeredShutdownCount; public final Counter blobStoreRecoverCompactionPolicySwitchInfoErrorCount; public final Counter handleDiskFailureCount; @@ -236,6 +237,8 @@ public StoreMetrics(String prefix, MetricRegistry registry) { registry.counter(MetricRegistry.name(BlobStore.class, name + "UndeleteAuthorizationFailureCount")); keyInFindEntriesAbsent = registry.counter(MetricRegistry.name(BlobStore.class, name + "KeyInFindEntriesAbsent")); duplicateKeysInBatch = registry.counter(MetricRegistry.name(BlobStore.class, name + "DuplicateKeysInBatch")); + blobPartitionUnmatchError = + registry.counter(MetricRegistry.name(BlobStore.class, name + "BlobPartitionUnmatchError")); storeIoErrorTriggeredShutdownCount = registry.counter(MetricRegistry.name(BlobStore.class, name + "StoreIoErrorTriggeredShutdownCount")); Gauge staleBlobStoreCount = BlobStore.staleBlobCount::get;