• 
      

    Add automatic migration from FileDiff to FileDiffData on access.

    Review Request #3815 — Created Jan. 30, 2013 and submitted

    Information

    Review Board
    master

    Reviewers

    Add automatic migration from FileDiff to FileDiffData on access.
    
    In 1.7, we added the FileDiffData model, which stores the data of a diff
    (be it a standard diff or a parent diff) in one place, hashed, in order
    to reduce file size. This was only applied to newer diffs, and older
    ones still had their data retrieved from the FileDiff.diff64 or
    FileDiff.parent_diff64 fields.
    
    This change adds automatic migration to FileDiffData when accessing
    either FileDiff.diff or FileDiff.parent_diff. When accessed, we check if
    there's an appropriate hash for the given field, and if not, we create a
    FileDiffData for both and move the data over.
    
    This ensures that we only ever read data from one spot now. As older
    review requests are accessed, the database may shrink in size (in
    general, assuming there are some redundant bits of diff data).
    
    Ensuring that there's always a FileDiffData when dealing with diff data
    simplifies some of our assumptions and will allow some new pieces of common
    information we'll add to exist in only one place as well.
    
    Unit tests were added to ensure that the migration paths work as
    expected, and clean up after the old data.
    All unit tests pass.
    
    Went through a bunch of my old review requests on my test server, some with
    parent diffs, and saw the diffs load correctly. Went through the server logs
    to make sure I saw the expected log entries.
    reviewbot
    1. This is a review from Review Bot.
        Tool: PEP8 Style Checker
        Processed Files:
          reviewboard/diffviewer/models.py
          reviewboard/diffviewer/tests.py
        Ignored Files:
      
      
    2. 
        
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to master (8652fd6f85b89416e6e470097ab8e98697392c35)