Hi Rob,

Yeah, setting the field to null. There are unique indexes on
(repository_id, commit_id) and (repository_id, changenum). It's fine for
there to be multiple review requests with the same changenum or commit_id
so long as they have different repository_ids.

If there are duplicates, it'd be good to figure out why, first of all (make
a note of the review request IDs), and then you should be able to set the
values to null for any that actually conflict. If you have review request
entries with public=false (unpublished) or status='D' (discarded), they may
be good candidates for setting to null in the event of a conflict.

I'd recommend backing up your database before performing any modifications.

Christian

On Wed, Jun 7, 2017 at 1:00 AM, 'Rob Backhurst' via reviewboard <
reviewboard@googlegroups.com> wrote:

> Hi Christian,
>
> Quick question from our DBA...
>
> -----------------------------------------
> what does they mean exactly by 'unset the field' - setting the field to
> null?
> I have checked both commit_id and changenum to identify the fields that
> have duplicate values (select commit_id, count(*) c from
> reviews_reviewrequest group by commit_id having c>1;) There are 12 rows for
> commit_id and 100 for changenum - should we change all of them?
> -----------------------------------------
>
> Thanks
> Rob
>
> On Friday, 26 May 2017 16:43:21 UTC+1, Rob Backhurst wrote:
>>
>> Hi Christian,
>>
>> Thanks for the quick response.
>> I'm not particularly comfortable with SQL but i'll ask a colleague if he
>> can help out - i'll let you know.
>>
>> Thanks
>> Rob
>>
>> On Friday, 26 May 2017 09:24:00 UTC+1, Rob Backhurst wrote:
>>>
>>> Hi,
>>>
>>> We have recently upgraded our ReviewBoard from version 1.7.22 to 2.5.10
>>> - as well as also upgrading from RHEL 6.x to CentOS 7.3.1611.
>>> Since then we have a review that cannot be interacted with...can't post
>>> a new review or comment, adjust existing comments etc - or even delete the
>>> review.
>>> We get a "HTTP 500 INTERNAL SERVER ERROR" from the browser and the
>>> following error in the ReviewBoard logs:
>>>
>>> --------------------------------
>>>
>>> None - admin - /api/review-requests/27393/ - Exception thrown for user 
>>> admin at 
>>> http://reviews/api/review-requests/27393/?api_format=json&force-text-type=html&include-text-types=raw
>>>
>>> (1062, "Duplicate entry '1701871-1' for key 
>>> 'reviews_reviewrequest_b8c24015'")
>>> Traceback (most recent call last):
>>>   File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", 
>>> line 112, in get_response
>>>     response = wrapped_callback(request, *callback_args, **callback_kwargs)
>>>   File "/usr/lib/python2.7/site-packages/django/views/decorators/cache.py", 
>>> line 52, in _wrapped_view_func
>>>     response = view_func(request, *args, **kwargs)
>>>   File "/usr/lib/python2.7/site-packages/django/views/decorators/vary.py", 
>>> line 19, in inner_func
>>>     response = func(*args, **kwargs)
>>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/resources/base.py", 
>>> line 196, in __call__
>>>     request, method, view, api_format=api_format, *args, **kwargs)
>>>   File 
>>> "/usr/lib/python2.7/site-packages/djblets/webapi/resources/mixins/api_tokens.py",
>>>  line 65, in call_method_view
>>>     return view(request, *args, **kwargs)
>>>   File "/usr/lib/python2.7/site-packages/djblets/util/decorators.py", line 
>>> 75, in _call
>>>     f = augmented_func(*args, **kwargs)
>>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/decorators.py", 
>>> line 122, in _call
>>>     return view_func(*args, **kwargs)
>>>   File "/usr/lib/python2.7/site-packages/reviewboard/webapi/decorators.py", 
>>> line 36, in _check
>>>     return view_func(*args, **kwargs)
>>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/decorators.py", 
>>> line 122, in _call
>>>     return view_func(*args, **kwargs)
>>>   File "/usr/lib/python2.7/site-packages/reviewboard/webapi/decorators.py", 
>>> line 139, in _check
>>>     return view_func(*args, **kwargs)
>>>   File "/usr/lib/python2.7/site-packages/djblets/util/decorators.py", line 
>>> 75, in _call
>>>     f = augmented_func(*args, **kwargs)
>>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/decorators.py", 
>>> line 122, in _call
>>>     return view_func(*args, **kwargs)
>>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/resources/base.py", 
>>> line 488, in get
>>>     etag = self.get_etag(request, obj, **kwargs)
>>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/resources/base.py", 
>>> line 1134, in get_etag
>>>     encode_etag=False, **kwargs)
>>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/resources/base.py", 
>>> line 1162, in generate_etag
>>>     etag = repr(self.serialize_object(obj, request=request, **kwargs))
>>>   File "/usr/lib/python2.7/site-packages/reviewboard/webapi/mixins.py", 
>>> line 60, in serialize_object
>>>     obj, *args, **kwargs)
>>>   File "/usr/lib/python2.7/site-packages/djblets/webapi/resources/base.py", 
>>> line 774, in serialize_object
>>>     value = serialize_func(obj, request=request)
>>>   File 
>>> "/usr/lib/python2.7/site-packages/reviewboard/webapi/resources/review_request.py",
>>>  line 561, in serialize_commit_id_field
>>>     return obj.commit
>>>   File 
>>> "/usr/lib/python2.7/site-packages/reviewboard/reviews/models/review_request.py",
>>>  line 273, in get_commit
>>>     commit_id=six.text_type(self.changenum))
>>>   File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 
>>> 493, in update
>>>     rows = query.get_compiler(self.db).execute_sql(None)
>>>   File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", 
>>> line 980, in execute_sql
>>>     cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
>>>   File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", 
>>> line 786, in execute_sql
>>>     cursor.execute(sql, params)
>>>   File "/usr/lib/python2.7/site-packages/django/db/backends/util.py", line 
>>> 53, in execute
>>>     return self.cursor.execute(sql, params)
>>>   File "/usr/lib/python2.7/site-packages/django/db/utils.py", line 99, in 
>>> __exit__
>>>     six.reraise(dj_exc_type, dj_exc_value, traceback)
>>>   File "/usr/lib/python2.7/site-packages/django/db/backends/util.py", line 
>>> 53, in execute
>>>     return self.cursor.execute(sql, params)
>>>   File "/usr/lib/python2.7/site-packages/django/db/backends/mysql/base.py", 
>>> line 124, in execute
>>>     return self.cursor.execute(query, args)
>>>   File "/usr/lib64/python2.7/site-packages/MySQLdb/cursors.py", line 205, 
>>> in execute
>>>     self.errorhandler(self, exc, value)
>>>   File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 
>>> 36, in defaulterrorhandler
>>>     raise errorclass, errorvalue
>>> IntegrityError: (1062, "Duplicate entry '1701871-1' for key 
>>> 'reviews_reviewrequest_b8c24015'")
>>>
>>>
>>> --------------------------------
>>>
>>>
>>> I've seen another similar post on this forum but no resolution.  
>>> (https://groups.google.com/forum/#!topic/reviewboard/7T9oAFHuLSU)
>>>
>>> Is there anything we can do here?
>>>
>>>
>>> Thanks
>>>
>>> Rob
>>>
>>>
>>> --
> Supercharge your Review Board with Power Pack:
> https://www.reviewboard.org/powerpack/
> Want us to host Review Board for you? Check out RBCommons:
> https://rbcommons.com/
> Happy user? Let us know! https://www.reviewboard.org/users/
> ---
> You received this message because you are subscribed to the Google Groups
> "reviewboard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to reviewboard+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Christian Hammond
President/CEO of Beanbag <https://www.beanbaginc.com/>
Makers of Review Board <https://www.reviewboard.org/>

-- 
Supercharge your Review Board with Power Pack: 
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: 
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to