Hi John,

It looks like what's happening is that the database upgrade process is
expecting your old database to have a unique index/constraint for a field
(marking a particular column as being unique across entries in the table),
which it doesn't have for some reason.

What I'd suggest is:

1) Restoring the database backup and getting a list of all indexes on the
database.
2) Running:

    rb-site manage /path/to/site evolve -- --sql

... and dumping that to a file.

3) Find what indexes/constraints are being removed/changed that aren't
present in the original database. If this isn't clear, go ahead and post
both sets of data here.
4) Add any indexes that are missing.

Christian

-- 
Christian Hammond - chip...@chipx86.com
Review Board - https://www.reviewboard.org
Beanbag, Inc. - https://www.beanbaginc.com

On Sat, Jul 4, 2015 at 8:53 PM, John Schmitt <marmalo...@gmail.com> wrote:

> # rpm -q ReviewBoard python-djblets python-django-evolution
> ReviewBoard-2.0.17-1.el7.noarch
> python-djblets-0.8.20-1.el7.noarch
> python-django-evolution-0.7.5-1.el7.noarch
>
> On Sat, Jul 4, 2015 at 12:53 PM, Christian Hammond <
> christ...@beanbaginc.com> wrote:
>
>> Hi John,
>>
>> What versions of Review Board and Django Evolution are you using?
>>
>> Christian
>>
>>
>> On Saturday, July 4, 2015, John Schmitt <marmalo...@gmail.com> wrote:
>>
>>> Something seems to go wrong during my upgrade.  What do I need to do to
>>> make this work?
>>>
>>> This is my script that ought to upgrade my installation from 1.55 to 2.0
>>>
>>> #!/bin/bash
>>>
>>>
>>> export PS4='+(${BASH_SOURCE}:${LINENO}):
>>> ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
>>> set -x
>>> set -e
>>> set -u
>>>
>>>
>>> systemctl stop httpd
>>>
>>>
>>> # perform a fresh installation of ReviewBoard
>>> rm -rf /var/www/reviews.domain.com
>>> mysql --password=password -e 'drop database if exists reviewboard;'
>>> mysql --password=password -e 'create database reviewboard;'
>>> rb-site install /var/www/reviews.domain.com --noinput
>>>        \
>>>                                             --opt-out-support-data
>>>         \
>>>                                             --domain-name='
>>> reviews.domain.com' \
>>>                                             --site-root='/'
>>>        \
>>>                                             --static-url='static/'
>>>         \
>>>                                             --media-url='media/'
>>>         \
>>>                                             --db-type='mysql'
>>>        \
>>>                                             --db-name='reviewboard'
>>>        \
>>>                                             --db-user='root'
>>>         \
>>>                                             --db-pass='password'
>>>         \
>>>                                             --db-host='localhost'
>>>        \
>>>                                             --cache-type='memcached'
>>>         \
>>>                                             --cache-info=
>>> 'localhost:11211'     \
>>>                                             --web-server-type='apache'
>>>         \
>>>                                             --web-server-port='80'
>>>         \
>>>                                             --python-loader='wsgi'
>>>         \
>>>                                             --admin-user='admin'
>>>         \
>>>                                             --admin-password='password'
>>>        \
>>>                                             --admin-email='
>>> jschm...@domain.com'
>>> chown -R apache.apache "/var/www/reviews.domain.com/data"
>>> chown -R apache.apache "/var/www/reviews.domain.com/htdocs/media/ext"
>>> chown -R apache.apache "/var/www/
>>> reviews.domain.com/htdocs/media/uploaded"
>>> chown -R apache.apache "/var/www/reviews.domain.com/htdocs/static/ext"
>>> mkdir "/var/www/reviews.domain.com/search-index"
>>> chown -R apache.apache "/var/www/reviews.domain.com/search-index"
>>>
>>>
>>> # import the reviewboard data from the old reviewobard installation
>>> # general.log grows too big so I delete it but I have to restart mariadb
>>> so it'll create a fresh one
>>> rm -rf /var/log/mariadb/general.log
>>> mysql --password=password < /root/reviewboard.dump
>>> rm -rf /var/log/mariadb/general.log
>>> systemctl restart mariadb
>>>
>>>
>>> # the old installation was stored at /data/...
>>> # the new installation is stored at /var/www/reviews.domain.com/...
>>> # the new installation directory has to be manually set in the
>>> siteconfig_siteconfiguration table
>>> # the siteconfig_siteconfiguration is a giant json string
>>> #mysql --password=password --batch --skip-column-names -e 'use
>>> reviewboard; select settings from siteconfig_siteconfiguration;' | grep
>>> '^{' > siteconfig_siteconfiguration.text
>>> mysql --password=password --batch --skip-column-names -e 'use
>>> reviewboard; select settings from siteconfig_siteconfiguration;' >
>>> siteconfig_siteconfiguration.text
>>> sed -i 's|/data/django-sites/ReviewBoard|/var/www/reviews.domain.com|'
>>> siteconfig_siteconfiguration.text
>>> sed -i 's|data/django-sites/ReviewBoard|/var/www/reviews.domain.com|'
>>> siteconfig_siteconfiguration.text
>>> # the giant json string needs to be quoted so bash won't munge it; is
>>> there a better way?
>>> /usr/bin/echo -n 'use reviewboard; update siteconfig_siteconfiguration
>>> set settings=' > siteconfig.command0
>>> /usr/bin/echo -n "'" >> siteconfig.command0
>>> cat siteconfig_siteconfiguration.text >> siteconfig.command0
>>> /usr/bin/echo -n "'" >> siteconfig.command0
>>> # `cat` seems to put in a newline I do not want
>>> tr -d '\n' < siteconfig.command0 > siteconfig.command
>>> # print the final command, for debugging
>>> /usr/bin/echo ------------------------------
>>> cat siteconfig.command
>>> /usr/bin/echo ------------------------------
>>> mysql --password=password < siteconfig.command
>>> rb-site upgrade /var/www/reviews.domain.com
>>> systemctl start httpd
>>>
>>> This seems to work but then I see this when I try to start httpd:
>>>
>>> Jul 04 11:07:32 dyn40-62-43.tintri.com systemd[1]: Starting The Apache
>>> HTTP Server...
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: CRITICAL:root:
>>> Error running database evolver function change_column_attr_unique:
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: Traceback (most
>>> recent call last):
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: File
>>> "/usr/lib/python2.7/site-packages/django_evolution/db/common.py", line
>>> 495, in change_column_attrs
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: attr_info[
>>> 'new_value'])
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: File
>>> "/usr/lib/python2.7/site-packages/django_evolution/db/common.py", line
>>> 607, in change_column_attr_unique
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: self.
>>> remove_recorded_index(model, constraint_name, unique=True)
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: File
>>> "/usr/lib/python2.7/site-packages/django_evolution/db/common.py", line
>>> 822, in remove_recorded_index
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: index_name, unique
>>> =unique)
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: File
>>> "/usr/lib/python2.7/site-packages/django_evolution/signature.py", line
>>> 186, in remove_index_from_database_sig
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: assert index_name
>>> in indexes
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: AssertionError
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: ERROR:root:
>>> Unexpected error:
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: Traceback (most
>>> recent call last):
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: File
>>> "/usr/lib/python2.7/site-packages/django_evolution/management/commands/evolve.py"
>>> , line 65, in handle
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: self.evolve(*
>>> app_labels, **options)
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: File
>>> "/usr/lib/python2.7/site-packages/django_evolution/management/commands/evolve.py"
>>> , line 125, in evolve
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: sql.extend(self.
>>> evolve_app(app))
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: File
>>> "/usr/lib/python2.7/site-packages/django_evolution/management/commands/evolve.py"
>>> , line 165, in evolve_app
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: app_mutator_sql =
>>> app_mutator.to_sql()
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: File
>>> "/usr/lib/python2.7/site-packages/django_evolution/mutators.py", line
>>> 304, in to_sql
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: sql.extend(mutator
>>> .to_sql())
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: File
>>> "/usr/lib/python2.7/site-packages/django_evolution/mutators.py", line
>>> 187, in to_sql
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: return self.
>>> evolver.generate_table_ops_sql(self, self._ops)
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: File
>>> "/usr/lib/python2.7/site-packages/django_evolution/db/common.py", line
>>> 42, in generate_table_ops_sql
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: prev_sql_result,
>>> prev_op)
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: File
>>> "/usr/lib/python2.7/site-packages/django_evolution/db/common.py", line
>>> 84, in generate_table_op_sql
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: op['new_attrs']))
>>> Jul 04 11:07:44 dyn40-62-43.tintri.com rb-site[2066]: File
>>> "/usr/lib/python2.7/site-packages/django_evolution/db/common.py", line
>>> 495, in change_column_attrs
>>> Jul 04 11:07:45 dyn40-62-43.tintri.com rb-site[2066]: attr_info[
>>> 'new_value'])
>>> Jul 04 11:07:45 dyn40-62-43.tintri.com rb-site[2066]: File
>>> "/usr/lib/python2.7/site-packages/django_evolution/db/common.py", line
>>> 607, in change_column_attr_unique
>>> Jul 04 11:07:45 dyn40-62-43.tintri.com rb-site[2066]: self.
>>> remove_recorded_index(model, constraint_name, unique=True)
>>> Jul 04 11:07:45 dyn40-62-43.tintri.com rb-site[2066]: File
>>> "/usr/lib/python2.7/site-packages/django_evolution/db/common.py", line
>>> 822, in remove_recorded_index
>>> Jul 04 11:07:45 dyn40-62-43.tintri.com rb-site[2066]: index_name, unique
>>> =unique)
>>>
>>
>>
>> --
>> --
>> Christian Hammond - christ...@beanbaginc.com
>> Review Board - https://www.reviewboard.org
>> Beanbag, Inc. - https://www.beanbaginc.com
>>
>>  --
>> Supercharge your Review Board with Power Pack:
>> https://www.reviewboard.org/powerpack/
>> Want us to host Review Board for you? Check out RBCommons:
>> https://rbcommons.com/
>> Happy user? Let us know! https://www.reviewboard.org/users/
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "reviewboard" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/reviewboard/oT0NC1Bcokk/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> reviewboard+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> Supercharge your Review Board with Power Pack:
> https://www.reviewboard.org/powerpack/
> Want us to host Review Board for you? Check out RBCommons:
> https://rbcommons.com/
> Happy user? Let us know! https://www.reviewboard.org/users/
> ---
> You received this message because you are subscribed to the Google Groups
> "reviewboard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to reviewboard+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Supercharge your Review Board with Power Pack: 
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: 
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to