1
0
Fork 0

make sure some tick invariants always hold true

This commit is contained in:
jsteemann 2019-03-12 16:47:12 +01:00
parent 9d3327c6ea
commit d0dba4f941
1 changed files with 10 additions and 1 deletions

View File

@ -22,6 +22,7 @@
////////////////////////////////////////////////////////////////////////////////
#include "MMFilesRestReplicationHandler.h"
#include "ApplicationFeatures/ApplicationServer.h"
#include "Basics/StaticStrings.h"
#include "Basics/VelocyPackHelper.h"
#include "Logger/Logger.h"
@ -282,7 +283,7 @@ void MMFilesRestReplicationHandler::handleCommandLoggerFollow() {
}
// determine start and end tick
MMFilesLogfileManagerState const state = MMFilesLogfileManager::instance()->state();
MMFilesLogfileManagerState state = MMFilesLogfileManager::instance()->state();
TRI_voc_tick_t tickStart = 0;
TRI_voc_tick_t tickEnd = UINT64_MAX;
TRI_voc_tick_t firstRegularTick = 0;
@ -416,6 +417,14 @@ void MMFilesRestReplicationHandler::handleCommandLoggerFollow() {
} else {
resetResponse(rest::ResponseCode::OK);
}
// pull the latest state again, so that the last tick we hand out is always >=
// the last included tick value in the results
while (state.lastCommittedTick < dump._lastFoundTick &&
!application_features::ApplicationServer::isStopping()) {
state = MMFilesLogfileManager::instance()->state();
std::this_thread::sleep_for(std::chrono::microseconds(500));
}
// transfer ownership of the buffer contents
_response->setContentType(rest::ContentType::DUMP);