Skip to content

Fix: fix duplicate entry during indexation (alternative approach) - #2743

Open
Koc wants to merge 1 commit into
mainfrom
bugfix/fix-duplicate-entry-for-alternative-approach
Open

Koc wants to merge 1 commit into
mainfrom
bugfix/fix-duplicate-entry-for-alternative-approach

Conversation

@Koc

@Koc Koc commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

📝 Summary

This is alternative approach to fix #1886, #2405. Even after #2451 we observe tons of logs on PostgreSQL side related to duplication. In this PR this logs are gone

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests
  • Documentation (README or documentation) has been updated or is not required

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI tools
  • The AI-generated content was reviewed, comprehended and tested by a human

@mejo-

mejo- commented Sep 8, 2026

Copy link
Copy Markdown
Member

@Koc thanks, this looks very promising. I didn't even know about insertIgnoreConflict(). Could you adjust VersionsBackend.php as well and replace the try/catch with it?

@Koc

Koc commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

@mejo- sure, give me few days and I will finalize current PR

Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
@Koc
Koc force-pushed the bugfix/fix-duplicate-entry-for-alternative-approach branch from 658883e to 9e8f94d Compare September 12, 2026 16:10
@Koc
Koc marked this pull request as ready for review September 12, 2026 16:27

@mejo- mejo- left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Koc. One question/comment.

* @throws \OCP\DB\Exception
*/
public function insertIgnoreConflict(Entity $entity): int {
if ($entity instanceof SnowflakeAwareEntity) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on why you introduced this trait instead of just using $this->db->insertIgnoreConflict() directly within the mapper functions? As far as I know, we don't use snowflake IDs yet in Collectives, and I'd prefer to not add code handling this specific case before we introduce snowflake IDs.

@Koc Koc Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$this->db->insertIgnoreConflict() works with plain tables/arrays of columns=>values. But I want to continue using entities like it was before. That's why I've introduced insertIgnoreConflict on a mapper level that accepts entity object and uses $this->db->insertIgnoreConflict() under the hood.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate entry '...' for key 'c_p_versions_uniq_idx'

2 participants