fix: nextVersion needs to be set to logData->version if version_sizes is empty

This commit is contained in:
Evan Tschannen 2018-08-04 23:53:37 -07:00
parent 9d0a07a400
commit c757c68bfa
1 changed files with 2 additions and 3 deletions

View File

@ -648,7 +648,7 @@ ACTOR Future<Void> updateStorage( TLogData* self ) {
}
state Reference<LogData> logData = self->id_data[self->queueOrder.front()];
state Version nextVersion = 0;
state Version nextVersion = logData->version.get();
state int totalSize = 0;
state int tagLocality = 0;
@ -660,6 +660,7 @@ ACTOR Future<Void> updateStorage( TLogData* self ) {
while(logData->persistentDataDurableVersion != logData->version.get()) {
totalSize = 0;
Map<Version, std::pair<int,int>>::iterator sizeItr = logData->version_sizes.begin();
nextVersion = logData->version.get();
while( totalSize < SERVER_KNOBS->UPDATE_STORAGE_BYTE_LIMIT && sizeItr != logData->version_sizes.end() )
{
totalSize += sizeItr->value.first + sizeItr->value.second;
@ -702,8 +703,6 @@ ACTOR Future<Void> updateStorage( TLogData* self ) {
nextVersion = sizeItr == logData->version_sizes.end() ? logData->version.get() : sizeItr->key;
}
nextVersion = std::max<Version>(nextVersion, logData->persistentDataVersion);
//TraceEvent("UpdateStorageVer", logData->logId).detail("NextVersion", nextVersion).detail("PersistentDataVersion", logData->persistentDataVersion).detail("TotalSize", totalSize);
Void _ = wait( logData->queueCommittedVersion.whenAtLeast( nextVersion ) );