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

EventSession cascade issues #351

Open
jace opened this issue Jul 13, 2016 · 0 comments
Open

EventSession cascade issues #351

jace opened this issue Jul 13, 2016 · 0 comments

Comments

@jace
Copy link
Member

jace commented Jul 13, 2016

Hasjob in production is occasionally reporting errors that appear to be caused by a badly configured cascade:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/rq/worker.py", line 568, in perform_job
    rv = job.perform()
  File "/usr/local/lib/python2.7/dist-packages/rq/job.py", line 495, in perform
    self._result = self.func(*self.args, **self.kwargs)
  File "./hasjob/views/helper.py", line 467, in save_jobview
    jvs = failsafe_add(db.session, jvs, event_session_id=event_session_id, jobpost_id=jobpost_id)
  File "/home/hasgeek/dependencies/coaster/coaster/sqlalchemy.py", line 813, in failsafe_add
    raise e
IntegrityError: (psycopg2.IntegrityError) insert or update on table "job_view_session" violates foreign key constraint "job_view_session_event_session_id_fkey"
DETAIL:  Key (event_session_id)=(2226388) is not present in table "event_session".
 [SQL: "INSERT INTO job_view_session (created_at, updated_at, datetime, event_session_id, jobpost_id, bgroup, cointoss, crosstoss) VALUES (TIMEZONE('utc', CURRENT_TIMESTAMP), TIMEZONE('utc', CURRENT_TIMESTAMP), %(datetime)s, %(event_session_id)s, %(jobpost_id)s, %(bgroup)s, %(cointoss)s, %(crosstoss)s)"] [parameters: {'event_session_id': 2226388, 'crosstoss': False, 'datetime': datetime.datetime(2016, 6, 2, 11, 46, 3, 729203), 'bgroup': None, 'cointoss': False, 'jobpost_id': 40618}]

If the EventSession has a primary key, it must have been present in the database at some point. Since there is no code to delete a session, it can only be missing because of a misconfigured cascade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant