Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When displaying forum topics, I noticed I had a coouple of duplicate topics shown. Deleting one of the topic also deletes the other so it points to the same node. I looked in the forum_index table and saw the duplicates entries there.
Since I can't reproduce the problem, can the index on the nid column be changed to unique so we could perhaps catch any programmation error ?
Comment | File | Size | Author |
---|---|---|---|
#35 | forum-duplicate_forum_nodes-1466458-35 .patch | 990 bytes | dhim712 |
#34 | forum-duplicate_forum_nodes-1466458-34.patch | 894 bytes | Delphine Lepers |
#23 | forum-duplicate_forum_nodes-1466458-23.patch | 1.93 KB | alb404 |
#22 | forum-duplicate_forum_nodes-1466458-22.patch | 1.9 KB | alb404 |
#21 | forum-duplicate_forum_nodes-1466458-21.patch | 1.88 KB | alb404 |
Comments
Comment #1
filijonka CreditAttribution: filijonka commentedIf you don't know how to reproduce a problem then it's kind of hard to debug and find out why.
inform us more when you're able to reproduce the problem.
Comment #2
jthorson CreditAttribution: jthorson commentedUnfortunately, we can't set the nid column index to 'unique', as that would break revisions support.
Comment #3
clauded CreditAttribution: clauded commentedThanks for the info.
I was able to reproduce the problem by making a revision of a forum post. When I'm logged on as an admin, the forum topic list displays duplicates if there's a revision for a topic. Is this a bug or is this by design ?
Comment #4
clauded CreditAttribution: clauded commentedSorry, I double checked and the duplicate entry in the index happens when I edit an already existing topic and save it.
Comment #5
larowlanDo you have any node access modules enabled (which would cause query rewriting)?
Comment #6
clauded CreditAttribution: clauded commentedYes, I have Forum Access, ACL and Content Access.
Comment #7
larowlanCan you disable those and report back?
The base query from forum is rewritten by those modules and perhaps they don't allow for revisions.
If that makes no difference then we'll need to look at forum more closely.
Comment #8
clauded CreditAttribution: clauded commentedI disabled all 3 modules, reconstructed permissions but I still have the problem : duplicate row in forum_index when I edit the main topic (no entry in the revision field, only edit the body and save). I also noticed that updating many times the main topics will only generate one duplicate row.
I enabled unique index on the forum_index table and got this :
I don't understand how an update statement can trigger a duplicate row in the table.
Comment #9
filijonka CreditAttribution: filijonka commentedHi
Do you think you could make us a step by step list?
Personally never used forum module butif have alist that I can follow how to reconstruct the error.
Comment #10
jemond CreditAttribution: jemond commentedI am also getting this issue. I believe the bug is in forum_field_storage_pre_update() in forum.module.
Regarding this if statement:
This just ensures the delete fires once, but the insert query that follows would occur each time this function is called. The comment makes it seem that perhaps the insert should be running once per func call as well?
I tested this on my install and it fixed the issue, which I was able to repro by simply editing a forum node.
Comment #11
jemond CreditAttribution: jemond commentedFWIW, here is what I used in template.php to address this bug until core is patched:
Comment #12
clauded CreditAttribution: clauded commentedWell, I've been able to find the module causing it in my case : File (Field) Paths 7.x-1.0-beta3.
I tried your patch (changed "hotness" to my theme name and flushed the cache) and it works with the forum view : no more duplicates.
However, I have a block that displays recent messages and it still shows duplicates (and I still have duplicate entries in the forum_index table).
Comment #13
clauded CreditAttribution: clauded commentedFollowing #10 advice, I produced a patch to the forum module that seems to correct the problem.
Comment #14
filijonka CreditAttribution: filijonka commentedhey
if you instead of using patch in #13,
please try this patch: http://drupal.org/node/681760
there are d6,d7 and d8 releases of it.
Comment #15
larowlanclauded at #13 you indicate that the cause of the problem was a contrib module.
Can you either
a) reassign this ticket to that project - or -
b) mark the issue as closed.
Thanks
Comment #16
filijonka CreditAttribution: filijonka commentedif you had read #14 you would have seen that this is refering to another contrib and what is most likely the solotion for this problem.
Comment #17
clauded CreditAttribution: clauded commentedI tried the patch in #14 but I can't apply it against the 7.12 version of the node.module. I guess I'll have to wait for the 7.13 release to see if it works.
Comment #18
holtzermann17 CreditAttribution: holtzermann17 commentedI can confirm that the theme-based work-around from #11 works for me.
@clauded: I'm also using File (Field) Paths 7.x-1.0-beta3. Can someone confirm whether this is an issue with core, or an issue with that module?
Comment #19
daften CreditAttribution: daften commentedI am really wondering why there need to be two entries in the forum_index table for revisioning. They ALWAYS contain the exact same information. revision info should be stored in the revisioning table. With the current way things are handled, a lot of hacks are needed (yes, i call them hacks), to make sure no counts are displayed twice. Just making sure the forum_index table only contains 1 entry per topic would solve these problems.
I'm wondering why this would not possible, what would break exactly?
Comment #20
katannshaw CreditAttribution: katannshaw commentedI ran into the same problem with the core forum module by doing the following:
1) Creating a new forum topic
2) Editing the topic and kept "Modify current revision, no moderation" selected
3) Saved the post
After doing this, I could see duplicate entries on the forums page and in the forum_index table even though I had selected to have no revision. The only value different in the table was the __pk value. Everything else was exactly the same.
So this is what I tried:
1) I tried the patched referenced on #14 (http://drupal.org/node/681760). Nothing changed, but I could see that it looked like it had already been implemented in my version of Drupal (7.22).
2) I then tried the #13 patch. No success.
3) I eventually fixed the issue editing the theme's template.php file as referenced on #11. I can still see the duplicate entries in forum_index table, but the Forums page at forum/forum-container-name only displays one entry per post.
Thanks.
Comment #21
alb404 CreditAttribution: alb404 commentedHi.
Somehow, the line number changed in newer versions of drupal core forum so I've updated #13 patch to match those changes. After I've applied the patch, I had to edit the duplicated nodes before the duplicates were removed in the forum_index table.
This is my first patch, so comments / critics are more than welcome!
This patch applies against Core 7.19 and should work with upper versions.
Hope this help.
Comment #22
alb404 CreditAttribution: alb404 commentedIgnore this one ...
Comment #23
alb404 CreditAttribution: alb404 commentedChanged git diff path to be relative to root rather than inside the forum directory.
Comment #24
ayalon CreditAttribution: ayalon commentedPlease forget all the patchs above. The reason is an old file field paths module.
Just update to the latest dev.
https://drupal.org/project/filefield_paths
You have to delete all duplicates manually.
The fix is here:
https://drupal.org/node/1464404
Referenced here:
https://drupal.org/node/1481260
Comment #25
larowlanComment #26
katannshaw CreditAttribution: katannshaw commentedI updated to the dev version and deleted all of the other old duplicate entries, but duplicate entries are still getting created on my site when a forum item is updated. I also tried patch #23 but it also didn't stop duplicate entries from getting entered into the forum_index table even though revisions are set to off.
Do you have any suggestions on what other steps I should follow?
Comment #27
grigorym CreditAttribution: grigorym commentedI have the same problem, even though i have no filefield_paths module at all. I was able to track down it to wysiwyg_fields module, since when i disable it, the problem goes away.
Comment #28
brunodboStill experiencing this issue in 7.41, without using Filefield Paths, nor any node access modules. Aside from having duplicate rows in the forum_index table, some of those rows also have the duplicate amount of comments counted in the comment_count column (e.g., for a post that has 2 comments, it the comment_count column will have a value of 4).
Comment #29
marksmith CreditAttribution: marksmith commentedThis problem persists with Drupal 7.57.
Comment #31
Delphine Lepers CreditAttribution: Delphine Lepers for European Commission and European Union Institutions, Agencies and Bodies commentedI am submitting a new version of the patch that adds a primary key
Comment #32
Delphine Lepers CreditAttribution: Delphine Lepers for European Commission and European Union Institutions, Agencies and Bodies commentedThis new version will check for users who already fixed this manually
Comment #33
Delphine Lepers CreditAttribution: Delphine Lepers for European Commission and European Union Institutions, Agencies and Bodies commentedNew patch that fixes the path to the file
Comment #34
Delphine Lepers CreditAttribution: Delphine Lepers for European Commission and European Union Institutions, Agencies and Bodies commentedComment #35
dhim712 CreditAttribution: dhim712 commented