#7647 Script to clean up, or code to handle, Dupe Key errors on wiki page_history [ss8446]

asf_release_1.2.0
closed
General
2015-02-21
2014-08-29
Dave Brondsema
No

Users get errors like the following from time to time when trying to save a wiki page. I think it may also occur occasionally for tickets. We should be able to clean this up easily, or better yet update the site code to handle the error automatically and continue.

File '/var/local/env-allura/lib/python2.7/site-packages/Ming-0.4.7-py2.7.egg/ming/session.py', line 162 in insert
  bson = self._impl(doc).insert(data, safe=kwargs.get('safe', True))
File '/var/local/env-allura/lib/python2.7/site-packages/TimerMiddleware-0.4.4-py2.7.egg/timermiddleware/__init__.py', line 117 in wrapper
  return self.run_and_log(func, inst, *args, **kwargs)
File '/var/local/env-allura/lib/python2.7/site-packages/TimerMiddleware-0.4.4-py2.7.egg/timermiddleware/__init__.py', line 126 in run_and_log
  return func(*args, **kwargs)
File '/var/local/env-allura/lib/python2.7/site-packages/pymongo-2.4.2-py2.7-linux-x86_64.egg/pymongo/collection.py', line 359 in insert
  continue_on_error, self.__uuid_subtype), safe)
File '/var/local/env-allura/lib/python2.7/site-packages/pymongo-2.4.2-py2.7-linux-x86_64.egg/pymongo/mongo_client.py', line 844 in _send_message
  rv = self.__check_response_to_last_error(response)
File '/var/local/env-allura/lib/python2.7/site-packages/pymongo-2.4.2-py2.7-linux-x86_64.egg/pymongo/mongo_client.py', line 785 in __check_response_to_last_error
  raise DuplicateKeyError(details["err"])
DuplicateKeyError: (u'E11000 duplicate key error index: project-data.page_history.$artifact_class_1_artifact_id_1_version_1
dup key: { : "forgewiki.model.wiki.Page", : ObjectId(\\'53bd2ee190954717fae54832\\'), : 51 }', 'doc:
{\\'import_id\\': None, \\'app_config_id\\': ObjectId(\\'538661d5c4d1041477a0e495\\'), \\'artifact_id\\': ObjectId(\\'53bd2ee190954717fae54832\\'),
    \\'author\\': {\\'username\\': u\\'kenlunde\\', \\'display_name\\': u\\'Dr. Ken Lunde\\', \\'id\\': ObjectId(\\'4cc585dcb9363c527a0000bf\\'),
    \\'logged_ip\\': \\'X.X.X.X\\'}, \\'deleted\\': False, \\'timestamp\\': datetime.datetime(2014, 8, 29, 15, 47, 3, 985000),
    \\'labels\\': [], \\'artifact_class\\': \\'forgewiki.model.wiki.Page\\', \\'acl\\': [], \\'version\\': 51,
    \\'mod_date\\': datetime.datetime(2014, 8, 29, 15, 47, 3, 987628), \\'_id\\': ObjectId(\\'5400a077485acd3627d716fe\\'),
    \\'data\\': {\\'import_id\\': None, \\'app_config_id\\': ObjectId(\\'538661d5c4d1041477a0e495\\'),
        \\'title\\': u\\'Release Notes\\', \\'deleted\\': False,
        \\'text\\': u\\'Test\\\\r\\\\n\\\\r\\\\n# Overview\\\\r\\\\n*Source Han Sans* is a set of OpenType/CFF Pan-CJK f.....

Discussion

  • Dave Brondsema
    Dave Brondsema
    2014-11-03

    • labels: support, 42cc, sf-current, sf-2 --> support, 42cc, sf-2
     
  • Dave Brondsema
    Dave Brondsema
    2015-01-05

    • Milestone: unreleased --> asf_release_1.2.0