问题标签 [distributed-transactions]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
276 浏览

hibernate - 使用休眠中的 toplink

我正在使用休眠,但我想添加一个使用休眠的应用程序。我面临的问题是当我想在该组合应用程序上执行全局事务时。我正在使用 weblogic 作为容器,现在的问题是休眠创建了自己的连接,我希望 toplink 应该只使用那个连接......谁能告诉我我怎么能做到这一点??????

0 投票
1 回答
2651 浏览

wcf - WCF Transaction Flow Question

I would like to configure WCF service operations to accept a transaction if my client sends one, but not to create one if none is sent. I think this would be similar to the Supported transaction attribute in COM+.

Does anyone know whether this can be accomplished with WCF transactions?

I am trying to accomplish this all by using the WCF transaction programming model (e.g. TransactionFlowAttribute and TransactionScopeRequired on service operations) rather than using the System.Transactions explicit transaction programming model.

Here's an example of why I think I want to be able to do this:

ServiceA implements a high-level business operation which invokes two data services. An operation in Service B does a single database update and an operation in Service C does two database updates.

ServiceA ----> ServiceB ----> <1 DB update>
|
V Service C ----> <2 DB updates>

ServiceC's 2 database updates need to be performed within a transaction with its root on ServiceC. Service B's single database update does NOT need to take place within a transaction. However, ServiceA defines a transaction that requires ServiceB and ServiceC's database updates two happen as an atomic unit of work.

My question is how I can configure ServiceB so that when it's invoked by ServiceA it enlists in that transaction. However, when ServiceB is invoked directly rather than through Service A it does not need to run within a transaction because it's only doing one database update.

Thanks,

David Madrian

0 投票
2 回答
1031 浏览

.net - 我如何编写“分布式事务”?

过去我所有的数据库需求都是由 sqlite 解决的。现在设计一个可能很大的数据库,我研究了“分布式事务”。我该如何编程?我发现一些结果解释了什么是分布式事务,但没有解释如何对其进行编程。

我知道在代码中我有一些交易,我可能想批量处理成一个更大的交易。我使用.NET。我该如何做一些事情,比如创建一个用户,他的 PK 在一个数据库中,而他的用户信息(例如名称和设置)在另一个数据库中。这可能是一个单独的问题,但如果我有两个功能。一个更新媒体描述,另一个更新可能在同一服务器上或单独的内容。我如何嵌套这些事务并且只在最后提交?

0 投票
3 回答
720 浏览

sql-server - 每个多个数据库连接都有一个事务什么时候有意义?

谁能帮我看看在什么样的场景下拥有一个共享数据库事务和多个连接是有意义的?谢谢。

0 投票
2 回答
4016 浏览

database - 如果我访问 UserTransaction 这是否意味着我使用 2 阶段提交或 XA?

UserTransaction ut=lookup.... ut.beginTransaction(); saveToFooDB(); statelessEjb.transactionSupportedMethod(); //将某些内容保存到 Foo DB saveToFooDB(); ut.commit();

如果我执行上述操作,那么我的理解是它不是 XA 事务,因为它不跨越多个资源(如 DB 和 JMS)。我的理解正确吗?

0 投票
1 回答
5039 浏览

database - 在事务提交之前传递 JMS 消息

我有一个非常简单的场景,涉及应用程序服务器(Glassfish)中的数据库JMS。场景非常简单:

问题是有时在数据库中提交插入之前传递消息。如果我们考虑 2 阶段提交协议,这实际上是可以理解的:

和其他人讨论过这个问题,但答案总是:“奇怪,它应该开箱即用”

我的问题是:

  • 它如何开箱即用?
  • 我的场景听起来很简单,为什么没有更多的人有类似的麻烦?
  • 难道我做错了什么?有没有办法正确解决这个问题?

以下是有关我对问题的理解的更多详细信息:

仅当按此顺序处理参与者时,才存在此时间问题。如果 2PC 以相反的顺序处理参与者(首先是数据库,然后是消息代理),那应该没问题。问题是随机发生的,但完全可以重现。

在 Glassfish 文档中,我发现无法控制 JTA、JCA 和 JPA 规范中分布式事务参与者的顺序。我们可以假设它们会在使用时按照顺序被登记到分布式事务中,但是使用 JPA 等 ORM 时,很难知道何时刷新数据以及何时真正使用数据库连接。任何的想法?

0 投票
1 回答
2937 浏览

.net - MSDTC 将事务推广到分布式的可靠测试?

如何可靠地检查 MSDTC 是否已将事务提升为分布式事务?

这是在 .net 中使用 TransactionScope 时。

目前,一位同事正在通过关闭他的机器上的协调器来测试这一点——如果抛出异常,这将作为尝试促进事务的证据。这是一个有效的测试吗?

0 投票
2 回答
2866 浏览

soa - SOA 和分布式事务

分布式事务在面向服务的架构中什么时候有意义?

0 投票
1 回答
1754 浏览

sql-server - 为什么我只使用 LinqToSql 和 Ado.Net 时 TransactionScope 使用分布式事务

我们在一台机器上遇到问题,并显示错误消息:

“服务器 XXX 上的 MSDTC 不可用。”

该代码使用TransactionScope来包装一些 LingToSql 数据库代码;交易中还有一些原始的 Ado.net。

由于只访问了一个 sql 数据库(2005),为什么要使用分布式事务呢?

(我不想知道如何启用 MSDTC,因为代码需要在当前设置的服务器上运行)

0 投票
1 回答
433 浏览

database - 您如何处理数据库分片中的非规范化/二级索引?

假设我有一个带有 2 个二级索引的“消息”表:

  • “收件人 ID”
  • “发件人ID”

我想按“recipient_id”对“消息”表进行分片。通过这种方式检索发送给某个收件人的所有消息,我只需要查询一个分片。

但同时,我希望能够进行查询,询问某个发件人发送的所有消息。现在我不想将该查询发送到“消息”表的每个分片。一种方法是复制数据并有一个由“sender_id”分片的“message_by_sender”表。

这种方法的问题在于,每次发送消息时,我都需要将消息插入“message”和“message_by_sender”表中。

但是如果在插入“message”之后插入“message_by_sender”失败了怎么办?在这种情况下,消息存在于“message”中,但不存在于“message_by_sender”中。

我如何确保如果一条消息存在于“消息”中,那么它也存在于“message_by_sender”中而不诉诸两阶段提交?

对于任何对其数据库进行分片的人来说,这一定是一个非常普遍的问题。你怎么处理它?