Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BucketHit integrity error #923

Open
jschwartzentruber opened this issue Jul 28, 2023 · 1 comment
Open

BucketHit integrity error #923

jschwartzentruber opened this issue Jul 28, 2023 · 1 comment
Labels
bug crashmanager live-server Issues with fuzzmanager.f.m.o deployment P1

Comments

@jschwartzentruber
Copy link
Contributor

>>> b.reassign(True)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/src/server/crashmanager/models.py", line 232, in reassign
    BucketHit.increment_count(
  File "/src/server/crashmanager/models.py", line 370, in increment_count
    counter, _ = cls.objects.get_or_create(
  File "/home/worker/.local/lib/python3.10/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/worker/.local/lib/python3.10/site-packages/django/db/models/query.py", line 929, in get_or_create
    return self.get(**kwargs), False
  File "/home/worker/.local/lib/python3.10/site-packages/django/db/models/query.py", line 653, in get
    raise self.model.MultipleObjectsReturned(
crashmanager.models.BucketHit.MultipleObjectsReturned: get() returned more than one BucketHit -- it returned 2!
@jschwartzentruber jschwartzentruber added bug P1 crashmanager live-server Issues with fuzzmanager.f.m.o deployment labels Jul 28, 2023
@jschwartzentruber
Copy link
Contributor Author

jschwartzentruber commented Jul 28, 2023

to manually fix

counts={}
for key in BucketHit.objects.values_list("bucket_id", "tool_id", "begin"):
  counts.setdefault(key, 0)
  counts[key] += 1
bad={k:v for k,v in counts.items() if v > 1}
for bid,tid,ts in bad:
  a,b=BucketHit.objects.filter(bucket_id=bid,tool_id=tid,begin=ts)
  a.count+=b.count
  a.save()
  b.delete()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug crashmanager live-server Issues with fuzzmanager.f.m.o deployment P1
Projects
None yet
Development

No branches or pull requests

1 participant