Skip to content

fix(meta): don't log concurrent meta insert as warning - #2115

Open
silverkszlo wants to merge 1 commit into
mainfrom
fix/concurrent-meta-warning
Open

silverkszlo wants to merge 1 commit into
mainfrom
fix/concurrent-meta-warning

Conversation

@silverkszlo

Copy link
Copy Markdown
Contributor

The bug / log noise

When creating and subsequently saving a new note, the following exception is logged sometimes (although the request returns a 200):

Exception `DbalExceptionAn exception occurred while executing a query:
SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "notes_meta_file_user_index" DETAIL: Key (file_id, user_id)=(1234, user12345) already exists.`

The problem

  • Sometimes two requests for a note run at the same time: the save (PUT, from autosave or Ctrl+S) and a read (GET, from NotePlain's refresh timer or the refresh after the automatic title).
  • Each of these requests tries to insert the note's row in notes_meta, because the save's file write has just deleted the row (NoteFileEventsListener on BeforeNodeWrittenEvent).
  • The second insert fails on the notes_meta_file_user_index unique key (either request can be the one that fails though).
  • createMeta() catches that and the request still returns a 200, so it is only a warning in the log.

Also see this comment in the code.

The solution

If the insert fails with OCP\DB\Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION, it is logged at debug level. Any other insert failure is still a warning.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: silver <s.szmajduch@posteo.de>
Assisted-by: ClaudeCode:claude-opus-5.5
@silverkszlo silverkszlo added the AI assisted This PR contains AI-assisted commits label Nov 2, 2026
@silverkszlo
silverkszlo requested a review from enjeck as a code owner November 2, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted This PR contains AI-assisted commits

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant