Re: CRITICAL:root:Error running database evolver function change_column_attr_unique:

2015-07-06 Thread John Schmitt
Thanks for looking at this, Christian.

When dumping my old database, I have the option of adding 'DROP TABLE' 
commands.  I've been doing that since I get different error messages 
without it.  Should I find a better way to dump and import?

I'm working on reproducing so that I can answer your question.

On Sunday, July 5, 2015 at 10:51:12 PM UTC-7, Christian Hammond wrote:

 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 - chi...@chipx86.com javascript:
 Review Board - https://www.reviewboard.org
 Beanbag, Inc. - https://www.beanbaginc.com

 On Sat, Jul 4, 2015 at 8:53 PM, John Schmitt marma...@gmail.com 
 javascript: 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 chri...@beanbaginc.com 
 javascript: wrote:

 Hi John,

 What versions of Review Board and Django Evolution are you using?

 Christian


 On Saturday, July 4, 2015, John Schmitt marma...@gmail.com javascript: 
 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 

Re: CRITICAL:root:Error running database evolver function change_column_attr_unique:

2015-07-05 Thread Christian Hammond
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; 

Re: CRITICAL:root:Error running database evolver function change_column_attr_unique:

2015-07-04 Thread Christian Hammond
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 javascript:_e(%7B%7D,'cvml','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 

Re: CRITICAL:root:Error running database evolver function change_column_attr_unique:

2015-07-04 Thread John Schmitt
# 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