You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/06/28 08:50:39 UTC
[GitHub] [pulsar] se7enkings edited a comment on issue #4622:
[pulsar-dashboard]Dashboard report MultipleObjectsReturned
se7enkings edited a comment on issue #4622: [pulsar-dashboard]Dashboard report MultipleObjectsReturned
URL: https://github.com/apache/pulsar/issues/4622#issuecomment-506657086
**Describe the bug**
- If cross-regional replication is turned on, the same Topic will appear, Django uses get_object_or_404 will throw an exception MultipleObjectsReturned.
- Bug report:
```
Environment:
Request Method: GET
Request URL: http://{dashboard}:8780/stats/topic/persistent/test-signal/test-replication/msgsync-partition-14/
Django Version: 1.11.20
Python Version: 2.7.16
Installed Applications:
['stats.apps.StatsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "./stats/views.py" in topic
132. topic = get_object_or_404(Topic, name=topic_name, timestamp=timestamp)
File "/usr/local/lib/python2.7/site-packages/django/shortcuts.py" in get_object_or_404
85. return queryset.get(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py" in get
384. (self.model._meta.object_name, num)
Exception Type: MultipleObjectsReturned at /stats/topic/persistent/online-signal/signal-replication/msgsync-partition-14/
Exception Value: get() returned more than one Topic -- it returned 2!
```
- If we change the line 132 to "topic = get_list_or_404(Topic, name=topic_name, timestamp=timestamp)", the value of "topic" will be :
`[<Topic: persistent://test-signal/test-replication/msgsync-partition-14>, <Topic: persistent://test-signal/test-replication/msgsync-partition-14>]`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services