sudoblockio / icon-governance-v1

0 stars 0 forks source link

Issue getting through backfill #26

Open robcxyz opened 2 years ago

robcxyz commented 2 years ago

From ES, right before crash.

{"timestamp": 1645048136.92667, "message": "set delegation 0x6aad8a13c15caaf4721eb89ee0794ee9fe806e5773218056e0e6977fbb255924"}
13:48:56.936
/opt/icon_governance/workers/delegations.py:57: SAWarning: DELETE statement on table "delegations" expected to delete 6 row(s); 0 were matched.  Please set confirm_deleted_rows=False within the mapper configuration to prevent this warning.
13:48:56.936
  session.commit()
13:48:56.941
Traceback (most recent call last):
13:48:56.941
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1802, in _execute_context
13:48:56.941
    self.dialect.do_execute(
13:48:56.941
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
13:48:56.941
    cursor.execute(statement, parameters)
13:48:56.941
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "delegations_pkey"
13:48:56.941
DETAIL:  Key (address, prep_address)=(hx17b32b10810eeb06ba2e9771620a635cba3fee5e, hx9121c5914ce34f59de52fe15efd6f7982c2ab8ae) already exists.
13:48:56.941
13:48:56.941
13:48:56.941
The above exception was the direct cause of the following exception:
13:48:56.941
13:48:56.941
Traceback (most recent call last):
13:48:56.941
  File "/opt/icon_governance/main_worker.py", line 79, in <module>
13:48:56.941
    main(args.worker_type)
13:48:56.941
  File "/opt/icon_governance/main_worker.py", line 32, in main
13:48:56.941
    transactions_worker_tail()
13:48:56.941
  File "/opt/icon_governance/workers/transactions.py", line 191, in transactions_worker_tail
13:48:56.942
    kafka.start()
13:48:56.942
  File "/opt/icon_governance/workers/kafka.py", line 186, in start
13:48:56.942
    self.process(msg)
13:48:56.942
  File "/opt/icon_governance/workers/transactions.py", line 146, in process
13:48:56.942
    set_delegation(
13:48:56.942
  File "/opt/icon_governance/workers/delegations.py", line 68, in set_delegation
13:48:56.942
    session.commit()
13:48:56.942
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1431, in commit
13:48:56.942
    self._transaction.commit(_to_root=self.future)
13:48:56.942
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 829, in commit
13:48:56.943
    self._prepare_impl()
13:48:56.943
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 808, in _prepare_impl
13:48:56.943
    self.session.flush()
13:48:56.943
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 3363, in flush
13:48:56.944
    self._flush(objects)
13:48:56.944
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 3503, in _flush
13:48:56.944
    transaction.rollback(_capture_exception=True)
13:48:56.944
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
13:48:56.945
    compat.raise_(
13:48:56.945
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
13:48:56.945
    raise exception
13:48:56.945
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 3463, in _flush
13:48:56.945
    flush_context.execute()
13:48:56.945
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 456, in execute
13:48:56.946
    rec.execute(self)
13:48:56.946
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 630, in execute
13:48:56.946
    util.preloaded.orm_persistence.save_obj(
13:48:56.946
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 244, in save_obj
13:48:56.946
    _emit_insert_statements(
13:48:56.946
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 1096, in _emit_insert_statements
13:48:56.946
    c = connection._execute_20(
13:48:56.946
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1614, in _execute_20
13:48:56.947
    return meth(self, args_10style, kwargs_10style, execution_options)
13:48:56.947
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 325, in _execute_on_connection
13:48:56.947
    return connection._execute_clauseelement(
13:48:56.947
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1481, in _execute_clauseelement
13:48:56.947
    ret = self._execute_context(
13:48:56.947
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1845, in _execute_context
13:48:56.948
    self._handle_dbapi_exception(
13:48:56.948
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2026, in _handle_dbapi_exception
13:48:56.948
    util.raise_(
13:48:56.948
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
13:48:56.948
    raise exception
13:48:56.948
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1802, in _execute_context
13:48:56.949
    self.dialect.do_execute(
13:48:56.949
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
13:48:56.949
    cursor.execute(statement, parameters)
13:48:56.949
sqlalchemy.exc.IntegrityError: (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint "delegations_pkey"
13:48:56.949
DETAIL:  Key (address, prep_address)=(hx17b32b10810eeb06ba2e9771620a635cba3fee5e, hx9121c5914ce34f59de52fe15efd6f7982c2ab8ae) already exists.
13:48:56.949
13:48:56.949
[SQL: INSERT INTO delegations (address, prep_address, value, last_updated_block) VALUES (%(address)s, %(prep_address)s, %(value)s, %(last_updated_block)s)]
13:48:56.949
[parameters: {"address": "hx17b32b10810eeb06ba2e9771620a635cba3fee5e", "prep_address": "hx9121c5914ce34f59de52fe15efd6f7982c2ab8ae", "value": Decimal("613998545468626300000"), "last_updated_block": 34002745}]
13:48:56.949
(Background on this error at: https://sqlalche.me/e/14/gkpj)
13:48:56.949
    self.dialect.do_execute(
13:48:56.949
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
13:48:56.949
    cursor.execute(statement, parameters)
13:48:56.949
sqlalchemy.exc.IntegrityError: (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint "delegations_pkey"
13:48:56.949
DETAIL:  Key (address, prep_address)=(hx17b32b10810eeb06ba2e9771620a635cba3fee5e, hx9121c5914ce34f59de52fe15efd6f7982c2ab8ae) already exists.
13:48:56.949
13:48:56.949
[SQL: INSERT INTO delegations (address, prep_address, value, last_updated_block) VALUES (%(address)s, %(prep_address)s, %(value)s, %(last_updated_block)s)]
13:48:56.949
[parameters: {"address": "hx17b32b10810eeb06ba2e9771620a635cba3fee5e", "prep_address": "hx9121c5914ce34f59de52fe15efd6f7982c2ab8ae", "value": Decimal("613998545468626300000"), "last_updated_block": 34002745}]
13:48:56.949
(Background on this error at: https://sqlalche.me/e/14/gkpj)