Assigned
Status Update
Comments
ap...@google.com <ap...@google.com> #3
Project: gerrit
Branch: stable-3.7
commit eb3bfb27656b228510c6d751a5f93ffd384ff5d7
Author: Luca Milanesio <luca.milanesio@gmail.com>
Date: Thu Jun 22 20:28:00 2023
Fix imported changes appearing as duplicates in index
When parsing the change data from ChangeNotes, the in-memory
ChangeData created contains useful information like the serverId
that the change belongs to. The same information isn't there when
reindexing directly from a newly created entity Change which has
no relationship with the underlying change notes.
If the change to reindex is coming from a different server, it
has a specific serverId associated which is needed for producing
the correct virtualId for reindexing, that is the reason why
it is crucial to have the serverId upon reindexing.
Failing to propagate the original serverId for a change would result
in generating duplicates during reindex:
- The original document with the virtualId associated with the serverId
of the change
- A new document with the change number used as id.
Make sure to reindex the same document by propagating the correct
serverId of the change upon reindexing.
Leverage the ability to index either local or imported changes
in the following end-to-end use-cases:
- Editing a change (create, amend or delete)
- Indexing a change via REST-API
- Staleness checker
Amend also the ChangeIndexer.index(Change) JavaDoc by specifying
that it is intended to be used only for local changes and therefore
flag the method as deprecated.
All references to ChangeIndexer.index(Change) are removed from Gerrit,
however there could be plugins using the method which would need amending.
Bug: Issue 288303235
Release-Notes: Fix search duplicates returned for imported changes upon edits and reindexing
Change-Id: Iaf9354b983a8251575b25d4948073fc2ff7ddcae
M java/com/google/gerrit/server/edit/ChangeEditModifier.java
M java/com/google/gerrit/server/edit/ChangeEditUtil.java
M java/com/google/gerrit/server/index/change/ChangeIndexer.java
M java/com/google/gerrit/server/restapi/change/Index.java
M javatests/com/google/gerrit/acceptance/api/change/SubmitRequirementCustomRuleIT.java
https://gerrit-review.googlesource.com/377796
Branch: stable-3.7
commit eb3bfb27656b228510c6d751a5f93ffd384ff5d7
Author: Luca Milanesio <luca.milanesio@gmail.com>
Date: Thu Jun 22 20:28:00 2023
Fix imported changes appearing as duplicates in index
When parsing the change data from ChangeNotes, the in-memory
ChangeData created contains useful information like the serverId
that the change belongs to. The same information isn't there when
reindexing directly from a newly created entity Change which has
no relationship with the underlying change notes.
If the change to reindex is coming from a different server, it
has a specific serverId associated which is needed for producing
the correct virtualId for reindexing, that is the reason why
it is crucial to have the serverId upon reindexing.
Failing to propagate the original serverId for a change would result
in generating duplicates during reindex:
- The original document with the virtualId associated with the serverId
of the change
- A new document with the change number used as id.
Make sure to reindex the same document by propagating the correct
serverId of the change upon reindexing.
Leverage the ability to index either local or imported changes
in the following end-to-end use-cases:
- Editing a change (create, amend or delete)
- Indexing a change via REST-API
- Staleness checker
Amend also the ChangeIndexer.index(Change) JavaDoc by specifying
that it is intended to be used only for local changes and therefore
flag the method as deprecated.
All references to ChangeIndexer.index(Change) are removed from Gerrit,
however there could be plugins using the method which would need amending.
Bug:
Release-Notes: Fix search duplicates returned for imported changes upon edits and reindexing
Change-Id: Iaf9354b983a8251575b25d4948073fc2ff7ddcae
M java/com/google/gerrit/server/edit/ChangeEditModifier.java
M java/com/google/gerrit/server/edit/ChangeEditUtil.java
M java/com/google/gerrit/server/index/change/ChangeIndexer.java
M java/com/google/gerrit/server/restapi/change/Index.java
M javatests/com/google/gerrit/acceptance/api/change/SubmitRequirementCustomRuleIT.java
an...@gmail.com <an...@gmail.com> #4
Comment has been deleted.
an...@gmail.com <an...@gmail.com> #5
Comment has been deleted.
Description
*** !!!! THIS BUG TRACKER IS FOR GERRIT CODE REVIEW !!!!
*** Do not submit bugs for chrome/android and issues with your company's
*** Gerrit setup here. Those issues belong in different issue trackers.
*************************************************************************
What steps will reproduce the problem?
1. Import a Project with 1 change from a different Gerrit serverId
2. Edit one of the imported changes
What is the expected output?
By searching the list of changes, I should still see only 1 change
What do you see instead?
By searching the list of changes, I see 2 changes, the initially imported one and an exact copy with the amended change
Please provide any additional information below.
The change indexer does not use the virtual-id, leading to the duplication of changes, one with the virtual-id and the other with the current change-number.