Visibility determination method and device, electronic equipment and storage medium

By determining the target log sequence number of the active transaction set in the database and comparing it in the visibility judgment stage, the problem of high resource occupation and unnecessary judgment of visibility judgment methods based on physical records in the prior art is solved, and efficient visibility judgment is achieved.

CN119537446APending Publication Date: 2025-02-28SHANGHAI DAMENG DATABASE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411641252.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-02-28

Smart Images

  • Figure CN119537446A_ABST
    Figure CN119537446A_ABST
Patent Text Reader

Abstract

The invention discloses a visibility determination method and device, electronic equipment and a storage medium, and relates to the technical field of computers. The method specifically comprises the following steps: determining a first transaction for modifying a data page in a database, and determining a transaction starting log serial number; collecting the first transaction which modifies the database within a set time length to form an active transaction set corresponding to the first transaction; selecting the transaction starting log serial number with the minimum value from the transaction starting log serial numbers corresponding to the active transaction set as a target log serial number of the first transaction; in the starting stage of the second transaction, determining a target log serial number corresponding to the second transaction; and in the visibility judgment stage, according to the target log serial number corresponding to the second transaction, determining whether the second transaction is visible to the data page accessed by the second transaction. According to the method and the device, the judgment on whether the transaction for modifying the data page is visible to the data page is completed, the data occupation is reduced, and the visibility judgment efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a visibility determination method, device, electronic device and storage medium. Background Art

[0002] The database implements row-level multi-version support based on physical records and rollback records. Only the latest version of the physical record is retained in the data page, and historical versions are maintained through rollback records. All transactions operate on specific versions.

[0003] The key to realizing multi-version control is visibility judgment, which is used to find the specific version of data visible to the current transaction. The most common visibility judgment method currently is the visibility judgment method based on physical records. However, in actual applications, the visibility judgment based on physical records requires parsing each row of records for visibility judgment, which will occupy more resources when the amount of historical data is large, and there will be a large number of unnecessary visibility judgments on historical data. Therefore, how to find a simple visibility determination method to reduce unnecessary visibility judgments and improve the efficiency of visibility judgments is currently an urgent problem to be solved. Summary of the invention

[0004] The present invention provides a visibility determination method, device, electronic device and storage medium to determine whether a data page where a record of transaction access is located is visible to the transaction, thereby simplifying the visibility determination process and improving determination efficiency.

[0005] According to one aspect of the present invention, a visibility determination method is provided, comprising:

[0006] If it is detected that a data page in the database is modified for the first time by a first transaction, determining a transaction start log sequence number of the first transaction;

[0007] At set time intervals, collecting first transactions that modify the database within the set time interval to form an active transaction set corresponding to the first transactions;

[0008] Selecting the transaction start log sequence number with the smallest value from the transaction start log sequence numbers corresponding to the active transaction set as the target log sequence number of the active transaction set;

[0009] In the startup phase of the second transaction, the target log sequence number of the active transaction set is determined to be the target log sequence number corresponding to the second transaction;

[0010] In the visibility determination stage, it is determined whether the second transaction is visible to the data page accessed by the second transaction according to the target log sequence number corresponding to the second transaction.

[0011] According to another aspect of the present invention, there is provided a visibility determination device, comprising:

[0012] A first determination module is used to determine a transaction start log sequence number of the first transaction if it is detected that a data page in the database is modified for the first time by a first transaction;

[0013] A collection module, configured to collect, at set intervals, first transactions that modify the database within the set period of time to form an active transaction set corresponding to the first transactions;

[0014] A selection module, configured to select a transaction start log sequence number with the smallest value from the transaction start log sequence numbers corresponding to the active transaction set as the target log sequence number of the active transaction set;

[0015] A second determination module, configured to determine, during a startup phase of a second transaction, a target log sequence number of the active transaction set as a target log sequence number corresponding to the second transaction;

[0016] The third determination module is used to determine whether the second transaction is visible to the data page accessed by the second transaction according to the target log sequence number corresponding to the second transaction in the visibility judgment stage.

[0017] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0018] at least one processor; and

[0019] a memory communicatively connected to the at least one processor; wherein,

[0020] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the visibility determination method described in any embodiment of the present invention.

[0021] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the visibility determination method described in any embodiment of the present invention when executed.

[0022] The technical solution of the embodiment of the present invention first determines multiple active transactions that modify the database within a set time period, and obtains the minimum value of the transaction start log sequence numbers of the multiple active transactions as the target log sequence number. Then, for the transaction within the next set time period, in the transaction startup phase, the log sequence number is set as the log sequence number of the transaction. Then, in the execution phase of the transaction, the log sequence number of the data page accessed by the transaction is obtained. The target log sequence number corresponding to the transaction is compared with the log sequence number of the data page accessed by the transaction, and it is judged whether the transaction is visible to the data page accessed by the transaction. By comparing the log sequence number of the transaction with the log sequence number of the accessed data page, the judgment of whether the transaction accessing the data page is visible to the data page is completed, which reduces data occupancy and improves the efficiency of visibility judgment.

[0023] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0025] Figure 1 is a flowchart of a visibility determination method provided according to Embodiment 1 of the present invention;

[0026] Figure 2 is a flow chart of a visibility comparison method provided according to Embodiment 2 of the present invention;

[0027] Figure 3 is a structural schematic diagram of a visibility determination device provided according to Embodiment 3 of the present invention;

[0028] Figure 4 It is a block diagram of an electronic device provided according to a fourth embodiment of the present invention. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0031] Embodiment 1

[0032] Figure 1 This is a flow chart of a visibility determination method provided in the first embodiment of the present invention. This embodiment can be applied to determine whether a transaction accessing a data page is visible to the data page. The method can be executed by a visibility determination device. The visibility determination device can be implemented in the form of hardware and / or software. The visibility determination device can be configured in an electronic device. Figure 1 As shown, the method includes:

[0033] S110: If it is detected that a first transaction modifies a data page in the database for the first time, determine a transaction start log sequence number of the first transaction.

[0034] In this embodiment, a transaction can be understood as a sequence of operations for reading or writing a database in a database management system. These operations are either all successfully executed and produce permanent changes to the database, or all fail, and the database maintains the state before the transaction starts. The execution of any two transactions is independent and isolated, and the transactions do not affect each other. The first transaction can be understood as an active transaction, and the first transaction is used in the process of collecting transaction start log sequence numbers. The log sequence number can be understood as a unique number assigned by the database to a data page. It is an automatically maintained integer value with a global incrementing feature. The log sequence number of a data page is continuously updated as the data page is modified. The transaction start log sequence number can be understood as a number in the database used to mark the start time of each transaction.

[0035] Specifically, in the database, when the first transaction modifies a data page for the first time, the log sequence number of the modified data page can be subtracted from the set value to serve as the transaction start log sequence number of the first transaction. It is considered that the data page whose log sequence number is less than or equal to the transaction start log sequence number is definitely not modified by the first transaction.

[0036] Exemplarily, a log sequence number is maintained in the database, which is the maximum log sequence number currently allocated by the system. When the first transaction is about to modify a data page for the first time, the maximum log sequence number currently allocated by the system is obtained as the transaction start log sequence number of the first transaction. Similarly, it can be considered that a data page with a log sequence number less than or equal to the transaction start log sequence number obtained in this way is definitely not modified by the first transaction.

[0037] S120 . Collect, at set time intervals, first transactions that modify the database within the set time interval to form an active transaction set corresponding to the first transactions.

[0038] In this embodiment, the active transaction set can be understood as a set formed by all transactions that modify data pages within a set time period in the database.

[0039] Specifically, within each set time period, a plurality of first transactions that modify data pages in the database are collected, and the collected first transactions are grouped into a set, which is an active transaction set corresponding to the first transactions.

[0040] S130 . Selecting a transaction start log sequence number with the smallest value from the transaction start log sequence numbers corresponding to the active transaction set as a target log sequence number of the active transaction set.

[0041] In this embodiment, the target log sequence number can be understood as the minimum value selected from the transaction start log sequence numbers of all transactions in the active transaction set.

[0042] Specifically, the active transaction set formed in S120 includes multiple first transactions and transaction start log sequence numbers corresponding to the multiple first transactions. The transaction start log sequence number with the smallest value is selected from the transaction start log sequence numbers corresponding to the multiple first transactions as the target log sequence number of the active transaction set.

[0043] Exemplarily, the minimum value of the transaction start log sequence number is selected from the transaction start log sequence numbers corresponding to multiple first transactions in the active transaction set, and the minimum value is used as the target log sequence number of the first transaction. That is, when the log sequence number of a data page is less than or equal to the target log sequence number, it is considered that the data page is not modified by the transaction in the active transaction set corresponding to the first transaction.

[0044] S140. During the startup phase of the second transaction, the target log sequence number of the active transaction set is determined to be the target log sequence number corresponding to the second transaction.

[0045] In this embodiment, the second transaction can be understood as a transaction in the transaction execution phase, that is, a transaction that accesses a data page. The second transaction can be considered as the first transaction in a specific case, for example, the second transaction can be included in the first transaction.

[0046] Specifically, the transaction start log sequence number of the second transaction is determined by the above method of obtaining the target log sequence number of the first transaction. When the second transaction is started, the minimum value is selected from the transaction start log sequence numbers of the first transaction as the target log sequence number corresponding to the second transaction.

[0047] S150. In the visibility determination phase, determine whether the second transaction is visible to the data page accessed by the second transaction according to the target log sequence number corresponding to the second transaction.

[0048] In this embodiment, visibility judgment can be understood as a decision-making mechanism for determining whether a data page or record can be accessed by a transaction.

[0049] Specifically, when making a visibility judgment on the second transaction, first obtain the log sequence number of the data page modified by the second transaction, and compare the target log sequence number corresponding to the second transaction obtained in S140 with the log sequence number of the data page modified by the second transaction to obtain a comparison result, and judge whether the second transaction is visible to the data page accessed by the second transaction based on the comparison result.

[0050] Exemplarily, the log sequence number of the data page accessed by the second transaction is compared with the target log sequence number corresponding to the second transaction to determine the size relationship between the two, and determine whether the data page accessed by the second transaction is visible to the second transaction based on the size relationship.

[0051] The technical solution of the embodiment of the present invention first determines multiple active transactions that modify the database within a set time period, and obtains the minimum value of the transaction start log sequence numbers of the multiple transactions as the target log sequence number. Then, the target log sequence number is set as the target log sequence number of the transaction started within the next set time period. Then, for the execution phase of the transaction started after the set time period, the log sequence number of the data page accessed by the transaction is obtained. The target log sequence number corresponding to the transaction is compared with the log sequence number of the data page accessed by the transaction, and it is judged whether the transaction is visible to the data page modified by the transaction. By comparing the log sequence number of the transaction with the log sequence number of the accessed data page, the judgment of whether the transaction accessing the data page is visible to the data page is completed, which reduces data occupancy and improves the efficiency of visibility judgment.

[0052] Based on the above embodiment, a variant embodiment of the above embodiment is proposed. It should be noted that in order to make the description concise, only the differences from the above embodiment are described in the variant embodiment.

[0053] In one embodiment, determining the transaction start log sequence number of the first transaction includes: subtracting a set value from the log sequence number of the data page first modified by the first transaction to obtain a calculation result, and determining the calculation result as the transaction start log sequence number of the first transaction; when the log sequence number of the data page is less than or equal to the transaction start log sequence number of the first transaction, the data page must not be a data page modified by the first transaction.

[0054] In this embodiment, in order to ensure that the data page is modified by the current transaction, a set value is introduced, and the set value may be 1.

[0055] Specifically, when a first transaction in the database modifies a data page for the first time, the log sequence number of the modified data page is obtained, the set value is subtracted from the log sequence number to obtain a calculation result, and the calculation result is used as the transaction start log sequence number of the first transaction. When the log sequence number of the data page is less than or equal to the transaction start log sequence number, since the log sequence number of the data page is globally incremented, it means that the data page was modified before the first transaction was started, so it is not a data page modified by the first transaction.

[0056] In one embodiment, determining the transaction start log sequence number of the first transaction includes: determining the maximum log sequence number that has been allocated by the system when the first transaction allocates a rollback page for the first time as the transaction start log sequence number of the transaction.

[0057] In this embodiment, the rollback page can be understood as a data page that records rollback information, which is a component of a rollback segment. A rollback segment can be composed of multiple rollback pages. A rollback segment is a structure in a database for storing rollback information, and the rollback information includes the original value of the modified data, related information of the transaction operation, etc. The maximum log sequence number can be understood as the largest log sequence number among the log sequence numbers assigned to data pages by the database system before a transaction is executed.

[0058] Specifically, when a rollback page is first allocated to a first transaction, since the first allocation of a rollback page indicates that the first transaction is about to modify a data page, the maximum log sequence number of the allocated data page is used as the transaction start log sequence number of the first transaction.

[0059] In one embodiment, during the startup phase of the second transaction, determining the target log sequence number of the active transaction set as the target log sequence number corresponding to the second transaction includes: during the startup phase of the second transaction, determining the minimum value of the transaction startup log sequence numbers corresponding to the active transaction set corresponding to the first transaction as the target log sequence number corresponding to the second transaction.

[0060] Specifically, when the second transaction is started, the minimum value of the target log sequence numbers in the active transaction set determined before the second transaction is started is obtained, and the minimum value of the target log sequence numbers is used as the target log sequence number corresponding to the second transaction.

[0061] For example, if the second transaction is not in the active transaction set corresponding to the first transaction, since the active transaction set is obtained periodically, although several second transactions may appear between the end of this collection and the next collection, the transaction start log sequence numbers of the newly appearing second transactions must be greater than the target log sequence number corresponding to the second transaction. In this way, the minimum value of the target log sequence numbers determined before the start of the second transaction can be obtained as the target log sequence number corresponding to the second transaction.

[0062] Embodiment 2

[0063] Figure 2 This is a flow chart of a visibility comparison method provided in the second embodiment of the present invention. The visibility comparison method provided in this embodiment is a refinement of the visibility determination method in the above embodiment. Figure 2 As shown, the method includes:

[0064] S210. Compare the log sequence number of the data page with the target log sequence number corresponding to the second transaction to obtain a comparison result, wherein the log sequence number of the data page includes the log sequence number corresponding to the data page accessed by the second transaction.

[0065] Specifically, when making a visibility judgment on the second transaction, first obtain the log sequence number of the data page accessed by the second transaction, and then obtain the target log sequence number corresponding to the second transaction according to the method of the above embodiment. Finally, compare the two to obtain a comparison result.

[0066] Exemplarily, when making a visibility judgment on the second transaction, first obtain the log sequence number of the data page accessed by the second transaction. According to the method of the above embodiment, the target log sequence number corresponding to the second transaction is obtained, and the target log sequence number corresponding to the second transaction can be registered in the visible view of the second transaction. The visible view can be understood as the list of active transactions collected when the transaction is started or the transaction statement is executed, the transaction number that the system is about to generate, and other information. The active transaction list is used to store transaction records. Compare the log sequence number of the data page accessed by the second transaction with the target log sequence number corresponding to the second transaction in the visible view to obtain a comparison result.

[0067] S220. Based on the comparison result, determine whether the data page accessed by the second transaction is visible to the second transaction.

[0068] Specifically, according to the size comparison result obtained in S210, it is determined whether the data page accessed by the second transaction is visible to the second transaction. If the log sequence number of the data page accessed by the second transaction is less than the target log sequence number corresponding to the second transaction, it is considered that the second transaction is visible to the data page accessed by the second transaction. Otherwise, it is considered that the data page accessed by the second transaction is not visible to the second transaction.

[0069] Exemplarily, if the data page accessed by the second transaction is visible to the second transaction, it means that the data page accessed by the second transaction is modified by the committed transaction, and the record is also a committed record, so the record is also visible. If the data page accessed by the second transaction is not visible to the second transaction, it is necessary to find the record on the data page accessed by the second transaction, and further determine whether the record of the data page accessed by the second transaction is visible to the second transaction based on the specific information of the record. The determination method can be a visibility determination method based on physical records.

[0070] Optionally, determining whether the second transaction is visible to the data page accessed by the second transaction based on the comparison result includes: determining that the second transaction is visible to the data page accessed by the second transaction when the comparison result indicates that the log sequence number of the data page is less than or equal to the target log sequence number corresponding to the second transaction.

[0071] Specifically, if the log sequence number of the data page accessed by the second transaction is less than or equal to the target log sequence number corresponding to the second transaction, the comparison result is that the second transaction is visible to the data page accessed by the second transaction.

[0072] Exemplarily, when the comparison result is that the second transaction is visible to the data page accessed by the second transaction, it means that the accessed data page has been submitted, and the record of the data page accessed by the second transaction is also submitted. Since the second transaction is visible to the data page accessed by the second transaction, the record of the data page accessed by the second transaction is also visible to the second transaction.

[0073] Optionally, the determining, based on the comparison result, whether the second transaction is visible to the data page accessed by the second transaction includes:

[0074] When the comparison result indicates that the log sequence number of the data page is greater than the target log sequence number corresponding to the second transaction, it is determined that the second transaction is not visible to the data page accessed by the second transaction.

[0075] Specifically, if the log sequence number of the data page modified by the second transaction is greater than the target log sequence number corresponding to the second transaction, the comparison result is that the data page accessed by the second transaction is not visible to the second transaction.

[0076] For example, when the comparison result is that the second transaction is not visible to the data page accessed by the second transaction, it is impossible to determine whether the record is visible. It is necessary to further determine whether the record of the data page accessed by the second transaction is visible to the data page accessed by the second transaction based on the specific information of the modification record.

[0077] The technical solution provided by the embodiment of the present invention determines whether a transaction is visible to the transaction access data page by obtaining the comparison result of the log sequence number of the transaction access data page and the target log sequence number corresponding to the transaction. Through the visibility comparison method of this embodiment, the judgment method of transaction visibility is refined, and the visibility determination method of the above embodiment is improved.

[0078] Embodiment 3

[0079] Figure 3 FIG. 1 is a schematic diagram of a visibility determination device provided in Embodiment 3 of the present invention. Figure 3 As shown, the device comprises:

[0080] A first determination module 310 is configured to determine a transaction start log sequence number of a first transaction if it is detected that a data page in a database is modified for the first time by a first transaction;

[0081] A collection module 320, configured to collect, at set intervals, first transactions that modify the database within the set period of time, to form an active transaction set corresponding to the first transactions;

[0082] A selection module 330 is used to select a transaction start log sequence number with the smallest value from the transaction start log sequence numbers corresponding to the active transaction set as the target log sequence number of the active transaction set;

[0083] A second determination module 340 is used to determine the target log sequence number of the active transaction set as the target log sequence number corresponding to the second transaction during the startup phase of the second transaction;

[0084] The third determination module 350 is used to determine whether the second transaction is visible to the data page accessed by the second transaction according to the target log sequence number corresponding to the second transaction in the visibility judgment stage.

[0085] The visibility determination device provided by the present invention first determines multiple transactions that modify the database within a set time period through a first determination module, a collection module, and a selection module, and obtains the minimum value of the transaction start log sequence numbers of the multiple transactions as the target log sequence number. Then, through the second determination module, in the execution phase of the transaction, the log sequence number of the data page accessed by the transaction is obtained. Finally, through the third determination module, the target log sequence number corresponding to the transaction is compared with the log sequence number of the data page accessed by the transaction, and it is judged whether the transaction is visible to the data page accessed by the transaction. By comparing the target log sequence number of the transaction with the log sequence number of the accessed data page, the judgment of whether the transaction accessing the data page is visible to the data page is completed, which reduces data occupancy and improves the efficiency of visibility judgment.

[0086] In one embodiment, the first determination module 310 is specifically used to: subtract a set value from the log sequence number of the data page first modified by the first transaction to obtain a calculation result, and determine the calculation result as the transaction start log sequence number of the first transaction; when the log sequence number of the data page is less than or equal to the transaction start log sequence number of the first transaction, the data page must not be the data page modified by the first transaction.

[0087] In one embodiment, the first determination module 310 is specifically configured to determine the maximum log sequence number that has been allocated by the system when the first transaction allocates a rollback page for the first time as the transaction start log sequence number of the transaction.

[0088] In one embodiment, the third determination module 350 includes:

[0089] a comparison unit, configured to compare a log sequence number of a data page with a target log sequence number corresponding to the second transaction to obtain a comparison result, wherein the log sequence number of the data page includes a log sequence number corresponding to the data page accessed by the second transaction;

[0090] A determination unit is used to determine whether the data page accessed by the second transaction is visible to the second transaction based on the comparison result.

[0091] In one embodiment, the determining unit is specifically configured to: when the comparison result indicates that the log sequence number of the data page is less than or equal to the target log sequence number corresponding to the second transaction, determine that the second transaction is visible to the data page accessed by the second transaction.

[0092] In one embodiment, the determination unit is specifically configured to: when the comparison result indicates that the log sequence number of the data page is greater than the target log sequence number corresponding to the second transaction, determine that the second transaction is not visible to the data page accessed by the second transaction.

[0093] In one embodiment, the second determination module 340 is specifically used to: during the startup phase of the second transaction, determine the minimum value of the transaction startup log sequence numbers corresponding to the determined active transaction set corresponding to the first transaction as the target log sequence number corresponding to the second transaction.

[0094] The visibility determination device provided in the embodiment of the present invention can execute the visibility determination method provided in any embodiment of the present invention, completes the storage of files through the mutual cooperation and collaboration between modules, and has the functional modules and beneficial effects corresponding to the execution method.

[0095] Embodiment 4

[0096] According to an embodiment of the present invention, the present invention also provides an electronic device and a computer-readable storage medium.

[0097] Figure 4 It is a block diagram of an electronic device provided according to Embodiment 4 of the present invention, and the electronic device can implement the visibility determination method described in the embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0098] like Figure 4 As shown, the electronic device 410 includes at least one processor 411, and a memory connected to the at least one processor 411 in communication, such as a read-only memory (ROM) 412, a random access memory (RAM) 413, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 411 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 412 or the computer program loaded from the storage unit 418 to the random access memory (RAM) 413. In the RAM 413, various programs and data required for the operation of the electronic device 410 can also be stored. The processor 411, the ROM 412, and the RAM 413 are connected to each other via a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.

[0099] A number of components in the electronic device are connected to the I / O interface 415, including: an input unit 416, such as a keyboard, a mouse, etc.; an output unit 417, such as various types of displays, speakers, etc.; a storage unit 418, such as a disk, an optical disk, etc.; and a communication unit 419, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 419 allows the electronic device to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0100] The processor 411 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 411 performs the various methods and processes described above, such as a visibility determination method.

[0101] In some embodiments, the visibility determination method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 418. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 410 via the ROM 412 and / or the communication unit 419. When the computer program is loaded into the RAM 413 and executed by the processor 411, one or more steps of the visibility determination method described above may be performed. Alternatively, in other embodiments, the processor 411 may be configured to perform the visibility determination method in any other appropriate manner (e.g., by means of firmware).

[0102] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0103] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0104] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0105] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0106] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0107] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0108] The technical solution of the embodiment of the present invention, through a visibility determination method, device, electronic device and storage medium, first determines multiple transactions that modify the database within a set time period, and obtains the minimum value of the transaction start log sequence numbers of the multiple transactions as the target log sequence number. Then, in the transaction startup phase, the above-mentioned target log sequence number is set as the target log sequence number of the transaction. Then, in the execution phase of the transaction, the log sequence number of the data page accessed by the transaction is obtained. The target log sequence number corresponding to the transaction is compared with the log sequence number of the data page accessed by the transaction, and it is judged whether the transaction is visible to the data page accessed by the transaction. By comparing the log sequence number of the transaction with the log sequence number of the accessed data page, the judgment of whether the transaction accessing the data page is visible to the data page is completed, which reduces data occupancy and improves the efficiency of visibility judgment.

[0109] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0110] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A visibility determination method, characterized in that: include: If it is detected that a data page in the database is modified for the first time by a first transaction, determining a transaction start log sequence number of the first transaction; At set time intervals, collecting first transactions that modify the database within the set time interval to form an active transaction set corresponding to the first transactions; Selecting the transaction start log sequence number with the smallest value from the transaction start log sequence numbers corresponding to the active transaction set as the target log sequence number of the active transaction set; In the startup phase of the second transaction, the target log sequence number of the active transaction set is determined to be the target log sequence number corresponding to the second transaction; In the visibility determination stage, it is determined whether the second transaction is visible to the data page accessed by the second transaction according to the target log sequence number corresponding to the second transaction.

2. The method according to claim 1, characterized in that The determining of the transaction start log sequence number of the first transaction includes: A calculation result is obtained by subtracting a set value from the log sequence number of the data page first modified by the first transaction, and the calculation result is determined as the transaction start log sequence number of the first transaction. When the log sequence number of the data page is less than or equal to the transaction start log sequence number of the first transaction, the data page must not be the data page modified by the first transaction.

3. The method according to claim 1, characterized in that The determining of the transaction start log sequence number of the first transaction includes: When the first transaction is allocated a rollback page for the first time, the maximum log sequence number allocated by the system is determined as the transaction start log sequence number of the transaction.

4. The method according to claim 1, characterized in that: The determining, according to the target log sequence number corresponding to the second transaction, whether the second transaction is visible to the data page accessed by the second transaction includes: Comparing the log sequence number of the data page with the target log sequence number corresponding to the second transaction to obtain a comparison result, wherein the log sequence number of the data page includes the log sequence number corresponding to the data page accessed by the second transaction; Based on the comparison result, it is determined whether the data page accessed by the second transaction is visible to the second transaction.

5. The method according to claim 4, characterized in that The determining, based on the comparison result, whether the second transaction is visible to the data page accessed by the second transaction includes: When the comparison result indicates that the log sequence number of the data page is less than or equal to the target log sequence number corresponding to the second transaction, it is determined that the second transaction is visible to the data page accessed by the second transaction.

6. The method according to claim 4, characterized in that The determining, based on the comparison result, whether the second transaction is visible to the data page accessed by the second transaction includes: When the comparison result indicates that the log sequence number of the data page is greater than the target log sequence number corresponding to the second transaction, it is determined that the second transaction is not visible to the data page accessed by the second transaction.

7. The method according to claim 1, characterized in that The step of determining, during the startup phase of the second transaction, the target log sequence number of the active transaction set as the target log sequence number corresponding to the second transaction includes: In the startup phase of the second transaction, the minimum value of the transaction startup log sequence numbers corresponding to the determined active transaction set corresponding to the first transaction is determined as the target log sequence number corresponding to the second transaction.

8. A visibility determination device, characterized in that: include: A first determination module is used to determine a transaction start log sequence number of the first transaction if it is detected that a data page in the database is modified for the first time by a first transaction; A collection module, configured to collect, at set intervals, first transactions that modify the database within the set period of time to form an active transaction set corresponding to the first transactions; A selection module, configured to select a transaction start log sequence number with the smallest value from the transaction start log sequence numbers corresponding to the active transaction set as the target log sequence number of the active transaction set; A second determination module, configured to determine, during a startup phase of a second transaction, a target log sequence number of the active transaction set as a target log sequence number corresponding to the second transaction; The third determination module is used to determine whether the second transaction is visible to the data page accessed by the second transaction according to the target log sequence number corresponding to the second transaction in the visibility judgment stage.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so as to enable the at least one processor to perform the visibility determination method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the visibility determination method according to any one of claims 1 to 7 when executed.