是否可以通过机器边界(通过 tcp-ip)进行交易?

发布于 2024-08-12 19:57:11 字数 427 浏览 3 评论 0原文

理论上,可以定义一种协议,其中一台机器对另一台机器(或多台机器)进行一些远程调用,并且在该过程的任何部分中,如果任何机器(或操作)失败,或者通信中断,一切都会失败。已回滚? (就像数据库可以一样)

我问这个问题,因为在硬件级别上,人们总是说,如果没有原子处理器操作(测试和设置),就无法进行原子操作(事务的一个非常重要的组成部分)。

但由于现在我们谈论的是多台机器,所以这是行不通的。

举个例子,这将是多么棘手:假设我有一个协议可以在远程计算机上发出命令,并获得响应。可能是调用了该方法,但在响应传输期间,连接中断了。那么也很可能执行操作的机器认为一切正常,但接收机器从未得到答案。

添加 Ack 没有帮助,因为 ack 也可能在传输过程中丢失。

有兴趣阅读其他人的想法(并了解 27 年前的一些教授可能已经提出了一个坚如磐石的解决方案)。

Theoretically, can one define a protocol where one machine does some remote calls on another machine (or more than one), and where in any part of the process, if any of the machines (or operations) fails, or the communication drops, everything is rolled back? (just like databases can)

I ask this, since on the hardware level, one always says that one can not make atomic operations (a very important ingredient of transactions) without an atomic processor operation (test and set).

But since now we are talking about multiple machines, this doesn't fly.

As an example how this would be tricky: Say I have a protocol to issue a command on a remote machine, and get a response back. It could be that the method is called, but during the transit of the response, the connection dies. It could then also very well be that the machine which performed the operation thinks everything was ok, but the receiving machine has never gotten the answer.

Adding Ack's doesn't help since also the ack's might be lost in transit.

Interested to read others thoughts (and to learn that some professor 27 years ago already came up with a rock solid solution probably).

R

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

孤君无依 2024-08-19 19:57:11

是的,这个问题已经(或多或少)解决了:)

您正在寻找的是 两个-阶段提交协议

在事务处理、数据库中,
和计算机网络,两阶段
提交协议(2PC)是一种
原子承诺协议。它是一个
协调的分布式算法
所有参与的进程
分布式原子事务
是否提交或中止(回滚)
交易。该协议实现了
即使在系统的许多情况下,它的目标
失败(涉及任一过程,
网络节点、通信等
失败),因此被广泛
已使用。

Yes, this problem has been (more or less) solved already :)

What you're looking for is the Two-Phase Commit protocol.

In transaction processing, databases,
and computer networking, the two-phase
commit protocol (2PC) is a type of an
atomic commitment protocol. It is a
distributed algorithm that coordinates
all the processes that participate in
a distributed atomic transaction on
whether to commit or abort (roll back)
the transaction. The protocol achieves
its goal even in many cases of system
failure (involving either process,
network node, communication, etc.
failures), and is thus widely
utilized.

温柔少女心 2024-08-19 19:57:11

听起来像是分配的标准问题。

阅读分布式计算:原理、算法和系统 并再次提出问题;)

Sounds like the standard problems of distribution.

Read Distributed Computing: Principles, Algorithms, and Systems and ask the question again ;)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文