autoincrementing save for EventLog, EMObservation, EMFootprint, EMBBEventLog
There is a problem with the way numbers are determined for EventLogs which leads to the server essentially DOS-ing itself. This issue is also prevalent in 3 other classes (EMBBEventLog, EMObservation, EMFootprint), but we don't notice problems there because they're more lightly used.
A brief overview of what I did:
- Created a new abstract class (AutoIncrementModel) which the 4 classes in question now derive from.
- Gave this abstract class a save method which generates and executes raw SQL to increment the counter and insert a new row into the database in a single query. This prevents the concurrency issue which Branson or Brian was trying to circumvent by catching a database error and repeating the attempt in a while loop (gross).
- I've run several tests with creating events and writing objects for each of the classes, the gracedb-client unit tests, and tried to bombard the server using a script Leo wrote. All of my tests indicate that the issue is resolved and things are operating normally otherwise.