static int ldb_kv_sub_transaction_cancel(struct ldb_kv_private *ldb_kv)
{
	int ret = LDB_SUCCESS;

	if (ldb_kv->batch_mode) {
		return ret;
	}

	ret = ldb_kv_index_sub_transaction_cancel(ldb_kv);
	if (ret != LDB_SUCCESS) {
		struct ldb_context *ldb = ldb_module_get_ctx(ldb_kv->module);
		/*
		 * In the event of a failure we log the failure and continue
		 * as we need to cancel the database transaction.
		 */
		ldb_debug(ldb,
			  LDB_DEBUG_ERROR,
			  __location__": ldb_kv_index_sub_transaction_cancel "
			  "failed: %s",
			  ldb_errstring(ldb));
	}
	ret = ldb_kv->kv_ops->abort_nested_write(ldb_kv);
	return ret;
}
static int ldb_kv_sub_transaction_cancel(struct ldb_kv_private *ldb_kv)
{
	int ret = LDB_SUCCESS;

	if (ldb_kv->batch_mode) {
		return ret;
	}

	ret = ldb_kv_index_sub_transaction_cancel(ldb_kv);
	if (ret != LDB_SUCCESS) {
		struct ldb_context *ldb = ldb_module_get_ctx(ldb_kv->module);
		 
		ldb_debug(ldb,
			  LDB_DEBUG_ERROR,
			  __location__": ldb_kv_index_sub_transaction_cancel "
			  "failed: %s",
			  ldb_errstring(ldb));
	}
	ret = ldb_kv->kv_ops->abort_nested_write(ldb_kv);
	return ret;
}