Skip to content

Commit

Permalink
Rollback storage service in case of errors while appending fragment
Browse files Browse the repository at this point in the history
This is part of fix for MDEV-30838
  • Loading branch information
sciascid committed Mar 14, 2023
1 parent 7e0ccfc commit 32d4275
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1557,17 +1557,25 @@ int wsrep::transaction::certify_fragment(
error = wsrep::e_append_fragment_error;
}

if (ret == 0 &&
(storage_service.start_transaction(ws_handle_) ||
storage_service.append_fragment(
server_id,
id(),
flags(),
wsrep::const_buffer(data.data(), data.size()),
xid())))
if (ret == 0)
{
ret = 1;
error = wsrep::e_append_fragment_error;
ret = storage_service.start_transaction(ws_handle_);
if (ret)
{
error = wsrep::e_append_fragment_error;
}
}

if (ret == 0)
{
ret = storage_service.append_fragment(
server_id, id(), flags(),
wsrep::const_buffer(data.data(), data.size()), xid());
if (ret)
{
error = wsrep::e_append_fragment_error;
storage_service.rollback(wsrep::ws_handle(), wsrep::ws_meta());
}
}

if (ret == 0)
Expand Down

0 comments on commit 32d4275

Please sign in to comment.