• 
      

    Fix lost FileDiffs when using condensediffs on Postgres.

    Review Request #8161 — Created May 13, 2016 and submitted

    Information

    Review Board
    release-2.5.x

    Reviewers

    The condensediffs management command was trying to determine whether a
    more efficient update can be performed for batch-updating FileDiffs when
    migrating to the new diff storage format. However, the way it was doing
    this was only compatible with MySQL, resulting in it falling back to the
    slower method for Postgres.
    
    Unfortunately, the slower method also failed to update entries on
    Postgres, and this would result in FileDiffs retaining their relations
    to the old objects. Those objects would then be deleted, deleting the
    FileDiffs as well, which is a pretty serious bug. Somehow, we haven't
    heard of this in the wild (and it only happens explicitly with
    condensediffs).
    
    This fixes this by both fixing the cause of the failed updates (a bad
    "__in" that works in SQLite but not Postgres) and by getting rid of the
    "generic" check for the smarter updating, replacing it with specific
    code for MySQL and for Postgres.
    
    Condensing also now performs sanity-checks when DEBUG is True, to help
    us catch issues sooner.

    Tested on MySQL, Postgres, and SQLite, with large numbers of diffs.
    Verified that the diffs had the expected content in the end. The
    sanity checks also passed.

    Description From Last Updated

    'DatabaseError' imported but unused

    reviewbotreviewbot

    'cached_property' imported but unused

    reviewbotreviewbot
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/diffviewer/managers.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/diffviewer/managers.py
      
      
    2. reviewboard/diffviewer/managers.py (Diff revision 1)
       
       
      Show all issues
       'DatabaseError' imported but unused
      
    3. reviewboard/diffviewer/managers.py (Diff revision 1)
       
       
      Show all issues
       'cached_property' imported but unused
      
    4. 
        
    chipx86
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/diffviewer/managers.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/diffviewer/managers.py
      
      
    2. 
        
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-2.5.x (1a41af2)