Skip to content

Commit

Permalink
Flush rollback log more often
Browse files Browse the repository at this point in the history
Flushes the buffer of rollback actions that wait to get saved in two more situations:

1. Flushes in the destructor of the rollback. This makes the server not
forget the last < 500 rollback entries when it shuts down.

2. Flushes the rollback when /rollback_check is invoked. This is neccessary
as otherwise it leads to confusion if users want to test the rollback functionality
by placing a node and then executing the check on it, or if the actions were
very recent out of other reasons.
  • Loading branch information
est31 committed Oct 24, 2015
1 parent 964be64 commit f9eb31f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/rollback.cpp
Expand Up @@ -107,6 +107,8 @@ RollbackManager::RollbackManager(const std::string & world_path,

RollbackManager::~RollbackManager()
{
flush();

SQLOK(sqlite3_finalize(stmt_insert));
SQLOK(sqlite3_finalize(stmt_replace));
SQLOK(sqlite3_finalize(stmt_select));
Expand Down Expand Up @@ -930,6 +932,7 @@ std::list<RollbackAction> RollbackManager::getEntriesSince(time_t first_time)
std::list<RollbackAction> RollbackManager::getNodeActors(v3s16 pos, int range,
time_t seconds, int limit)
{
flush();
time_t cur_time = time(0);
time_t first_time = cur_time - seconds;

Expand Down

0 comments on commit f9eb31f

Please sign in to comment.