diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2010-11-17 15:23:59 +0000 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2010-11-17 15:23:59 +0000 |
commit | 8f9bdaa97f447b0c2646ebceed8b371c9916a03e (patch) | |
tree | 9bec2b72274afdbe16d2ad931fb8717a9daddf0e /sonar-server | |
parent | c3e9146d9a690cda4a429ac8ab3e429a7fe6965f (diff) | |
download | sonarqube-8f9bdaa97f447b0c2646ebceed8b371c9916a03e.tar.gz sonarqube-8f9bdaa97f447b0c2646ebceed8b371c9916a03e.zip |
SONAR-1990 ORA-01795 when deleting orphan snapshots
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/db/migrate/152_delete_duplicated_lib_snapshots.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/152_delete_duplicated_lib_snapshots.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/152_delete_duplicated_lib_snapshots.rb index 640ab06f4f5..c6c747532cd 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/152_delete_duplicated_lib_snapshots.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/152_delete_duplicated_lib_snapshots.rb @@ -47,7 +47,14 @@ class DeleteDuplicatedLibSnapshots < ActiveRecord::Migration def self.delete_snapshots(snapshots) if snapshots.size > 0 say_with_time "Deleting #{snapshots.size} orphan snapshots..." do - Snapshot.delete(snapshots.map{|s| s.id}) + sids=snapshots.map{|s| s.id} + page_size=950 + page_count=(sids.size/page_size) + page_count+=1 if (sids.size % page_size)>0 + page_count.times do |page_index| + page_sids=sids[page_index*page_size...(page_index+1)*page_size] + Snapshot.delete(page_sids) + end end end end |