sunnysabor commented on issue #6549: URL: https://github.com/apache/shenyu/issues/6549#issuecomment-5941967814
I rechecked this against current `upstream/master` (`09c6a5287330c8d6ada64cd29f2a08a570b0b2ab`) and the reported two-write sequence does not match the implementation. [`createSelector`](https://github.com/apache/shenyu/blob/09c6a5287330c8d6ada64cd29f2a08a570b0b2ab/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/DataPermissionServiceImpl.java#L111-L128) builds `allDOList` in memory, adds the selector row and any rule rows, then invokes `dataPermissionMapper.insertBatch(allDOList)` exactly once. The mapper maps that call to one multi-row `INSERT` statement ([default dialect](https://github.com/apache/shenyu/blob/09c6a5287330c8d6ada64cd29f2a08a570b0b2ab/shenyu-admin/src/main/resources/mappers/data-permission-sqlmap.xml#L165-L179); Oracle uses one `INSERT ... SELECT ... UNION ALL` statement at lines 181–189). So this path does not commit a selector permission in one call and then insert rule permissions in a second call; a failure of the single insert statement cannot leave behind only the selector row as described. Adding `@Transactional` may be harmless, but it does not appear to fix the stated failure mode. If there is a current reproduction showing partial rows after the single mapper statement fails, please share the database/engine and steps; otherwise this issue may be outdated or based on a mistaken read of the method. -- 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]
