Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • H hivemind
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 61
    • Issues 61
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 14
    • Merge requests 14
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • hive
  • hivemind
  • Issues
  • #183

Closed
Open
Created May 08, 2022 by Gandalf@gandalfMaintainer

DuplicateObject: constraint "hive_blocks_fk1" for relation "hive_blocks" already exists

While re-starting hive sync process (using 2b460e3c) Right after:

4856 INFO - hive.db.db_state - === FILLING FINAL DATA INTO TABLES ===
4856 INFO - hive.utils.stats - ####################
4856 INFO - hive.utils.stats - Total final operations time
4856 INFO - hive.utils.stats - `hive_posts`: Processed final operations in 1569.7813 seconds
4856 INFO - hive.utils.stats - `notification_cache`: Processed final operations in 110.1492 seconds
4856 INFO - hive.utils.stats - `hive_mentions`: Processed final operations in 27.0563 seconds
4856 INFO - hive.utils.stats - `hive_posts_api_helper`: Processed final operations in 13.5764 seconds
4856 INFO - hive.utils.stats - `follow_count`: Processed final operations in 8.1748 seconds
4856 INFO - hive.utils.stats - `blocks_consistency_flag`: Processed final operations in 4.0928 seconds
4856 INFO - hive.utils.stats - `communities_posts_and_rank`: Processed final operations in 1.6519 seconds
4856 INFO - hive.utils.stats - `payout_stats_view`: Processed final operations in 1.5658 seconds
4856 INFO - hive.utils.stats - `hive_feed_cache`: Processed final operations in 1.5112 seconds
4856 INFO - hive.utils.stats - Current final processing time: 1737.5598s.
4856 INFO - hive.db.db_state - Elapsed time: 1679.9329s. Calculated elapsed time: 1737.5598s. Difference: -57.6268s
4856 INFO - hive.db.db_state - === FILLING FINAL DATA INTO TABLES ===
4856 INFO - hive.db.db_state - Filling tables with final values: finished
4856 INFO - hive.db.db_state - Recreating foreign keys
4857 INFO - hive.db.adapter - Closing database connection: 'PostDataCache'
4857 INFO - hive.db.adapter - Closing database connection: 'Reputations'
4857 INFO - hive.db.adapter - Closing database connection: 'Votes'
4857 INFO - hive.db.adapter - Closing database connection: 'Follow'
4857 INFO - hive.db.adapter - Closing database connection: 'Posts'
4857 INFO - hive.db.adapter - Closing database connection: 'Reblog'
4857 INFO - hive.db.adapter - Closing database connection: 'Notify'
4857 INFO - hive.db.adapter - Closing database connection: 'Accounts'
4857 INFO - hive.db.adapter - Closing database connection: 'PayoutStats'
4857 INFO - hive.db.adapter - Closing database connection: 'Mentions'
4857 INFO - hive.db.adapter - Closing database connection: 'root db creation'
4857 INFO - hive.db.adapter - Closing database connection: 'create_fk'
4857 INFO - hive.db.adapter - Disposing SQL engine
4857 INFO - hive.conf - The database is disconnected...

failed with:

4857 Traceback (most recent call last):
4857   File "/home/hive/.local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1770, in _execute_context
4857     self.dialect.do_execute(
4857   File "/home/hive/.local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 717, in do_execute
4857     cursor.execute(statement, parameters)
4857 psycopg2.errors.DuplicateObject: constraint "hive_blocks_fk1" for relation "hive_blocks" already exists
4857
4857
4857 The above exception was the direct cause of the following exception:
4857
4857 Traceback (most recent call last):
4857   File "/home/hive/.local/bin/hive", line 8, in <module>
4857     sys.exit(run())
4857   File "/home/hive/.local/lib/python3.8/site-packages/hive/cli.py", line 73, in run
4857     launch_mode(mode, conf)
4857   File "/home/hive/.local/lib/python3.8/site-packages/hive/cli.py", line 87, in launch_mode
4857     sync.run()
4857   File "/home/hive/.local/lib/python3.8/site-packages/hive/indexer/sync.py", line 505, in run
4857     massive_sync.run()
4857   File "/home/hive/.local/lib/python3.8/site-packages/hive/indexer/sync.py", line 319, in run
4857     DbState.finish_initial_sync(current_imported_block)
4857   File "/home/hive/.local/lib/python3.8/site-packages/hive/db/db_state.py", line 68, in finish_initial_sync
4857     cls._after_initial_sync(current_imported_block)
4857   File "/home/hive/.local/lib/python3.8/site-packages/hive/db/db_state.py", line 539, in _after_initial_sync
4857     create_fk(cls.db())
4857   File "/home/hive/.local/lib/python3.8/site-packages/hive/db/schema.py", line 500, in create_fk
4857     connection.execute(AddConstraint(fk.constraint))
4857   File "/home/hive/.local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1262, in execute
4857     return meth(self, multiparams, params, _EMPTY_EXECUTION_OPTS)
4857   File "/home/hive/.local/lib/python3.8/site-packages/sqlalchemy/sql/ddl.py", line 77, in _execute_on_connection
4857     return connection._execute_ddl(
4857   File "/home/hive/.local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1352, in _execute_ddl
4857     ret = self._execute_context(
4857   File "/home/hive/.local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1813, in _execute_context
4857     self._handle_dbapi_exception(
4857   File "/home/hive/.local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1994, in _handle_dbapi_exception
4857     util.raise_(
4857   File "/home/hive/.local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
4857     raise exception
4857   File "/home/hive/.local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1770, in _execute_context
4857     self.dialect.do_execute(
4857   File "/home/hive/.local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 717, in do_execute
4857     cursor.execute(statement, parameters)
4857 sqlalchemy.exc.ProgrammingError: (psycopg2.errors.DuplicateObject) constraint "hive_blocks_fk1" for relation "hive_blocks" already exists
4857
4857 [SQL: ALTER TABLE hive_blocks ADD CONSTRAINT hive_blocks_fk1 FOREIGN KEY(prev) REFERENCES hive_blocks (hash)]
4857 (Background on this error at: http://sqlalche.me/e/14/f405)
Assignee
Assign to
Time tracking