Skip to content

Commit

Permalink
Merge pull request #1480 from selenamarie/bug812536-purge-hang-report
Browse files Browse the repository at this point in the history
Fixes bug 812536 Eliminate hang report and daily_hangs
  • Loading branch information
selenamarie committed Sep 6, 2013
2 parents a76a0fd + 07f0988 commit 5a318a1
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 132 deletions.
97 changes: 97 additions & 0 deletions alembic/versions/389f5501023b_bug_812536_drop_hang.py
@@ -0,0 +1,97 @@
"""bug 812536 drop hang report
Revision ID: 389f5501023b
Revises: 2209ca57dcc6
Create Date: 2013-09-06 14:15:21.470498
"""

# revision identifiers, used by Alembic.
revision = '389f5501023b'
down_revision = '2209ca57dcc6'

import os
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
from sqlalchemy import types
from sqlalchemy.sql import table, column
from sqlalchemy.dialects import postgresql

class CITEXT(types.UserDefinedType):
name = 'citext'

def get_col_spec(self):
return 'CITEXT'

def bind_processor(self, dialect):
return lambda value: value

def result_processor(self, dialect, coltype):
return lambda value: value

def __repr__(self):
return "citext"

class JSON(types.UserDefinedType):
name = 'json'

def get_col_spec(self):
return 'JSON'

def bind_processor(self, dialect):
return lambda value: value

def result_processor(self, dialect, coltype):
return lambda value: value

def __repr__(self):
return "json"

def upgrade():
op.execute('DROP VIEW hang_report')
op.drop_table(u'daily_hangs')
op.execute('DROP FUNCTION update_hang_report(date, boolean, interval)')
op.execute('DROP FUNCTION backfill_hang_report(date)')
app_path=os.getcwd()
procs = [
'backfill_matviews.sql'
]
for myfile in [app_path + '/socorro/external/postgresql/raw_sql/procs/' + line for line in procs]:
with open(myfile, 'r') as file:
op.execute(file.read())


def downgrade():
op.create_table(u'daily_hangs',
sa.Column(u'browser_signature_id', sa.INTEGER(), autoincrement=False, nullable=False),
sa.Column(u'duplicates', postgresql.ARRAY(sa.TEXT()), autoincrement=False, nullable=True),
sa.Column(u'flash_version_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column(u'hang_id', sa.TEXT(), autoincrement=False, nullable=False),
sa.Column(u'plugin_signature_id', sa.INTEGER(), autoincrement=False, nullable=False),
sa.Column(u'plugin_uuid', sa.TEXT(), autoincrement=False, nullable=False),
sa.Column(u'product_version_id', sa.INTEGER(), autoincrement=False, nullable=False),
sa.Column(u'report_date', sa.DATE(), autoincrement=False, nullable=True),
sa.Column(u'url', CITEXT(), autoincrement=False, nullable=True),
sa.Column(u'uuid', sa.TEXT(), autoincrement=False, nullable=False),
sa.PrimaryKeyConstraint(u'plugin_uuid', name=u'daily_hangs_pkey')
)
op.execute("""
CREATE VIEW hang_report AS
SELECT product_versions.product_name AS product,
product_versions.version_string AS version,
browser_signatures.signature AS browser_signature,
plugin_signatures.signature AS plugin_signature,
daily_hangs.hang_id AS browser_hangid,
flash_versions.flash_version,
daily_hangs.url, daily_hangs.uuid,
daily_hangs.duplicates,
daily_hangs.report_date AS report_day
FROM ((((daily_hangs JOIN product_versions USING (product_version_id))
JOIN signatures browser_signatures ON
((daily_hangs.browser_signature_id = browser_signatures.signature_id)))
JOIN signatures plugin_signatures ON
((daily_hangs.plugin_signature_id = plugin_signatures.signature_id)))
LEFT JOIN flash_versions USING (flash_version_id))
""")
# Restore the functions for matviews manually
1 change: 0 additions & 1 deletion socorro/external/postgresql/backfill.py
Expand Up @@ -17,7 +17,6 @@
"daily_crashes": ['update_day'],
"exploitability": ['update_day'],
"explosiveness": ['update_day'],
"hang_report": ['update_day'],
"home_page_graph_build": ['update_day', 'check_period'],
"home_page_graph": ['update_day', 'check_period'],
"matviews": ['start_date', 'end_date', 'reports_clean', 'check_period'],
Expand Down
17 changes: 0 additions & 17 deletions socorro/external/postgresql/models.py
Expand Up @@ -521,23 +521,6 @@ class CrontabberState(DeclarativeBase):
#relationship definitions


class DailyHang(DeclarativeBase):
__tablename__ = 'daily_hangs'


#column definitions
browser_signature_id = Column(u'browser_signature_id', INTEGER(), nullable=False, index=True)
duplicates = Column(u'duplicates', ARRAY(TEXT()))
flash_version_id = Column(u'flash_version_id', INTEGER(), index=True)
hang_id = Column(u'hang_id', TEXT(), nullable=False, index=True)
plugin_signature_id = Column(u'plugin_signature_id', INTEGER(), nullable=False, index=True)
plugin_uuid = Column(u'plugin_uuid', TEXT(), primary_key=True, nullable=False)
product_version_id = Column(u'product_version_id', INTEGER(), nullable=False, autoincrement=False, index=True)
report_date = Column(u'report_date', DATE(), index=True)
url = Column(u'url', CITEXT())
uuid = Column(u'uuid', TEXT(), nullable=False, index=True)


class DataDictionary(DeclarativeBase):
__tablename__ = 'data_dictionary'

Expand Down
15 changes: 0 additions & 15 deletions socorro/external/postgresql/raw_sql/procs/backfill_hang_report.sql

This file was deleted.

Expand Up @@ -75,8 +75,6 @@ WHILE thisday <= lastday LOOP
PERFORM backfill_home_page_graph(thisday);
PERFORM backfill_home_page_graph_build(thisday);
DROP TABLE IF EXISTS new_signatures;
RAISE INFO 'hang report (slow)';
PERFORM backfill_hang_report(thisday);
RAISE INFO 'nightly builds';
PERFORM backfill_nightly_builds(thisday);
RAISE INFO 'exploitability';
Expand Down
65 changes: 0 additions & 65 deletions socorro/external/postgresql/raw_sql/procs/update_hang_report.sql

This file was deleted.

This file was deleted.

0 comments on commit 5a318a1

Please sign in to comment.