boolean addCompletedMigration ( MigrationInfo migrationInfo ) { if ( migrationInfo . getStatus ( ) != MigrationStatus . SUCCESS && migrationInfo . getStatus ( ) != MigrationStatus . FAILED ) { throw new IllegalArgumentException ( "Migration doesn't seem completed: " + migrationInfo ) ; } if ( migrationInfo . getInitialPartitionVersion ( ) <= 0 || migrationInfo . getPartitionVersionIncrement ( ) <= 0 ) { throw new IllegalArgumentException ( "Partition state versions are not set: " + migrationInfo ) ; } partitionServiceLock . lock ( ) ; try { boolean added = completedMigrations . add ( migrationInfo ) ; if ( added ) { stats . incrementCompletedMigrations ( ) ; } return added ; } finally { partitionServiceLock . unlock ( ) ; } }
Adds the migration to the set of completed migrations and increases the completed migration counter . Acquires the partition service lock to update the migrations .