@Test
  public void concurrentDeleteTestOnSameBlob() throws Exception {
    final MockId idToDelete = put(1, PUT_RECORD_SIZE, Utils.Infinite_Time).get(0);
    assertNotNull(idToDelete);
    int count = 2;
    long logEndOffsetBeforeDelete = store.getLogEndOffsetInBytes();
    long indexEndOffsetBeforeDelete = store.getSizeInBytes();
    ExecutorService executorService = Executors.newFixedThreadPool(count);
    try {
      List<Future<Void>> futures = new ArrayList<>();
      for (int i = 0; i < count; i++) {
        futures.add(executorService.submit(() -> {
          delete(idToDelete);
          return null;
        }));
      }
      int failedCount = 0;
      int succeededCount = 0;
      for (Future<Void> future : futures) {
        try {
          future.get();
          succeededCount++;
        } catch (ExecutionException e) {
          failedCount++;
          assertTrue(e.getCause() instanceof StoreException);
          assertEquals(StoreErrorCodes.IDDeleted, ((StoreException) e.getCause()).getErrorCode());
        }
      }

      assertEquals(1, succeededCount);
      assertEquals(count - 1, failedCount);
      long logEndOffsetAfterDelete = store.getLogEndOffsetInBytes();
      long indexEndOffsetAfterDelete = store.getSizeInBytes();
      assertEquals((long) DELETE_RECORD_SIZE, logEndOffsetAfterDelete - logEndOffsetBeforeDelete);
      assertEquals((long) DELETE_RECORD_SIZE, indexEndOffsetAfterDelete - indexEndOffsetBeforeDelete);
    } finally {
      executorService.shutdownNow();
    }
  }
Test when deleting the same blob at the same time. Only one delete can go through and only one log and index
record should be persisted.
@throws Exception
ambry-store/src/test/java/com/github/ambry/store/BlobStoreTest.java