3967: upgrade from 2.0.18 to 2.0.20 get error

shir*****@126**** (Google Code) (Is this you? Claim this profile.)
Sept. 15, 2015
What version are you running?
2.0.20

What's the URL of the page containing the problem?
http://shreview02

What steps will reproduce the problem?
1.sudo easy_install -U ReviewBoard
2.sudo rb-site upgrade /var/www/reviewboard
3.get the error

What is the expected output? What do you see instead?
It should be successfully, but I get the error:
Rebuilding directory structure
Updating database. This may take a while.

The log output below, including warnings and errors,
can be ignored unless upgrade fails.

------------------ <begin log output> ------------------
Creating tables ...
Project signature has changed - an evolution is required
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
The stored evolutions do not completely resolve all model changes.

Run `./manage.py evolve --hint` to see a suggestion for the changes required.

The following are the changes that could not be resolved:
In model reviews.ReviewRequest:
    Field 'description_rich_text' has been added
    Field 'testing_done_rich_text' has been added
In model reviews.Review:
    Field 'body_top_rich_text' has been added
    Field 'body_bottom_rich_text' has been added
In model reviews.ReviewRequestDraft:
    Field 'description_rich_text' has been added
    Field 'testing_done_rich_text' has been added
In model accounts.Profile:
    Field 'default_use_rich_text' has been added
CommandError: Your models contain changes that Django Evolution cannot resolve automatically.

I remember there is the same error last upgrade to 2.0.18, but I ignore it because I found the 2.0.18 version number when I login the reviewboard page.

What operating system are you using? What browser?
Ubuntu 12.04, chrome

yihuihu@shreview02:/var/www/dbback$ sudo rb-site manage /var/www/reviewboard evolve -- --hint
[sudo] password for yihuihu: 
#----- Evolution for accounts
from django_evolution.mutations import AddField
from django.db import models


MUTATIONS = [
    AddField('Profile', 'default_use_rich_text', models.NullBooleanField, null=True)
]
#----------------------
#----- Evolution for reviews
from django_evolution.mutations import AddField
from django.db import models


MUTATIONS = [
    AddField('ReviewRequest', 'description_rich_text', models.BooleanField, initial=False),
    AddField('ReviewRequest', 'testing_done_rich_text', models.BooleanField, initial=False),
    AddField('Review', 'body_top_rich_text', models.BooleanField, initial=False),
    AddField('Review', 'body_bottom_rich_text', models.BooleanField, initial=False),
    AddField('ReviewRequestDraft', 'description_rich_text', models.BooleanField, initial=False),
    AddField('ReviewRequestDraft', 'testing_done_rich_text', models.BooleanField, initial=False)
]
#----------------------
Trial evolution successful.
yihuihu@shreview02:/var/www/dbback$ sudo rb-site manage /var/www/reviewboard list-evolutions
Applied evolutions for 'auth':
    auth_delete_message
    auth_unique_together_baseline

Applied evolutions for 'contenttypes':
    contenttypes_unique_together_baseline

Applied evolutions for 'sessions':
    session_expire_date_db_index

Applied evolutions for 'accounts':
    is_private
    timezone
    open_an_issue
    extra_data
    timezone_length_30
    localsiteprofile_permissions
    unique_together_baseline
    profile_show_closed
    profile_should_send_email
    profile_should_send_own_updates
    profile_default_use_rich_text

Applied evolutions for 'attachments':
    file_attachment_orig_filename
    file_attachment_file_max_length_512
    file_attachment_repo_info
    file_attachment_repo_path_no_index
    file_attachment_repo_revision_max_length_64

Applied evolutions for 'changedescs':
    fields_changed_longtext
    rich_text

Applied evolutions for 'diffviewer':
    add_parent_diffs
    filediff_filenames_1024_chars
    diffset_basedir
    filediff_status
    add_diff_hash
    diffsethistory_diff_updated
    diffset_base_commit_id
    filediffdata_line_counts
    filediffdata_extra_data
    all_extra_data

Applied evolutions for 'hostingsvcs':
    account_hosting_url
    account_hosting_url_max_length_255
    account_unique_together_baseline

Applied evolutions for 'reviews':
    change_descriptions
    last_review_timestamp
    shipit_count
    default_reviewer_repositories
    null_repository
    localsite
    group_incoming_request_count
    group_invite_only
    group_visible
    default_reviewer_local_site
    add_issues_to_comments
    file_attachments
    file_attachment_comment_extra_data
    review_request_last_review_activity_timestamp
    review_request_depends_on
    commit_id
    file_attachment_comment_diff_id
    rich_text
    base_comment_extra_data
    unique_together_baseline
    extra_data
    review_request_issue_counts
    group_mailing_list_charfield
    review_request_draft_commit_id
    review_request_summary_index
    review_request_summary_index_manual
    split_rich_text

Applied evolutions for 'scmtools':
    bugzilla_url_charfield
    repository_raw_file_url
    repository_visible
    repository_path_length_255
    localsite
    repository_access_control
    group_site
    repository_hosting_accounts
    repository_extra_data_null
    unique_together_baseline
    repository_archive
    repository_hooks_uuid
    repository_raw_password

Applied evolutions for 'site':
    localsite_public


Please provide any additional information below.
#1 shir*****@126**** (Google Code) (Is this you? Claim this profile.)
admin --- database ---DJANGO_EVOLUTION --- versions:
Stored version, updated on 2015-02-12 02:23:19+00:00
	Hinted version, updated on 2015-02-12 02:23:19+00:00
	Stored version, updated on 2014-11-13 01:53:34+00:00
	Stored version, updated on 2014-08-08 02:26:47+00:00
	Stored version, updated on 2014-06-04 08:17:08+00:00
	Hinted version, updated on 2014-06-04 08:17:07+00:00
	Stored version, updated on 2014-04-22 23:13:10+00:00
	Stored version, updated on 2013-11-19 10:56:17+00:00
chipx86
#2 chipx86
Sounds like your database is in a bad state. It needs to be repaired, or this will just continue to happen, and upgrades to future versions will most likely fail.

Can you run the following and post the output:

    $ rb-site manage /path/to/site list-evolutions

    $ rb-site manage /path/to/site shell
    >>> from django_evolution.models import Version
    >>> for version in Version.objects.all():
    >>>      print version
  • +NeedInfo
#3 shir*****@126**** (Google Code) (Is this you? Claim this profile.)
yihuihu@shreview02:/var/www$ sudo rb-site manage /var/www/reviewboard list-evolutions
[sudo] password for yihuihu: 
Applied evolutions for 'auth':
    auth_delete_message
    auth_unique_together_baseline

Applied evolutions for 'contenttypes':
    contenttypes_unique_together_baseline

Applied evolutions for 'sessions':
    session_expire_date_db_index

Applied evolutions for 'accounts':
    is_private
    timezone
    open_an_issue
    extra_data
    timezone_length_30
    localsiteprofile_permissions
    unique_together_baseline
    profile_show_closed
    profile_should_send_email
    profile_should_send_own_updates
    profile_default_use_rich_text

Applied evolutions for 'attachments':
    file_attachment_orig_filename
    file_attachment_file_max_length_512
    file_attachment_repo_info
    file_attachment_repo_path_no_index
    file_attachment_repo_revision_max_length_64

Applied evolutions for 'changedescs':
    fields_changed_longtext
    rich_text

Applied evolutions for 'diffviewer':
    add_parent_diffs
    filediff_filenames_1024_chars
    diffset_basedir
    filediff_status
    add_diff_hash
    diffsethistory_diff_updated
    diffset_base_commit_id
    filediffdata_line_counts
    filediffdata_extra_data
    all_extra_data

Applied evolutions for 'hostingsvcs':
    account_hosting_url
    account_hosting_url_max_length_255
    account_unique_together_baseline

Applied evolutions for 'reviews':
    change_descriptions
    last_review_timestamp
    shipit_count
    default_reviewer_repositories
    null_repository
    localsite
    group_incoming_request_count
    group_invite_only
    group_visible
    default_reviewer_local_site
    add_issues_to_comments
    file_attachments
    file_attachment_comment_extra_data
    review_request_last_review_activity_timestamp
    review_request_depends_on
    commit_id
    file_attachment_comment_diff_id
    rich_text
    base_comment_extra_data
    unique_together_baseline
    extra_data
    review_request_issue_counts
    group_mailing_list_charfield
    review_request_draft_commit_id
    review_request_summary_index
    review_request_summary_index_manual
    split_rich_text

Applied evolutions for 'scmtools':
    bugzilla_url_charfield
    repository_raw_file_url
    repository_visible
    repository_path_length_255
    localsite
    repository_access_control
    group_site
    repository_hosting_accounts
    repository_extra_data_null
    unique_together_baseline
    repository_archive
    repository_hooks_uuid
    repository_raw_password

Applied evolutions for 'site':
    localsite_public

yihuihu@shreview02:/var/www$ 
#4 shir*****@126**** (Google Code) (Is this you? Claim this profile.)
for admin --- database --- django_evolution ----- versions, get the following list in web UI:
	Stored version, updated on 2015-02-12 02:23:19+00:00
	Hinted version, updated on 2015-02-12 02:23:19+00:00
	Stored version, updated on 2014-11-13 01:53:34+00:00
	Stored version, updated on 2014-08-08 02:26:47+00:00
	Stored version, updated on 2014-06-04 08:17:08+00:00
	Hinted version, updated on 2014-06-04 08:17:07+00:00
	Stored version, updated on 2014-04-22 23:13:10+00:00
	Stored version, updated on 2013-11-19 10:56:17+00:00
8 versions

I can not run the command with the error:
yihuihu@shreview02:/var/www$ sudo rb-site manage /var/www/reviewboard/ shell
Python 2.7.3 (default, Sep 26 2013, 20:03:06) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django_evolution.models import Version
>>> for version in Version.objects.all():
... print version
  File "<console>", line 2
    print version
        ^
IndentationError: expected an indented block
#5 shir*****@126**** (Google Code) (Is this you? Claim this profile.)
OK , I got the result from command line:

>>> from django_evolution.models import Version
>>> for version in Version.objects.all(): print version
... 
Hinted version, updated on 2015-02-12 02:23:19+00:00
Stored version, updated on 2015-02-12 02:23:19+00:00
Stored version, updated on 2014-11-13 01:53:34+00:00
Stored version, updated on 2014-08-08 02:26:47+00:00
Stored version, updated on 2014-06-04 08:17:08+00:00
Hinted version, updated on 2014-06-04 08:17:07+00:00
Stored version, updated on 2014-04-22 23:13:10+00:00
Stored version, updated on 2013-11-19 10:56:17+00:00
>>> 
chipx86
#6 chipx86
Okay, something to try:

First, back up your database. We will be doing something that might require re-loading it back in.

Second, go back in the Python shell and do:

    >>> from django_evolution.models import Version
    >>> v = Version.objects.all()[0]
    >>> print v

At that point, it should say "Hinted version, updated on 2015-02-12 02:23:19+00:00". If it doesn't, stop, and let me know.

Then do:

    >>> v.delete()

Then repeat the rb-site upgrade.
#7 shir*****@126**** (Google Code) (Is this you? Claim this profile.)
Thanks you very very very much, It works now.

>>> from django_evolution.models import Version
>>> v = Version.objects.all()[0]
>>> print v
Hinted version, updated on 2015-02-12 02:23:19+00:00
>>> v.delete()
>>> 

yihuihu@shreview02:/var/www$ sudo rb-site upgrade /var/www/reviewboard/
[sudo] password for yihuihu: 
Rebuilding directory structure
Updating database. This may take a while.

The log output below, including warnings and errors,
can be ignored unless upgrade fails.

------------------ <begin log output> ------------------
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
No evolution required.
------------------- <end log output> -------------------

Resetting in-database caches.

Upgrade complete!
chipx86
#8 chipx86
Glad to hear it! :)

We've seen this in a couple of cases, but it's very unclear why it's happening.
  • -NeedInfo
    +Fixed