ComputersInformation Technology

What are transactions? Transaction processing systems

In a world where everything changes so rapidly, you can not stop for a minute. This also applies to obtaining new information. An unknown term or the latest version of a software product is an excuse to replenish knowledge in one area or another. Today we will talk about what transactions are, how it works.

Introduction to terminology

A variety of software products automation of business processes have firmly established themselves on the market in the last 15 years. This requires the ability to work with software at different levels of interaction: as an operator, programmer, accountant, etc. Therefore, it is important to understand some of the mechanisms of the program. To begin with, we will deal with such a common and frightening term as a transaction. More often than not, a beautifully borrowed word hides a less complex phenomenon, as many people imagine, by uttering a new term, trying it by ear. Let's look at what transactions are.

Definition of concept

This designation is used in relation to any product in which the work with the database is implemented. Multiple operations that are logically combined into one and run in turn one by one are a transaction. In everyday life, a transaction chain can be considered a chain of procedures like "woke up - washed - dressed - had breakfast - went to work."

Let us consider this concept using the example of products 1C. Transaction is the same undivided sequence of actions. A vivid example can serve as a record about a unit of goods: opening the desired directory, creating a new element, filling in the required fields. In order for all these actions to lead to the desired result, it is necessary to carry them strictly from the first to the last. Only under such condition the procedure will be considered successful. Otherwise, the transaction is canceled.

Processes under consideration can be either automatic, that is, provided in the system, and manually completed by the developer after purchasing the finished product in order to make the latter more convenient for users of a particular enterprise. In addition, from the automatic mode, when the behavior of the system is regulated by the built-in mechanisms, transactions can be transferred to a managed one.

Transactions in 1C: subtleties of the built-in language

What is a transaction in the general case, we understand. But since each software company does it in its own way, there are certain differences between transactions in general and transactions in 1C in particular. For example, nested (transaction inside a transaction) in 1C is not supported.

From the point of view of syntax, the operators of the built-in language are fairly simple. The beginning of the process is declared using the special procedure StartTransaction (). The Fix Transaction () procedure is used to record changes during the execution of actions. If in the course of execution there was a failure, there is a possibility to Cancel Transaction () to roll back the committed changes.

Why use of transactions is preferable? Because the code in these procedures is much faster. This is exactly what any programmer wants. The difference in speed may not be so noticeable if the users of 1C in the office have 1-2 employees, but you can not help feeling it when it comes to whole departments that simultaneously perform various tasks in the specified program.

Underwater rocks

In addition to the obvious plus, consisting in a serious increase in the speed of reading and writing when working with the database, transactions have their own minus. Let's return to the above example from life. What are transactions made not by one person, but by the whole family? Everyone is trying to get into the bathroom to wash earlier, everyone is crowding in the kitchen, because it's time for breakfast. As a result, family members are unhappy with each other. In the best case, this is just an unfortunate start to the day, at worst - late work, reprimand from superiors, torn plans.

The program is the same. If all users start to edit data in the same document at the same time, which version should be considered the last one? What data should be saved before? To avoid such confusion, there is a locking mechanism. This means that while one user is working on the document, the second one is in the virtual queue and is waiting. After the transaction is successfully completed or the transaction is rolled back, the next user can work on the document.

To be or not to be controlled by locks?

The concept of a transaction can not be considered fully considered without the issue of redundant locks. What is the big evil: the lack of locks, leading to an incorrect reading and writing process with incorrect results at the output, or too many of them, hindering the work of the whole enterprise?

The best solution is managed locks, which are the golden mean. A competent programmer can customize the existing mechanism for the needs of the organization so that the really important documents are processed in the order of the queue. For the same configuration items that do not require locking, you can enable free editing.

Thus, the timely analysis of transactions and the correct attitude to blocking allows to take full advantage of the flexibility of the "1C: Enterprise" system and optimize the operation of the database, minimizing temporary losses.

Why lead to excessive blockages?

The question is by no means rhetorical. If you remove the necessary locks, there will be confusion and chaos. Incorrect data will start to accumulate in the database due to simultaneous write-off of balances or, conversely, accrual of assets. But the consequences are of this kind that will not come to light immediately. The first time the work will go quickly, creating the illusion of the correctness of choosing the rejection of locks. On the other hand, an unreasonably large number of locks immediately causes error messages. "The transaction can not be terminated," the system warns us. What does it mean? Two transactions mutually blocked each other in such a way that neither can complete the initiated nor carry out the cancellation. A vicious circle of "dead" transactions will hang in the database before detection, significantly reducing system performance.

Excess operations to undo actions increase the number of entries in the log. In addition, such a system is not viable, because even greater increase of users will simply bury it under the load of "dead" locks. The downtime will invariably grow. How to avoid such situations?

Levels of insulation - another way not to run aground

Talking about what transactions are, we mentioned the pitfalls. Continuing the analogy, we can confidently say that varying the level of locks is a reliable tool for the pilot in traveling through the sea 1C. There are two levels of isolation: "only reading, no record" and "no recordings, no readings." In automatic mode, the selection is not available. But it's enough to turn the application into a managed mode, and you can set smart limits, choosing not only important documents, but also assigning them an appropriate level of isolation.

However, competently delivered work is, first of all, prevention of emergency situations, and not only timely elimination of the failures that have already occurred. Assistant database administrators will serve as transaction processing systems. It is on the basis of data on how any operations in the system have been completed, whether they were successfully completed or canceled, it is possible to predict the further behavior of the system and prevent potential threats.

Summing up the overall results

We understood the definition of the transaction, examined the algorithm of the process from the inside, got acquainted with different ways of regulating operations within the same information base.

As practice has shown, the mechanism is not easy, but it is accessible for understanding and deeper study even for novice programmers and database administrators. The methods of regulation can not yet be perfected, and it is not possible to avoid problems in fully automatic mode, but, nevertheless, the life of a developer becomes easier with each new version of the software.

Similar articles

 

 

 

 

Trending Now

 

 

 

 

Newest

Copyright © 2018 en.birmiss.com. Theme powered by WordPress.