Skip to content

Commit

Permalink
Revert
Browse files Browse the repository at this point in the history
  • Loading branch information
vrigal authored and Archaeopteryx committed Aug 31, 2023
1 parent 1e1a750 commit ec51dda
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,49 +40,30 @@
'DROP INDEX failure_line_signature_test_idx ON failure_line;',
],
state_operations=[
migrations.AddIndex(
model_name='failureline',
index=django.contrib.postgres.indexes.HashIndex(
fields=['test', 'subtest', 'status', 'expected', 'created'],
name='failure_lin_test_52689e_hash',
),
),
migrations.AddIndex(
model_name='failureline',
index=django.contrib.postgres.indexes.HashIndex(
fields=['signature', 'test', 'created'],
name='failure_lin_signatu_69323a_hash',
),
),
migrations.AddIndex(
model_name='failureline',
index=models.Index(
fields=['job_guid', 'repository'], name='failure_lin_job_gui_b67c6d_idx'
migrations.AlterIndexTogether(
name='failureline',
index_together=set(
[
('test', 'subtest', 'status', 'expected', 'created'),
('job_guid', 'repository'),
('signature', 'test', 'created'),
]
),
),
],
),
]
else:
# On postgres we can use standard migrations
EXTRA_MIGRATIONS = [
migrations.AddIndex(
model_name='failureline',
index=django.contrib.postgres.indexes.HashIndex(
fields=['test', 'subtest', 'status', 'expected', 'created'],
name='failure_lin_test_52689e_hash',
),
),
migrations.AddIndex(
model_name='failureline',
index=django.contrib.postgres.indexes.HashIndex(
fields=['signature', 'test', 'created'],
name='failure_lin_signatu_69323a_hash',
),
),
migrations.AddIndex(
model_name='failureline',
index=models.Index(
fields=['job_guid', 'repository'], name='failure_lin_job_gui_b67c6d_idx'
migrations.AlterIndexTogether(
name='failureline',
index_together=set(
[
('test', 'subtest', 'status', 'expected', 'created'),
('job_guid', 'repository'),
('signature', 'test', 'created'),
]
),
),
migrations.AddIndex(
Expand Down Expand Up @@ -1038,6 +1019,10 @@ class Migration(migrations.Migration):
name='failureline',
unique_together=set([('job_log', 'line')]),
),
migrations.AlterIndexTogether(
name='failureline',
index_together=set([('job_guid', 'repository')]),
),
migrations.AlterUniqueTogether(
name='commit',
unique_together=set([('push', 'revision')]),
Expand Down
13 changes: 6 additions & 7 deletions treeherder/model/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.postgres.search import SearchQuery, SearchRank, SearchVector
from django.contrib.postgres.indexes import HashIndex
from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist
from django.core.validators import MinLengthValidator
Expand Down Expand Up @@ -956,12 +955,12 @@ class FailureLine(models.Model):

class Meta:
db_table = 'failure_line'
indexes = (
# Hash function is required to index large entries in test and subtest fields
# https://www.postgresql.org/docs/15/textsearch-limitations.html
HashIndex(fields=('test', 'subtest', 'status', 'expected', 'created')),
HashIndex(fields=('signature', 'test', 'created')),
models.Index(fields=('job_guid', 'repository')),
index_together = (
('job_guid', 'repository'),
# Prefix index: test(50), subtest(25), status, expected, created
('test', 'subtest', 'status', 'expected', 'created'),
# Prefix index: signature(25), test(50), created
('signature', 'test', 'created'),
)
unique_together = ('job_log', 'line')

Expand Down

0 comments on commit ec51dda

Please sign in to comment.