Review fixes

This commit is contained in:
alesapin 2020-06-08 21:08:55 +03:00
parent 9941fbe32d
commit ce73b30505
3 changed files with 21 additions and 14 deletions

View File

@ -141,16 +141,6 @@ void StorageMergeTree::shutdown()
mutation_wait_event.notify_all(); mutation_wait_event.notify_all();
} }
try
{
clearOldPartsFromFilesystem(true);
}
catch (...)
{
/// Example: the case of readonly filesystem, we have failure removing old parts.
/// Should not prevent table shutdown.
tryLogCurrentException(log);
}
merger_mutator.merges_blocker.cancelForever(); merger_mutator.merges_blocker.cancelForever();
parts_mover.moves_blocker.cancelForever(); parts_mover.moves_blocker.cancelForever();
@ -160,6 +150,23 @@ void StorageMergeTree::shutdown()
if (moving_task_handle) if (moving_task_handle)
global_context.getBackgroundMovePool().removeTask(moving_task_handle); global_context.getBackgroundMovePool().removeTask(moving_task_handle);
try
{
/// We clear all old parts after stopping all background operations.
/// It's important, because background operations can produce temporary
/// parts which will remove themselves in their descrutors. If so, we
/// may have race condition between our remove call and background
/// process.
clearOldPartsFromFilesystem(true);
}
catch (...)
{
/// Example: the case of readonly filesystem, we have failure removing old parts.
/// Should not prevent table shutdown.
tryLogCurrentException(log);
}
} }

View File

@ -2997,10 +2997,10 @@ void StorageReplicatedMergeTree::shutdown()
} }
data_parts_exchange_endpoint.reset(); data_parts_exchange_endpoint.reset();
/// We clear all parts after stopping all background operations. It's /// We clear all old parts after stopping all background operations. It's
/// important, because background operations can produce temporary parts /// important, because background operations can produce temporary parts
/// which will remove themselfs in their descrutors. If so, we may have race /// which will remove themselves in their descrutors. If so, we may have
/// condition between our remove call and background process. /// race condition between our remove call and background process.
clearOldPartsFromFilesystem(true); clearOldPartsFromFilesystem(true);
} }

View File

@ -102,7 +102,7 @@ echo "Finishing alters"
# This alter will finish all previous, but replica 1 maybe still not up-to-date. # This alter will finish all previous, but replica 1 maybe still not up-to-date.
# If query will throw something, than we will sleep 1 and retry. If timeout # If query will throw something, than we will sleep 1 and retry. If timeout
# happened we will silentrly go out of loop and probably fail tests in the # happened we will silently go out of loop and probably fail tests in the
# following for loop. # following for loop.
# #
# 120 seconds is more than enough, but in rare cases for slow builds (debug, # 120 seconds is more than enough, but in rare cases for slow builds (debug,