department-of-veterans-affairs / veterans-employment-center

Veterans Employment Center
https://www.vets.gov/veterans-employment-center
5 stars 4 forks source link

Preview / Save resume page error #273

Closed koconnor719 closed 8 years ago

koconnor719 commented 8 years ago

When i build my resume using LinkedIn and try to preview and save it (i tested multiple times checking the the draft box not checking the draft box), i get a page error below. note: i tried this about 5 times--one time it did work properly?

screen shot 2016-04-07 at 8 25 45 am
ayaleloehr commented 8 years ago

Looking in the logs, this is what I see:

ActiveRecord::RecordNotUnique: ERROR: duplicate key value violates unique constraint "awards_pkey"DETAIL: Key (id)=(23563) already exists.
ayaleloehr commented 8 years ago

@koconnor719 what were you putting in the awards section? Can you take a screenshot of that section maybe for us to help debug?

koconnor719 commented 8 years ago
screen shot 2016-04-07 at 10 07 33 am
cfeeney-va commented 8 years ago

It looks like our database is out of sync and not assigning IDs to the awards table correctly. First fix described here fixed the issue locally for me: http://stackoverflow.com/questions/244243/how-to-reset-postgres-primary-key-sequence-when-it-falls-out-of-sync. Will discuss with @ayaleloehr to see if we can implement in production. Am also working on identifying why the sequence got set incorrectly.

cfeeney-va commented 8 years ago

After review, I couldn't find a reason the above would have occurred in production so I did some testing. In production, I receive this error intermittently and it doesn't seem to be related to the number of awards or their contents. If it were the above reason, I would expect to receive the error all the time I believe so going to research more.

koconnor719 commented 8 years ago

yes it continues to be intermittent; sometimes it's fine(--and then other times error message...seems like when i check the "draft" box the error happens more frequently.

cfeeney-va commented 8 years ago

It was the above issue; since not all IDs were taken in production, the save succeeded with it was incrementing to an unused ID and failed when it tried to use one that was already taken. Both the "awards" and "veterans" tables had this issue. Alex thinks it may have occurred when we moved to AWS. Sequences have been reset and it should work going forward.