couchdbkit.exceptions.ResourceConflict

Hi Dears,

cchq echis django-manage ptop_reindexer_v2 user --cleanup generated below error message after upgrading the OS to Ubuntu 22.04 with CouchDB 3.3.1.

The following steps were followed to upgrade

  1. couchdb_version: 3.3.1 is added to public.yml file.
  2. cchq deploy_stack.yml --limit=couch1,couch2,couch3,couch4
  3. The data is copied to the new machines (/opt/data/)
  4. cchq echis deploy

Is there any missing step?

Traceback (most recent call last):
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/python_env/lib/python3.9/site-packages/couchdbkit/client.py", line 523, in save_doc
    put_resp.raise_for_status()
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/python_env/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 409 Client Error: Conflict conflict Document update conflict. for url: http://172.19.3.39:25984/commcarehq__meta/c08e2594bd7d844a32a68ba3ada1b2576b66d199

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/manage.py", line 189, in <module>
    main()
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/manage.py", line 47, in main
    execute_from_command_line(sys.argv)
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/python_env/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/python_env/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/corehq/apps/hqcase/management/commands/ptop_reindexer_v2.py", line 68, in run_from_argv
    super(SubCommand, self).run_from_argv(argv)
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/python_env/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/python_env/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/corehq/apps/hqcase/management/commands/ptop_reindexer_v2.py", line 140, in handle
    reindexer.reindex()
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/corehq/ex-submodules/pillowtop/reindexer/reindexer.py", line 273, in reindex
    processor.run()
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/corehq/util/doc_processor/interface.py", line 119, in run
    for doc in self.document_iterator:
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/corehq/util/doc_processor/couch.py", line 79, in __iter__
    for result in super(ResumableDocsIterator, self).__iter__():
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/corehq/util/pagination.py", line 263, in __iter__
    for item in paginate_function(self.data_function, resumable_args, event_handler):
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/corehq/util/pagination.py", line 141, in paginate_function
    event_handler.page_start(total_emitted, *args, **kwargs)
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/corehq/util/pagination.py", line 61, in page_start
    handler.page_start(total_emitted, *args, **kwargs)
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/corehq/util/pagination.py", line 327, in page_start
    self.iterator._save_state()
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/corehq/util/pagination.py", line 297, in _save_state
    self._save_state_json(state_json)
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/corehq/ex-submodules/dimagi/utils/retry.py", line 31, in retry
    return func(*args, **kw)
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/corehq/util/pagination.py", line 302, in _save_state_json
    self.couch_db.save_doc(state_json)
  File "/home/cchq/www/echis/releases/2023-06-21_22.24/python_env/lib/python3.9/site-packages/couchdbkit/client.py", line 534, in save_doc
    raise ResourceConflict
couchdbkit.exceptions.ResourceConflict

Warning message in the log file:

[warning] 2023-06-22T11:32:12.670659Z couchdb@172.19.3.35 <0.22040.1956> 0abd3eb2e0 couch_db start_seq duplicate uuid on node: 'couchdb@172.19.3.35' db: <<"shards/20000000-3fffffff/commcarehq__domains.1527170341">>, seq: 760, uuid: <<"a8eddf1">>, epoch_node: 'couchdb@172.19.3.37'
[warning] 2023-06-22T11:32:12.670769Z couchdb@172.19.3.35 <0.22957.1955> 0abd3eb2e0 couch_db start_seq duplicate uuid on node: 'couchdb@172.19.3.35' db: <<"shards/c0000000-dfffffff/commcarehq__domains.1527170341">>, seq: 320, uuid: <<"1391c7c">>, epoch_node: 'couchdb@172.19.3.37'
[warning] 2023-06-22T11:32:12.671244Z couchdb@172.19.3.35 <0.11914.1953> 0abd3eb2e0 couch_db start_seq duplicate uuid on node: 'couchdb@172.19.3.35' db: <<"shards/00000000-1fffffff/commcarehq__domains.1527170341">>, seq: 409, uuid: <<"7d52183">>, epoch_node: 'couchdb@172.19.3.37'
[warning] 2023-06-22T11:32:12.684835Z couchdb@172.19.3.35 <0.12807.1955> 4eb7504c7f couch_db start_seq duplicate uuid on node: 'couchdb@172.19.3.35' db: <<"shards/e0000000-ffffffff/commcarehq.1527170302">>, seq: 8904, uuid: <<"35fbd98">>, epoch_node: 'couchdb@172.19.4.49'
[warning] 2023-06-22T11:32:12.684933Z couchdb@172.19.3.35 <0.4168.1956> 4eb7504c7f couch_db start_seq duplicate uuid on node: 'couchdb@172.19.3.35' db: <<"shards/00000000-1fffffff/commcarehq.1527170302">>, seq: 6456, uuid: <<"380ec4a">>, epoch_node: 'couchdb@172.19.4.49'
[warning] 2023-06-22T11:32:12.685352Z couchdb@172.19.3.35 <0.15196.1956> 4eb7504c7f couch_db start_seq duplicate uuid on node: 'couchdb@172.19.3.35' db: <<"shards/60000000-7fffffff/commcarehq.1527170302">>, seq: 8254, uuid: <<"9a12ca5">>, epoch_node: 'couchdb@172.19.4.49'
[warning] 2023-06-22T11:32:12.685522Z couchdb@172.19.3.35 <0.27562.1956> 4eb7504c7f couch_db start_seq duplicate uuid on node: 'couchdb@172.19.3.35' db: <<"shards/40000000-5fffffff/commcarehq.1527170302">>, seq: 6163, uuid: <<"c347a33">>, epoch_node: 'couchdb@172.19.4.49'
[notice] 2023-06-22T11:32:12.807905Z couchdb@172.19.3.35 <0.18509.1954> 0efa4321a2 172.19.3.39:25984 172.19.3.75 admin GET /commcarehq__apps/4b9bb1b2c49542e7a3bb83110859980c 200 ok 424
[notice] 2023-06-22T11:32:12.827523Z couchdb@172.19.3.35 <0.29519.1954> 98a38ec073 172.19.3.39:25984 172.19.3.75 admin GET /commcarehq__domains/ef78c9b152021ceac5685ca58e040d78 200 ok 26
[notice] 2023-06-22T11:32:12.949358Z couchdb@172.19.3.35 <0.23595.1954> 3b79565c14 172.19.3.39:25984 172.19.3.75 admin GET /commcarehq__apps/4a4e2852c067734bfbdc281c0cf2ec35 200 ok 32
[notice] 2023-06-22T11:32:12.984576Z couchdb@172.19.3.35 <0.26851.1956> f979b3cbbf 172.19.3.39:25984 172.19.3.75 admin GET /commcarehq__domains/57fd2aad42e470550d0325dfed58158c 200 ok 16

First refresh:

Second refresh:

Thank you,

The nodes have different UUIDs in their respective couchdb.ini.