fastmonkeys / stellar

Fast database snapshot and restore tool for development
MIT License
3.86k stars 119 forks source link

Doesn't work. #27

Closed tcn closed 9 years ago

tcn commented 10 years ago
$ pip install stellar

...

$ stellar version
Stellar 0.3.2
$ stellar list

$ stellar snapshot foo
Snapshotting database foo
$ stellar restore foo
Restoring database foo
Traceback (most recent call last):
  File "/usr/local/bin/stellar", line 9, in <module>
    load_entry_point('stellar==0.3.2', 'console_scripts', 'stellar')()
  File "/usr/local/lib/python2.7/site-packages/stellar/command.py", line 225, in main
    stellar()
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 609, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 589, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 935, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 781, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/stellar/command.py", line 109, in restore
    app.restore(snapshot)
  File "/usr/local/lib/python2.7/site-packages/stellar/app.py", line 160, in restore
    table.table_name
  File "/usr/local/lib/python2.7/site-packages/stellar/operations.py", line 97, in rename_database
    to_database
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 721, in execute
    return self._execute_text(object, multiparams, params)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 870, in _execute_text
    statement, parameters
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 958, in _execute_context
    context)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1160, in _handle_dbapi_exception
    exc_info
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 951, in _execute_context
    context)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 436, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (OperationalError) terminating connection due to administrator command
FATAL:  terminating connection due to administrator command
 '\n                ALTER DATABASE "stellar_foo_dcff08a82816ac154115a44e72505d74_slave" RENAME TO "foo"\n            ' {}

Could flawlessly execute the mentioned ALTER manually.

Teemu commented 9 years ago

Can't reproduce. Could you add "logging: true" to stellar.yaml the next time if this happens again?

tcn commented 9 years ago

Sure, doesn't look too helpful at first sight, though. This is on OSX, BTW. If you need any other information, just tell me.

foo> stellar version
Stellar 0.4.1

foo> stellar snapshot
DEBUG:stellar.operations:database_exists('stellar_data')
Snapshotting database foo
DEBUG:stellar.app:Copying foo to stellar_b52ccc52093f716f
DEBUG:stellar.operations:copy_database('foo', 'stellar_b52ccc52093f716f')
DEBUG:stellar.operations:terminate_database_connections('foo')
DEBUG:stellar.app:Starting background slave copy
DEBUG:stellar.operations:database_exists('stellar_data')
DEBUG:stellar.operations:copy_database('stellar_b52ccc52093f716f', 'stellar_d50f0e7151865322')
DEBUG:stellar.operations:terminate_database_connections('stellar_b52ccc52093f716f')

foo> stellar list
DEBUG:stellar.operations:database_exists('stellar_data')
snap1: 15 seconds ago

foo> stellar restore snap1
DEBUG:stellar.operations:database_exists('stellar_data')
Restoring database foo
DEBUG:stellar.operations:database_exists('stellar_d50f0e7151865322')
DEBUG:stellar.operations:remove_database(u'foo')
DEBUG:stellar.operations:terminate_database_connections(u'foo')
DEBUG:stellar.operations:rename_database('stellar_d50f0e7151865322', u'foo')
DEBUG:stellar.operations:terminate_database_connections('stellar_d50f0e7151865322')
Traceback (most recent call last):
  File "/usr/local/bin/stellar", line 9, in <module>
    load_entry_point('stellar==0.4.1', 'console_scripts', 'stellar')()
  File "/usr/local/lib/python2.7/site-packages/stellar/command.py", line 264, in main
    stellar()
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/stellar/command.py", line 128, in restore
    app.restore(snapshot)
  File "/usr/local/lib/python2.7/site-packages/stellar/app.py", line 166, in restore
    table.table_name
  File "/usr/local/lib/python2.7/site-packages/stellar/operations.py", line 117, in rename_database
    terminate_database_connections(raw_conn, from_database)
  File "/usr/local/lib/python2.7/site-packages/stellar/operations.py", line 30, in terminate_database_connections
    version = map(int, raw_conn.execute('SHOW server_version;').first()[0].split('.'))
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 721, in execute
    return self._execute_text(object, multiparams, params)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 870, in _execute_text
    statement, parameters
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 958, in _execute_context
    context)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1160, in _handle_dbapi_exception
    exc_info
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 951, in _execute_context
    context)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 436, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (OperationalError) terminating connection due to administrator command
FATAL:  terminating connection due to administrator command
 'SHOW server_version;' {}
izelnakri commented 9 years ago

I'm having exactly the same issue.