yuqi1129 opened a new issue, #11817:
URL: https://github.com/apache/gravitino/issues/11817

   ### Version
   
   main branch
   
   ### Describe what is wrong
   
   `IdP Basic Test / idp-basic-test` failed in PR #11739:
   
   
https://github.com/apache/gravitino/actions/runs/28276117601/job/83782981846?pr=11739
   
   The failure happened in `IdpRESTApiIT` against MySQL. The same workflow 
passed after rerun, so this is timing-sensitive.
   
   ### Error message and/or stacktrace
   
   `IdpRESTApiIT > testGroupMembership()` failed while deleting `user1`:
   
   ```text
   java.sql.SQLIntegrityConstraintViolationException:
   Duplicate entry 'user1-1782528107000' for key 'idp_user_meta.uk_iun_del'
   ```
   
   The failed SQL was:
   
   ```sql
   UPDATE idp_user_meta
   SET deleted_at = (UNIX_TIMESTAMP() * 1000.0)
   WHERE user_name = ? AND deleted_at = 0
   ```
   
   A later test then failed because `user1` still existed:
   
   ```text
   AlreadyExistsException: IdP user user1 already exists
   ```
   
   ### How to reproduce
   
   Run the IdP REST integration test against MySQL, potentially repeatedly:
   
   ```bash
   ./gradlew :plugins:idp-basic:test \\
     -PtestMode=embedded \\
     -PjdbcBackend=mysql \\
     -PskipDockerTests=false \\
     --tests org.apache.gravitino.idp.integration.test.IdpRESTApiIT
   ```
   
   ### Additional context
   
   Possible cause:
   
   The IdP metadata tables use unique keys that include `deleted_at`, for 
example `(user_name, deleted_at)` on `idp_user_meta`.
   
   The MySQL soft-delete expression used `UNIX_TIMESTAMP() * 1000.0`, which can 
produce second-level effective values ending in `000`. If the same IdP 
user/group/relation is deleted, recreated, and deleted again within the same 
second, the second soft delete can hit a duplicate key error.


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to