Skip to content
  • Leigh B. Stoller's avatar
    Fix rather serious indexing bug that was causing experiment indicies · 95ad01c1
    Leigh B. Stoller authored
    to be reused if the DB is dropped and recreated, since when that
    happens, auto_increment history is lost and it will go back to using
    the latest highest index in the table. Usually not a problem, but
    since we cross index three other tables using the experiment index,
    this causes quite a bit of grief.
    
    So, my solution is to do my own auto_increment using the
    experiment_stats table (locked of course), which we never delete
    entries from without deleting all entries from the other cross
    referenced tables.
    
        DBQueryFatal("select MAX(exptidx) from experiment_stats");
    
    I also added a sanity check to make sure the new index is not
    currently in use in any of the tables. I also cleaned up the
    error path when something goes wrong.
    95ad01c1