public boolean tryUnblockFailedWorkflowInstance(
      String workflowId, long workflowInstanceId, long workflowRunId, TimelineEvent event) {
    int updated =
        withMetricLogError(
            () ->
                withRetryableUpdate(
                    UNBLOCK_INSTANCE_FAILED_STATUS,
                    stmt -> {
                      int idx = 0;
                      stmt.setString(++idx, toJson(event));
                      stmt.setString(++idx, workflowId);
                      stmt.setLong(++idx, workflowInstanceId);
                      stmt.setLong(++idx, workflowRunId);
                    }),
            "tryUnblockFailedWorkflowInstance",
            "Failed to try to unblock the failed workflow instance [{}][{}][{}]",
            workflowId,
            workflowInstanceId,
            workflowRunId);
    return updated == SUCCESS_WRITE_SIZE;
  }
@Test
  public void testTryUnblockFailedWorkflowInstance() {
    int cnt =
        instanceDao.terminateQueuedInstances(
            TEST_WORKFLOW_ID, 2, WorkflowInstance.Status.FAILED, "test-reason");
    assertEquals(1L, cnt);
    String status = instanceDao.getWorkflowInstanceRawStatus(TEST_WORKFLOW_ID, 1L, 1L);
    assertEquals("FAILED", status);
    boolean ret = instanceDao.tryUnblockFailedWorkflowInstance(TEST_WORKFLOW_ID, 1L, 1L, null);
    assertTrue(ret);
    status = instanceDao.getWorkflowInstanceRawStatus(TEST_WORKFLOW_ID, 1L, 1L);
    assertEquals("FAILED_1", status);
  }