cockroachdb / movr

A fictional ride sharing company.
Apache License 2.0
33 stars 14 forks source link

transaction retry error during init #82

Open nstewart opened 5 years ago

nstewart commented 5 years ago

Trying to reload an existing database results in a retriable error. dropping the database manually doesnt help.

Need a pattern for dropping tables in SQLAlchemy. Currently we do

logging.info("initializing tables")
            Base.metadata.drop_all(bind=self.engine)
            Base.metadata.create_all(bind=self.engine)
            logging.debug("tables dropped and created")

[INFO] (MainThread) initializing tables
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 761, in _commit_impl
    self.engine.dialect.do_commit(self.connection)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 505, in do_commit
    dbapi_connection.commit()
psycopg2.errors.SerializationFailure: restart transaction: TransactionRetryWithProtoRefreshError: TransactionRetryError: retry txn (RETRY_SERIALIZABLE): "sql txn" id=dc48af95 key=/Table/SystemConfigSpan/Start rw=true pri=0.02292581 stat=PENDING epo=0 ts=1555378825.925710804,1 orig=1555378825.387530255,0 max=1555378825.505131171,0 wto=false seq=8```