In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The Percona XtraDB cluster creates a set of threads to service its operations, which are independent of existing MySQL threads. There are three main thread groups:
I. Applier thread
Applier threads apply write sets received from other nodes. Write messages directly through gcv_recv_thread.
Use the wsrep_slave_threads variable to control the number of threads. The default value is 1, which means that at least one wsrep applier thread exists to process the request.
The Applier thread waits for an event, and once it catches the event, it applies it using the normal path from the application thread and applies the path with wsrep-customization relay log information. These threads are similar (but not exactly the same) to dependent worker threads.
Coordination can be achieved using "Apply and Commit Monitor". A transaction passes through two important states: APPLY and COMMIT. Each transaction is registered with the monitor it applied for, and the application order has been defined. Therefore, before applying this transaction, all transactions with an ordinal number (seqno) less than this transaction sequence number are applied. Commit does the same thing (last_left > = trx_.depends_seqno ()).
Second, roll back threads
Only one rollback thread performs a rollback in the event of a conflict.
Transactions executed in parallel by may collide and may need to be rolled back.
Applier transactions always take precedence over local transactions. This is natural because Applier transactions have been accepted by the cluster and some nodes may have applied them. There is still a rollback window for local conflict transactions.
All transactions that need to be rolled back are added to the rollback queue and the rollback thread is notified. Roll back the thread and then iterate through the queue and perform the rollback operation.
If the transaction is active on the node and the node receives a transaction write set from the cluster group that conflicts with the local active transaction, such local transactions are always treated as affected transactions to be rolled back.
When a conflict occurs, the transaction is in the commit state or execution phase. The run-time local transaction is forced to kill to wait for the Applier transaction to be allowed to continue. The local transaction during the commit phase failed with an authentication error.
Third, other threads 1, service thread
This thread is created at startup and is used to execute the auxiliary service. It has two main functions:
frees the GCache buffer after the cached write set is cleared to the level.
, which notifies the cluster group of transactions that have been committed to this level of each node. Each node maintains some basic state information about other nodes in the cluster. When the message is received, the information is updated in this local metadata.
2. Receiving thread
The gcs_recv_ thread is the first thread to view all messages received in the group.
It attempts to assign operations based on each message received. It adds these messages to the central FIFO queue, which is then processed by the Applier thread. Messages can contain different actions, such as status changes, configuration updates, flow control, and so on.
An important operation is to handle a write set, which actually applies transactions to database objects.
3. Gcomm connection thread
The gcomm connection thread GCommConn::run_fn is used to coordinate low-level group communication activities. Think of it as a black box for communication.
4. Action-based threads
In addition to the above, there are some threads that are created on demand. SST creates threads for donors and joiner (eventually spawning a child process to host the required SST scripts), IST creates receiver and asynchronous sender threads, and PageStore creates background threads to delete the created files.
If checksum is enabled and the replicated write set is large enough, the checksum is completed as part of a separate thread.
IV. Reference links
Https://www.percona.com/doc/percona-xtradb-cluster/LATEST/manual/threading_model.html
Author: Leshami copyright notice: this article is the original article of the blogger, please attach a link to the blog article to reprint it!
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: 0
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.