You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "M-ung (via GitHub)" <gi...@apache.org> on 2025/08/26 11:24:20 UTC

[I] [Bug report] Flaky test in TestOwnerMetaService.testDeleteMetadataObject [gravitino]

M-ung opened a new issue, #8293:
URL: https://github.com/apache/gravitino/issues/8293

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   The test TestOwnerMetaService.testDeleteMetadataObject fails during a full project build (./gradlew clean build) due to a JdbcSQLIntegrityConstraintViolationException.
   
   However, the test passes successfully when it is run in isolation. This suggests it is a flaky test, likely caused by state leakage from other tests that run prior to it in the full test suite.
   
   ### Error message and/or stacktrace
   
   TestOwnerMetaService > testDeleteMetadataObject() FAILED
       org.apache.ibatis.exceptions.PersistenceException: 
       ### Error updating database.  Cause: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation: "PUBLIC.UK_OW_ME_DEL_INDEX_3 ON PUBLIC.OWNER_META(OWNER_ID, METADATA_OBJECT_ID, METADATA_OBJECT_TYPE, DELETED_AT) VALUES 25"; SQL statement:
       UPDATE owner_meta SET deleted_at = (UNIX_TIMESTAMP() * 1000.0) + EXTRACT(MICROSECOND FROM CURRENT_TIMESTAMP(3)) / 1000 WHERE owner_id = ? AND owner_type = ? AND deleted_at = 0 [23505-200]
       ### The error may exist in org/apache/gravitino/storage/relational/mapper/OwnerMetaMapper.java (best guess)
       ### The error may involve org.apache.gravitino.storage.relational.mapper.OwnerMetaMapper.softDeleteOwnerRelByOwnerIdAndType-Inline
       ### The error occurred while setting parameters
       ### SQL: UPDATE owner_meta SET deleted_at = (UNIX_TIMESTAMP() * 1000.0) + EXTRACT(MICROSECOND FROM CURRENT_TIMESTAMP(3)) / 1000 WHERE owner_id = ? AND owner_type = ? AND deleted_at = 0
       ### Cause: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation: "PUBLIC.UK_OW_ME_DEL_INDEX_3 ON PUBLIC.OWNER_META(OWNER_ID, METADATA_OBJECT_ID, METADATA_OBJECT_TYPE, DELETED_AT) VALUES 25"; SQL statement:
       UPDATE owner_meta SET deleted_at = (UNIX_TIMESTAMP() * 1000.0) + EXTRACT(MICROSECOND FROM CURRENT_TIMESTAMP(3)) / 1000 WHERE owner_id = ? AND owner_type = ? AND deleted_at = 0 [23505-200]
           at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
           at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)
           at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:67)
           at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:152)
           at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
           at jdk.proxy3/jdk.proxy3.$Proxy119.softDeleteOwnerRelByOwnerIdAndType(Unknown Source)
           at org.apache.gravitino.storage.relational.service.UserMetaService.lambda$deleteUser$12(UserMetaService.java:178)
           ...
           at org.apache.gravitino.storage.relational.service.TestOwnerMetaService.testDeleteMetadataObject(TestOwnerMetaService.java:516)
   
   ### How to reproduce
   
   1. Set up the environment with JDK 17.
   2. Run the full project build and test suite
   `./gradlew clean build`
   3. The build may fail with the error in the :core:test task.
   4. To confirm it's a flaky test, run the failing test in isolation, which should pass
   `./gradlew :core:test --tests "org.apache.gravitino.storage.relational.service.TestOwnerMetaService.testDeleteMetadataObject"`
   
   ### Additional context
   
   This issue was discovered while working on an unrelated PR (#8292). 
   
   The failure seems to be pre-existing in the main branch.


-- 
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: commits-unsubscribe@gravitino.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug report] Flaky test in TestOwnerMetaService.testDeleteMetadataObject [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on issue #8293:
URL: https://github.com/apache/gravitino/issues/8293#issuecomment-3239317122

   You can work on it, go ahead, raise an issue and then a PR to fix it.


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug report] Flaky test in TestOwnerMetaService.testDeleteMetadataObject [gravitino]

Posted by "keepConcentration (via GitHub)" <gi...@apache.org>.
keepConcentration commented on issue #8293:
URL: https://github.com/apache/gravitino/issues/8293#issuecomment-3238914601

   @justinmclean  
   
   Thanks! If no one is already working on this issue, I’d be happy to take it on. Could you assign it to me?


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug report] Flaky test in TestOwnerMetaService.testDeleteMetadataObject [gravitino]

Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao closed issue #8293: [Bug report] Flaky test in TestOwnerMetaService.testDeleteMetadataObject
URL: https://github.com/apache/gravitino/issues/8293


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug report] Flaky test in TestOwnerMetaService.testDeleteMetadataObject [gravitino]

Posted by "keepConcentration (via GitHub)" <gi...@apache.org>.
keepConcentration commented on issue #8293:
URL: https://github.com/apache/gravitino/issues/8293#issuecomment-3237603331

   Hi,
   
   I found that `setOwner` is invoked twice within `TestOwnerMetaService.testDeleteMetadataObject`.
   
   ```java
   OwnerMetaService.getInstance()
           .setOwner(model.nameIdentifier(), model.type(), user.nameIdentifier(), user.type());
   OwnerMetaService.getInstance()
           .setOwner(model.nameIdentifier(), model.type(), user.nameIdentifier(), user.type());
   ```
   
   This results in the creation of duplicate active rows with the combination `(owner_id, metadata_object_id, metadata_object_type, deleted_at=0)`. Subsequently, when `OwnerMetaBaseSQLProvider.softDeleteOwnerRelByMetadataObjectIdAndType()` is executed, these duplicate rows are updated with the same deleted_at value, which leads to a `JdbcSQLIntegrityConstraintViolationException`.
   
   As a short-term fix, this can be addressed by modifying `testDeleteMetadataObject` to call `setOwner(...)` only once.
   


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug report] Flaky test in TestOwnerMetaService.testDeleteMetadataObject [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on issue #8293:
URL: https://github.com/apache/gravitino/issues/8293#issuecomment-3238603495

   Nice find there


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org