Hi,

I am experiencing strange behavior of AbstractRoutingDataSource when I am not able to start new transaction to data-source B inside transaction of data-source A.

What I found is that when I implement InfrastructureProxy interface inside my implementation of AbstractRoutingDataSource, selection of resource keys inside TransactionSynchronizationManager is correct and I am able to query correct data sources/connections.

I have created repository https://github.com/bedla/spring-routing-datasource (see "What is the problem?" section) to show exact problem (see README.md and code there) and implementation of both use-cases (when I implement InfrastructureProxy interface and when I dont).

Is it bug of AbstractRoutingDataSource that it does not implement InfrastructureProxy interface by default. Or is it not implemented like this by design? Am I abusing InfrastructureProxy interface?

If it is bug, I can create PR with test cases etc.

Thx

Ivos

Comment From: rstoyanchev

Thanks for summarizing things really well and providing a sample, but in the end section this is very much design questions that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use the issue tracker only for bugs and enhancements and the currently behavior is certainly not accidental. Feel free to update this issue with a link to the re-posted question (so that other people can find it).

Comment From: bedla

ahh, I see. I was thinging about create SO at first, but I thought it seems more like a bug to me, but as I wrote I am not sure. Anyways, I have created https://stackoverflow.com/questions/70625552/unable-to-start-nested-inner-transaction-with-default-implementation-of-abstract and I am hoping that somebody from Spring will answer this design decision :) thx

Comment From: bedla

Dear Mr. @jhoeller , sorry for disturbing yout, but I am very curious if you can answer my questions about design decisions of AbstractRoutingDataSource and InfrastructureProxy as I described above. I found that you are original author of both. If you (or somebody else from Spring who is aware of design in those areas of source code) can find some time and take a look at nested transactions issue I found, it would be super cool. Thx a lot, Ivos