Skip to content

Commit 082b348

Browse files
committed
Drop unused logfiles table
The table held raw CentOS 5 i386 build logs fetched in 2012 but has never been served by the app, while taking 13GB of the 17GB database. Its contents are archived to s3://rubyci/centos5-32/ in the standard chkbuild layout.
1 parent 9a188cb commit 082b348

4 files changed

Lines changed: 14 additions & 59 deletions

File tree

app/models/logfile.rb

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class DropLogfiles < ActiveRecord::Migration[8.1]
2+
def change
3+
drop_table :logfiles do |t|
4+
t.datetime :created_at, precision: nil
5+
t.binary :data
6+
t.string :ext
7+
t.integer :report_id
8+
t.datetime :updated_at, precision: nil
9+
t.index [:report_id, :ext], name: "index_logfiles_on_report_id_and_ext", unique: true
10+
t.index [:report_id], name: "index_logfiles_on_report_id"
11+
end
12+
end
13+
end

db/schema.rb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[8.1].define(version: 2026_07_27_051843) do
13+
ActiveRecord::Schema[8.1].define(version: 2026_07_27_095902) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "pg_catalog.plpgsql"
1616

@@ -42,16 +42,6 @@
4242
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
4343
end
4444

45-
create_table "logfiles", force: :cascade do |t|
46-
t.datetime "created_at", precision: nil
47-
t.binary "data"
48-
t.string "ext"
49-
t.integer "report_id"
50-
t.datetime "updated_at", precision: nil
51-
t.index ["report_id", "ext"], name: "index_logfiles_on_report_id_and_ext", unique: true
52-
t.index ["report_id"], name: "index_logfiles_on_report_id"
53-
end
54-
5545
create_table "recents", force: :cascade do |t|
5646
t.datetime "created_at", null: false
5747
t.string "etag", null: false

lib/tasks/scheduler.rake

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -28,39 +28,6 @@ task :inspect_env => :environment do
2828
p URI("http://www.yahoo.co.jp").read(100) rescue nil
2929
end
3030

31-
desc "fetch old logfiles"
32-
task :fetch_logfile => :environment do
33-
Report.
34-
joins("LEFT OUTER JOIN logfiles AS l1 ON
35-
reports.id = l1.report_id AND l1.ext='log.txt'").
36-
joins("LEFT OUTER JOIN logfiles AS l2 ON
37-
reports.id = l2.report_id AND l2.ext='diff.txt'").
38-
joins("LEFT OUTER JOIN logfiles AS l3 ON
39-
reports.id = l2.report_id AND l3.ext='log.html'").
40-
joins("LEFT OUTER JOIN logfiles AS l4 ON
41-
reports.id = l4.report_id AND l4.ext='diff.html'").
42-
where('l1.report_id IS NULL OR l2.report_id IS NULL OR
43-
l3.report_id IS NULL OR l4.report_id IS NULL').
44-
where('reports.server_id = 4').
45-
select(['reports.*',
46-
'l1.id AS l1id', 'l2.id AS l2id', 'l3.id AS l3id', 'l4.id AS l4id']).
47-
find_each do |r|
48-
t = r.datetime.strftime('%Y%m%dT%H%M%SZ')
49-
lids = [r.l1id, r.l2id, r.l3id, r.l4id]
50-
%w[log.txt diff.txt log.html diff.html].each_with_index do |ext, i|
51-
next if lids[i]
52-
uri = "#{r.server.uri}ruby-#{r.branch}/log/#{t}.#{ext}.gz"
53-
puts uri
54-
begin
55-
data = URI(uri).read
56-
Logfile.create(report_id: r.id, ext: ext, data: data)
57-
rescue => e
58-
p e
59-
end
60-
end
61-
end
62-
end
63-
6431
desc "sync server settings"
6532
task :sync_servers => :environment do
6633
require 'open-uri'

0 commit comments

Comments
 (0)