You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/10/10 06:41:02 UTC

[GitHub] [shardingsphere] By1995 opened a new issue, #17542: XA transcation has a bug

By1995 opened a new issue, #17542:
URL: https://github.com/apache/shardingsphere/issues/17542

   version: 5.1.1  and latest
   project:    shardingsphere-proxy
   cluster mode
   use  Atomikos
   reference:  https://community.sphere-ex.com/t/topic/954/25
   I have two logical databases , sharding_db and sharding_db2
   
   Expected behavior:
   The two databases should support XA transaction.
   
   actual behavior:
   only  sharding_db2 supports XA transaction.
   sharding_db error:
   `ERROR 1815 (HY000): Internal error: javax.transaction.SystemException: There is no registered resource that can recover the given XAResource instance. 
   Please register a corresponding resource first.`
   
   I found shardingsphere have three virtual system databases;
   
   During initialization, the system database is also added to Engines of transactionContexts.
   if these databases are in this order ,like   logic_db -> system_db->logic_db,
   then error will happen, data before the system database will disappear.
   
   The problem is by
   class AtomikosTransactionManagerProvider 
   In close method exist userTransactionService.shutdown(true);
   
   The call stack:
   ContextManager :renewAllTransactionContext -> renewTransactionContext -> closeTransactionEngine ->  staleEngine.close();
   ShardingSphereTransactionManagerEngine : close
   XAShardingSphereTransactionManager: close   ->. xaTransactionManagerProvider.close();
   AtomikosTransactionManagerProvider: close. -> userTransactionService.shutdown(true);
   UserTransactionServiceImp: shutdown(true)
   Configuration: Configuration.shutdown(force) -> removeAndCloseResources(maxWaitTime <= 0);  // remove all resource , error happen
   
   `	public static synchronized void shutdown(long maxWaitTime) {
   		if (service_ != null) {
   			service_.shutdown(maxWaitTime);
   			notifyAfterShutdown();
   			removeShutdownHooks();
   			removeAndCloseResources(maxWaitTime <= 0);
   			clearSystemComponents();
   		}
   	}`
   
   ![image](https://user-images.githubusercontent.com/37041805/167761400-404cb19a-8743-46c5-bebe-98b9d90397c1.png)
   
   `    private void renewTransactionContext(final String databaseName, final ShardingSphereResource resource) {
           ShardingSphereTransactionManagerEngine changedStaleEngine = transactionContexts.getEngines().get(databaseName);
           if (null != changedStaleEngine) {
               System.out.println("renewTransactionContext-A---------" + databaseName);
               closeTransactionEngine(changedStaleEngine);
           }
           System.out.println("renewTransactionContext----------" + databaseName);
           resource.getDataSources().forEach((key, value) -> System.out.println(key + " ----- " + value));
           transactionContexts.getEngines().put(databaseName, createNewEngine(resource.getDatabaseType(), resource.getDataSources()));
       }`
   
   
   
   
   
   
   
   
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

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


[GitHub] [shardingsphere] RaigorJiang closed issue #17542: XA transcation has a bug

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang closed issue #17542: XA transcation has a bug
URL: https://github.com/apache/shardingsphere/issues/17542


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] github-actions[bot] closed issue #17542: XA transcation has a bug

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #17542: XA transcation has a bug
URL: https://github.com/apache/shardingsphere/issues/17542


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] github-actions[bot] commented on issue #17542: XA transcation has a bug

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #17542:
URL: https://github.com/apache/shardingsphere/issues/17542#issuecomment-1272349816

   Hello , this issue has not received a reply for several days.
   This issue is supposed to be closed.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] terrymanu commented on issue #17542: XA transcation has a bug

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #17542:
URL: https://github.com/apache/shardingsphere/issues/17542#issuecomment-1210126603

   Could you format the content by markdown syntax? It is hard to read.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] RaigorJiang commented on issue #17542: XA transcation has a bug

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #17542:
URL: https://github.com/apache/shardingsphere/issues/17542#issuecomment-1407573991

   This issue has been inactive for a long time, and ShardingSphere has released several new versions, so I will close it.
   Please try the latest version, and if the problem reproduces, please reopen it or submit a new one.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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