Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the process of web conformance protocol submission?

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "what is the process of web conformance protocol submission". In daily operation, I believe many people have doubts about the process of web conformance protocol submission. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "what is the process of web conformance protocol submission"! Next, please follow the editor to study!

Unlike two-phase commit, three-phase commit has two change points.

Introduce a timeout mechanism-introduce a timeout mechanism in both coordinators and participants.

Inserting a preparatory phase into the first and second phases ensures that the status of the participating nodes is consistent before the final commit phase.

Define

Three-phase commit (Three-phase commit), also known as three-phase commit protocol (Three-phase commit protocol), is an improved version of two-phase commit (2PC).

The so-called three stages are: ask, then lock the resource, and finally actually submit.

The first stage: CanCommit

The second stage: PreCommit

The third stage: Do Commit

Committed process transaction query phase / CanCommit

The CanCommit phase of 3PC is actually very similar to the preparatory phase of 2PC. The coordinator sends a commit request to the participant, and the participant returns the Yes response if it can be submitted, otherwise the No response is returned.

a. Transaction inquiry

The coordinator sends a CanCommit request to the participant. Ask if a transaction commit operation can be performed. Then start waiting for a response from the participant.

b. Response feedback

After the participant receives the CanCommit request, normally, if he / she thinks the transaction can be executed smoothly, he / she will return the Yes response and enter the ready state; otherwise, he / she will report back to the No.

This is different from the 2PC phase in that the participant does not lock the resource, does not write the redo,undo, and performs a rollback log. Low rollback cost

Transaction preparation phase / PreCommit

After receiving a response from all participants, the coordinator performs two actions based on the results: perform transaction pre-commit, or interrupt the transaction.

Perform transaction pre-commit

a. Send a pre-submission request

The coordinator sends a request for preCommit to all participant nodes and enters the prepared state.

b. Transaction pre-commit

After the participant is requested by the preCommit, the transaction operation is performed, and the Undo and Redo information is also recorded in the transaction log corresponding to the "execute transaction" in the 2PC preparation phase.

c. Each participant responded to feedback.

If the participant successfully executes the transaction, feedback the ACK response while waiting for instructions: commit (commit) or terminate (abort).

Interrupt a transaction

a. Send interrupt request

The coordinator issues an abort request to all participant nodes.

b. Interrupt a transaction

If a participant receives an abort request or times out, the transaction will be interrupted.

Execute transaction phase / Do Commit

The real transaction commit at this stage can also be divided into the following two situations.

Execute submission

a. Send a submission request

If the coordinator receives the ACK response from each participant, he will move from the pre-submitted state to the submitted state. And send a doCommit request to all participants.

b. Transaction commit

After the participant receives the doCommit request, the formal transaction commit is performed. And release all transaction resources after the transaction commit is completed.

c. Response feedback

After the transaction is committed, an ACK response is sent to the coordinator.

d. Complete the transaction

After receiving the ACK response from all participants, the coordinator completes the transaction.

Interrupt a transaction

If the coordinator does not receive an ACK response from the participant (either the recipient sends a non-ACK response or the response times out), the interrupt transaction is executed.

a. Send interrupt request

The coordinator sends an abort request to all participants.

b. Transaction rollback

After receiving the abort request, the participant uses the undo information recorded in phase 2 to perform the rollback operation of the transaction, and releases all transaction resources after the rollback is completed.

c. Feedback result

After the participant completes the transaction rollback, an ACK message is sent to the coordinator.

d. Interrupt a transaction

After receiving the ACK message from the participant, the coordinator completes the interruption of the transaction.

At this stage, if the participant does not receive the docommit message within a certain period of time, the timeout mechanism is triggered and the transaction will be committed by itself. The logic of this process is that you can enter this stage, indicating that all nodes are good during the transaction query phase. Even if it fails partially at the time of submission, it is reasonable to believe that most of the nodes are good at this time. It can be submitted.

Advantages

Compared with the two-phase commit, the three-phase commit mainly solves the problem of single point of failure and reduces the blocking time.

Because once the participant cannot receive the message from the coordinator in time, he will execute commit by default. Instead of holding transaction resources all the time and being in a blocking state.

Shortcoming

Three-phase commit can also lead to data consistency problems. Due to network reasons, the abort response sent by the coordinator is not received by the participant in time, so the participant performs the commit operation after waiting for the timeout.

This results in data inconsistencies with other participants who received the abort command and performed the rollback.

At this point, the study on "what is the process of web conformance protocol submission" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 214

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report