diff --git a/util/migrate/allocator.py b/util/migrate/allocator.py index e154c9e23..b25ed3cf7 100644 --- a/util/migrate/allocator.py +++ b/util/migrate/allocator.py @@ -133,8 +133,8 @@ def yield_random_entries(batch_query, primary_key_field, batch_size, max_id): while True: start_index = allocator.get_block_start_index(batch_size) all_candidates = list(batch_query() - .limit(batch_size) - .where(primary_key_field >= start_index)) + .where(primary_key_field >= start_index, + primary_key_field <= start_index + batch_size)) if len(all_candidates) == 0: logger.info('No candidates, new highest id: %s', start_index)