Commit 2ffdc5b0 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix ConcurrentMap::migrationInProcess() to handle initialization value (0) properly

Job coordinator of the table may have three states:

1) jobCoordinator == 0: the table was initialized, but no migration
   has ever been started for this table
2) jobCoordinator > 1: a table migration is in progress right now. The
   caller should join *jobCoordinator to help finishing the migration.
3) jobCoordinator == 1: the table migration has been finished. It means
   that the table doesn't have any values in it anymore.

The patch actually fixes the map to consider case 1 as a situation, when
there is no migration.

parent 5e125565
......@@ -48,7 +48,7 @@ public:
bool migrationInProcess()
return (quint64) m_root.loadNonatomic()->jobCoordinator.loadConsume() != 1;
return quint64(m_root.loadNonatomic()->jobCoordinator.loadConsume()) > 1;
// publishTableMigration() is called by exactly one thread from Details::TableMigration::run()
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment