Skip to content

Commit

Permalink
Set batch size to avoid cursor timeout during migration
Browse files Browse the repository at this point in the history
closes #3654
https://pulp.plan.io/issues/3654

(cherry picked from commit 2bcbc35)
  • Loading branch information
goosemania authored and pcreech committed Jun 18, 2018
1 parent 11c8956 commit 2b0e459
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def migrate(*args, **kwargs):
srpm_collection = db['units_srpm']
drpm_collection = db['units_drpm']

for rpm in rpm_collection.find({}, ['checksum', 'checksumtype', 'repodata']):
for rpm in rpm_collection.find({}, ['checksum', 'checksumtype', 'repodata']).batch_size(100):
migrate_rpm_base(rpm_collection, rpm)
for srpm in srpm_collection.find({}, ['checksum', 'checksumtype', 'repodata']):
for srpm in srpm_collection.find({}, ['checksum', 'checksumtype', 'repodata']).batch_size(100):
migrate_rpm_base(srpm_collection, srpm)

migrate_drpms(drpm_collection)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def test_calls_migrate_rpm_base(self, mock_migrate_drpms, mock_migrate_rpm_base,
mock_db = mock_get_db.return_value
mock_unit = mock.MagicMock()
mock_rpm_collection = mock_db['units_rpm']
mock_rpm_collection.find.return_value = [mock_unit]
mock_rpm_collection.find.return_value.batch_size.return_value = [mock_unit]
mock_srpm_collection = mock_db['units_srpm']
mock_srpm_collection.find.return_value = [mock_unit]
mock_srpm_collection.find.return_value.batch_size.return_value = [mock_unit]

migration.migrate()

Expand Down

0 comments on commit 2b0e459

Please sign in to comment.