Rework tracking of extension versioning for media and database updates.

Review Request #8782 — Created Feb. 25, 2017 and submitted

Information

Djblets
release-0.10.x
1f93180...

Reviewers

We previously used a database-stored setting for determining whether
database upgrades and static media installation was needed. This worked
okay for databases, but made media installation across multiple servers
tricky (since the first install would store the version and the next
would think it had the latest version). The recent Djblets work for
fixing some bad code ordering for extension initialization also ended up
regressing the versioning checks, causing database syncs to happen many
times during load.

This change reworks how version information is stored and accessed. The
database-stored setting still exists, but is now used to determine
whether we should synchronize/upgrade the database tables. It's no
longer used for static media at all. We can now be fine-grained with
setting this, fixing the problem of too many database syncs.

We're also careful to check for downgrades, in which case we don't want
to attempt a database sync that would surely fail (in this case, it's up
to the author to have a schema that works across the newer version and
older version that they may still have in production on another server,
or needed to revert down to).

The version information for static media now lives in a file in the
extension's static media directory. If it doesn't exist, or doesn't
match the current version (it's older or even newer), we re-install
static media. Since that file is local, the installation of the media
has no effect on other servers.

We also no longer install htdocs media. That's been deprecated for a
long while now. We do still look for htdocs media and log a warning so
that authors will hopefully notice it and migrate to shipping a static
directory.

Unit tests have been updated to test the various conditions for both
database synchronization and media installation.

Unit tests pass.

Tested that extensions weren't repeatedly triggering a syncdb during
the loading of the extension manager (most noticeable with management
commands).

Tested media installation and manipulation of the version file.

Tested database synchronization and manipulation of the version setting.

Description From Last Updated

local variable 'extension' is assigned to but never used

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/extensions/manager.py
        djblets/extensions/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/extensions/manager.py
        djblets/extensions/tests.py
    
    
  2. djblets/extensions/manager.py (Diff revision 1)
     
     
     local variable 'extension' is assigned to but never used
    
  3. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/extensions/manager.py
        djblets/extensions/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/extensions/manager.py
        djblets/extensions/tests.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-0.10.x (636c0f2)
Loading...