Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed background_rollback to return true/false depending on if #212

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dbsim/db_server_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ int db::server_service::start_sst(
return 0;
}

void db::server_service::background_rollback(wsrep::client_state&)
bool db::server_service::background_rollback(wsrep::client_state&)
{
return false;
}

void db::server_service::bootstrap()
Expand Down
2 changes: 1 addition & 1 deletion dbsim/db_server_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace db
bool sst_before_init() const override;
int start_sst(const std::string&, const wsrep::gtid&, bool) override;
std::string sst_request() override;
void background_rollback(wsrep::client_state&) override;
bool background_rollback(wsrep::client_state&) override;
void bootstrap() override;
void log_message(enum wsrep::log::level, const char* message) override;
void log_dummy_write_set(wsrep::client_state&, const wsrep::ws_meta&)
Expand Down
3 changes: 2 additions & 1 deletion include/wsrep/server_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ namespace wsrep

/**
* Perform a background rollback for a transaction.
* @return true if rollbacker was not started, false otherwise
*/
virtual void background_rollback(wsrep::client_state&) = 0;
virtual bool background_rollback(wsrep::client_state&) = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document the meaning of return value in comment above.


/**
* Bootstrap a DBMS state for a new cluster.
Expand Down
15 changes: 13 additions & 2 deletions src/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1074,8 +1074,19 @@ bool wsrep::transaction::bf_abort(
}

lock.unlock();
server_service_.background_rollback(client_state_);
lock.lock();
/* if background rollback is skipped, reset rollbacker activity */
if (server_service_.background_rollback(client_state_))
{
lock.lock();
client_state_.set_rollbacker_active(false);

/* release the victim from waiting, if it has advanced to
wait_rollback_complete_and_acquire_ownership stage */
if (client_state_.state() == wsrep::client_state::s_idle)
client_state_.cond_.notify_all();
}
else
lock.lock();
}
}
return ret;
Expand Down
3 changes: 2 additions & 1 deletion test/mock_server_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,12 @@ namespace wsrep
return start_sst_action();
}

void
bool
background_rollback(wsrep::client_state& client_state) WSREP_OVERRIDE
{
client_state.before_rollback();
client_state.after_rollback();
return false;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I do not understand but when this method can return true ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for unit testing, so it does not necessarily implement all the same behavior as real application.

}

int wait_committing_transactions(int) WSREP_OVERRIDE { return 0; }
Expand Down