ComputersInformation Technology

Transactions - what is it? Database Transaction

A transaction is a set of specific actions that are performed by a user or program to access or modify a database. Before you understand, transactions - what it is, you need to understand the essence of this process. The main point of the process is that the actions must be either fully completed or canceled.

Each transaction database must translate it from one state, which is consistent, to another. It is assumed that in the process the consistency may be violated.

Many people are wondering, transactions are what it is. This is the unit of work that is performed in the database. It can be part of a general algorithm, a separate command or the program as a whole.

What should the transaction complete?

There are two ways to complete it:

  • In the event that the transaction completes successfully, the results are committed and the database goes into a new commit state.
  • If the execution was incorrect, a transaction error occurred, it is canceled. In this case, the database must be restored to the state that it was originally. This situation is called "rollback". However, if the transaction was committed, then it can not be canceled. If the actions were found to be incorrect, you need to perform another transaction that will return the database to a consistent state.

Transaction Properties

To denote transaction boundaries, it is common to use the begin transaction, commit, roll back statements.

The ACID, or transaction properties, can be:

  • Atomic, or atomicity. A transaction is an indivisible unit that must either be executed or canceled.
  • Coordination, or consistency. The meaning of the transaction is that the database should pass from one agreed state to another.
  • Insulativity, or isolation. Each transaction that is executed is not dependent on the others. All results of one process, available in gaps, should not be visible to other transactions.
  • Duration, or duration. All results that were achieved during a successful transaction should not be lost as a result of subsequent failures. They are stored permanently in the database.

Transactions are used to make changes or updates to the database. Each process is regulated and controlled by the transaction manager, and resources are controlled by the resource manager. The interaction of the two dispatchers determines the outcome of the operation. If necessary, the transaction is blocked.

Transaction phases

The following phases are distinguished:

  • Active. In this phase, a transaction is created, resource managers are involved in the process.
  • Preparatory. During this period, each Resource Manager has the ability to determine the outcome of an operation. The phase begins when the initiator creates a request to complete the transaction. If a resource manager does not have time to prepare, it requires the dispatcher to send a rollback. Resource managers maintain logs that record all the availability status data. This is necessary in order that in case of deviations it was possible to continue working from a certain place.
  • Fixation. The beginning of this phase occurs at a time when all resource managers are ready for the operation. If necessary, the transaction manager can complete the operation.

Each transaction must comply with certain requirements. As a result of the operation, the system must be brought to the correct state. This condition is necessary in the event that there are power failures.

Transaction logs

During the operation, a transaction log is maintained, where all changes are recorded. It must be regularly truncated, such a measure will help to avoid overflow. However, there are several reasons why truncation may be delayed, during this period it is especially important to monitor the filling. To reduce the size of the log, you can perform operations with minimal logging.

In case of a failure, the log performs the function of a critical component, which will help to bring the database into a consistent state. The log can not be edited or deleted.

Benefits of using a transaction log

This allows you to support such operations:

  • Restore individual actions;
  • Restore transactions that have not been completed;
  • Perform rolling action before failure;
  • Make a transaction replication.

How does the truncation of the journal occur?

In the truncation process, the space in the file is freed, which is used for further records. If you neglect this process, the whole disk space will be occupied, and many problems will arise. To avoid such situations, the truncation is automatic, except when for independent reasons it is delayed.

Transaction by bank card

Making payments in stores for a payment facility, buyers are thinking: transactions - what is it, and what are they for? Such operations with a bank card, like withdrawing cash, replenishing an account or making transfers, are called a transaction. This concept is also used when calculating a payment card at retail outlets.

Making payments through a bank card, not every client thinks about what processes are happening at this time. Although this knowledge is quite important, since it is about money and their security.

So, transactions - what is this when calculating in the store? This operation represents several stages, which are interrelated.

The main participants in the process are the bank (issuer) that issued the payment card, and the bank (acquirer) serving the outlet. The essence of the transaction is that the acquirer wants to get permission from the issuer to conduct the transaction. When you draw a card through the terminal, the cashier sends an encrypted request with the necessary data for the operation. All information is contained in the magnetic strip.

This request is sent to the processing center, whose task is to process the data and then forward the information to the issuing bank. He analyzes the information and compares it with his data. If no disagreement arises, the issuer issues a permission to conduct the transaction. The essence of the process is to assign a personal authorization code.

Only after this, the acquirer can perform the operation, as a result of which there will be a transfer of funds from the customer's account to the account of the outlet. In the event of a failure, the device will report that the transaction can not be completed.

Such a database transaction is carried out online. Another type of operation, offline, is also possible, which are produced by means of an imprinter making an impression of the card.

Many users are interested in: Is there a possibility to cancel a transaction? If necessary, the bank can carry out certain manipulations, allowing it to do so.

Similar articles

 

 

 

 

Trending Now

 

 

 

 

Newest

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