yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #47013
[Bug 1543937] Re: db purge records fails for very large number
Reviewed: https://review.openstack.org/278268
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=02141ae7d7af5a9e04f0c64488dcfc8aeabf82f6
Submitter: Jenkins
Branch: master
commit 02141ae7d7af5a9e04f0c64488dcfc8aeabf82f6
Author: Ravi Shekhar Jethani <ravishekar.jethani@xxxxxxxxxxx>
Date: Wed Feb 10 00:58:01 2016 -0800
Add check to limit maximum value of max_rows
Currently archive_deleted_rows() fails if we provide
a very large number as input. This patch adds a check
to see that max_rows should not exceed db.MAX_INT and
provides a meaningful error message to the user.
Change-Id: I66a5d2cc7b7101e987ee89fcc7779bd9d5a4d144
Closes-Bug: #1543937
** Changed in: nova
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1543937
Title:
db purge records fails for very large number
Status in Glance:
In Progress
Status in OpenStack Compute (nova):
Fix Released
Bug description:
The command:
$ nova-manage db archive_deleted_rows <NUMBER> --verbose
fails for very large NUMBER value on nova master
Nova version:
openstack@openstack-136:/opt/stack/nova$ git log -1
commit 29641bd9778b51ac5794dfed9d4b881c5d47dc50
Merge: 21e79d5 9fbe683
Author: Jenkins <jenkins@xxxxxxxxxxxxxxxxxxxx>
Date: Wed Feb 10 06:03:00 2016 +0000
Merge "Top 100 slow tests: api.openstack.compute.test_api"
Example:
openstack@openstack-136:~$ nova-manage db archive_deleted_rows 2147483547647747477747474775366545456499999 --verbose
2016-02-09 22:17:10.713 ERROR oslo_db.sqlalchemy.exc_filters [-] DBAPIError exception wrapped from (pymysql.err.ProgrammingError) (1064, u"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2147483547647747477747474775366545456499999' at line 4") [SQL: u'INSERT INTO shadow_instance_actions_events (created_at, updated_at, deleted_at, deleted, id, event, action_id, start_time, finish_time, result, traceback, host, details) SELECT instance_actions_events.created_at, instance_actions_events.updated_at, instance_actions_events.deleted_at, instance_actions_events.deleted, instance_actions_events.id, instance_actions_events.event, instance_actions_events.action_id, instance_actions_events.start_time, instance_actions_events.finish_time, instance_actions_events.result, instance_actions_events.traceback, instance_actions_events.host, instance_actions_events.details \nFROM instance_actions_events \nWHERE instance_actions_events.deleted != %s ORDER BY instance_actions_events.id \n LIMIT %s'] [parameters: (0, 2147483547647747477747474775366545456499999L)]
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters Traceback (most recent call last):
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters context)
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 450, in do_execute
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters cursor.execute(statement, parameters)
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 146, in execute
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters result = self._query(query)
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 296, in _query
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters conn.query(q)
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 781, in query
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters self._affected_rows = self._read_query_result(unbuffered=unbuffered)
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 942, in _read_query_result
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters result.read()
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1138, in read
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters first_packet = self.connection._read_packet()
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 906, in _read_packet
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters packet.check_error()
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 367, in check_error
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters err.raise_mysql_exception(self._data)
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 120, in raise_mysql_exception
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters _check_mysql_exception(errinfo)
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 112, in _check_mysql_exception
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters raise errorclass(errno, errorvalue)
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters ProgrammingError: (1064, u"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2147483547647747477747474775366545456499999' at line 4")
2016-02-09 22:17:10.713 TRACE oslo_db.sqlalchemy.exc_filters
Command failed, please check log for more info
2016-02-09 22:17:10.716 CRITICAL nova [-] DBError: (pymysql.err.ProgrammingError) (1064, u"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2147483547647747477747474775366545456499999' at line 4") [SQL: u'INSERT INTO shadow_instance_actions_events (created_at, updated_at, deleted_at, deleted, id, event, action_id, start_time, finish_time, result, traceback, host, details) SELECT instance_actions_events.created_at, instance_actions_events.updated_at, instance_actions_events.deleted_at, instance_actions_events.deleted, instance_actions_events.id, instance_actions_events.event, instance_actions_events.action_id, instance_actions_events.start_time, instance_actions_events.finish_time, instance_actions_events.result, instance_actions_events.traceback, instance_actions_events.host, instance_actions_events.details \nFROM instance_actions_events \nWHERE instance_actions_events.deleted != %s ORDER BY instance_actions_events.id \n LIMIT %s'] [parameters: (0, 2147483547647747477747474775366545456499999L)]
2016-02-09 22:17:10.716 TRACE nova Traceback (most recent call last):
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/bin/nova-manage", line 10, in <module>
2016-02-09 22:17:10.716 TRACE nova sys.exit(main())
2016-02-09 22:17:10.716 TRACE nova File "/opt/stack/nova/nova/cmd/manage.py", line 1448, in main
2016-02-09 22:17:10.716 TRACE nova ret = fn(*fn_args, **fn_kwargs)
2016-02-09 22:17:10.716 TRACE nova File "/opt/stack/nova/nova/cmd/manage.py", line 951, in archive_deleted_rows
2016-02-09 22:17:10.716 TRACE nova table_to_rows_archived = db.archive_deleted_rows(max_rows)
2016-02-09 22:17:10.716 TRACE nova File "/opt/stack/nova/nova/db/api.py", line 1945, in archive_deleted_rows
2016-02-09 22:17:10.716 TRACE nova return IMPL.archive_deleted_rows(max_rows=max_rows)
2016-02-09 22:17:10.716 TRACE nova File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 6129, in archive_deleted_rows
2016-02-09 22:17:10.716 TRACE nova tablename, max_rows=max_rows - total_rows_archived)
2016-02-09 22:17:10.716 TRACE nova File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 6084, in _archive_deleted_rows_for_table
2016-02-09 22:17:10.716 TRACE nova conn.execute(insert)
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 914, in execute
2016-02-09 22:17:10.716 TRACE nova return meth(self, multiparams, params)
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
2016-02-09 22:17:10.716 TRACE nova return connection._execute_clauseelement(self, multiparams, params)
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
2016-02-09 22:17:10.716 TRACE nova compiled_sql, distilled_params
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
2016-02-09 22:17:10.716 TRACE nova context)
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1337, in _handle_dbapi_exception
2016-02-09 22:17:10.716 TRACE nova util.raise_from_cause(newraise, exc_info)
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 200, in raise_from_cause
2016-02-09 22:17:10.716 TRACE nova reraise(type(exception), exception, tb=exc_tb)
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
2016-02-09 22:17:10.716 TRACE nova context)
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 450, in do_execute
2016-02-09 22:17:10.716 TRACE nova cursor.execute(statement, parameters)
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 146, in execute
2016-02-09 22:17:10.716 TRACE nova result = self._query(query)
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 296, in _query
2016-02-09 22:17:10.716 TRACE nova conn.query(q)
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 781, in query
2016-02-09 22:17:10.716 TRACE nova self._affected_rows = self._read_query_result(unbuffered=unbuffered)
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 942, in _read_query_result
2016-02-09 22:17:10.716 TRACE nova result.read()
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1138, in read
2016-02-09 22:17:10.716 TRACE nova first_packet = self.connection._read_packet()
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 906, in _read_packet
2016-02-09 22:17:10.716 TRACE nova packet.check_error()
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 367, in check_error
2016-02-09 22:17:10.716 TRACE nova err.raise_mysql_exception(self._data)
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 120, in raise_mysql_exception
2016-02-09 22:17:10.716 TRACE nova _check_mysql_exception(errinfo)
2016-02-09 22:17:10.716 TRACE nova File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 112, in _check_mysql_exception
2016-02-09 22:17:10.716 TRACE nova raise errorclass(errno, errorvalue)
2016-02-09 22:17:10.716 TRACE nova DBError: (pymysql.err.ProgrammingError) (1064, u"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2147483547647747477747474775366545456499999' at line 4") [SQL: u'INSERT INTO shadow_instance_actions_events (created_at, updated_at, deleted_at, deleted, id, event, action_id, start_time, finish_time, result, traceback, host, details) SELECT instance_actions_events.created_at, instance_actions_events.updated_at, instance_actions_events.deleted_at, instance_actions_events.deleted, instance_actions_events.id, instance_actions_events.event, instance_actions_events.action_id, instance_actions_events.start_time, instance_actions_events.finish_time, instance_actions_events.result, instance_actions_events.traceback, instance_actions_events.host, instance_actions_events.details \nFROM instance_actions_events \nWHERE instance_actions_events.deleted != %s ORDER BY instance_actions_events.id \n LIMIT %s'] [parameters: (0, 2147483547647747477747474775366545456499999L)]
2016-02-09 22:17:10.716 TRACE nova
Instead of a stacktrace user should get a user friendly message like:
"max rows must be <= 2147483647"
To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1543937/+subscriptions
References