WO2016117032A1 - データベースシステム、計算機システム、及び、データベース管理方法 - Google Patents

データベースシステム、計算機システム、及び、データベース管理方法 Download PDF

Info

Publication number
WO2016117032A1
WO2016117032A1 PCT/JP2015/051414 JP2015051414W WO2016117032A1 WO 2016117032 A1 WO2016117032 A1 WO 2016117032A1 JP 2015051414 W JP2015051414 W JP 2015051414W WO 2016117032 A1 WO2016117032 A1 WO 2016117032A1
Authority
WO
WIPO (PCT)
Prior art keywords
record
time stamp
records
update
time
Prior art date
Application number
PCT/JP2015/051414
Other languages
English (en)
French (fr)
Inventor
有哉 礒田
敦 友田
知広 花井
一智 牛嶋
田中 剛
Original Assignee
株式会社日立製作所
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 株式会社日立製作所 filed Critical 株式会社日立製作所
Priority to PCT/JP2015/051414 priority Critical patent/WO2016117032A1/ja
Publication of WO2016117032A1 publication Critical patent/WO2016117032A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures

Definitions

  • the present invention generally relates to transaction processing, for example, technology for managing data in transaction processing such as database consistency control.
  • transaction processing is performed in a computer system.
  • a DBMS database management system
  • the DBMS executes so-called transaction processing (Tx processing) for controlling the consistency of records that are input and output data.
  • Tx processing is used when a plurality of reference and update instructions are realized atomically.
  • Tx processing a plurality of instructions in a specified section are processed atomically by declaring the beginning and end of the instruction section to be executed atomically (Tx processing section).
  • the ACID property indicates atomicity, consistency, isolation, and durability.
  • Atomicity means that a plurality of instructions in the Tx processing section are all executed or not executed at all.
  • Consistency means not making a transition to a state other than the rules given to the database.
  • Independence means that the result of Tx processing is always the same as when Tx processing is executed sequentially.
  • Persistence means that if the Tx process is committed, the result of the Tx process can always be restored even if a failure occurs in the DBMS. As described above, the DBMS maintains the consistency of the Tx processing by satisfying the ACID characteristic.
  • Patent Document 1 discloses a technique for deleting a record having a time stamp prior to a snapshot, which is a DBMS permanent process, in a system in which Tx processing and records are managed by time stamps.
  • Patent Document 2 discloses a technique for deleting a record having a time stamp earlier than the oldest time stamp in Tx processing during operation.
  • the DBMS can manage a group of records (a plurality of records) that are at least a part of the database in a memory. Thereby, the number of storage accesses in Tx processing can be reduced, and Tx processing can be executed at high speed.
  • the Tx process refers to the same record multiple times during the Tx process period, it must be guaranteed that the same result is always obtained.
  • the record referred to by the Tx process is deleted from the memory by the GC, in order for the Tx process to refer to the same record repeatedly, the record is transferred from the storage device in which the record is made permanent to the memory. It is necessary to read.
  • the problems as described above are not limited to the computer system that executes the DBMS, but may exist in other computer systems that update records (data units) in transaction processing.
  • a computer system for example, a database system
  • the pre-update record associated with the time stamp is maintained in the storage unit
  • An updated record associated with the updated time stamp is stored in the storage unit.
  • the computer system includes a first time stamp that is a time stamp associated with the first transaction being executed, and a second time stamp that is a time stamp associated with the second transaction being executed.
  • a record that is not referred to by another transaction being executed is specified based on the plurality of records at each of the plurality of time stamps, and the specified record is deleted from the storage unit.
  • xxx list information may be described using the expression “xxx list”, but the information may be expressed in any data structure. That is, in order to show that information does not depend on the data structure, “xxx list” can be called “xxx information”.
  • PDEV indicates a physical storage device, and may typically be a nonvolatile storage device (for example, an auxiliary storage device).
  • the PDEV may be, for example, an HDD (Hard Disk Drive) or an SSD (Solid State Drive).
  • processing may be described using a functional unit (for example, a query receiving unit, a query plan generating unit, and a query executing unit) as a subject.
  • the functional unit is a program (for example, a CPU (Central Processing). Unit)) is executed by using a storage unit (for example, a memory) and / or an interface device (for example, a communication port) or the like, even if the subject of the process is a processor. Good.
  • the processing described with the functional unit as the subject may be processing performed by a processor or an apparatus or system having the processor.
  • the processor may include a hardware circuit that performs a part or all of the processing. At least a part of the plurality of functional units may be realized by a hardware circuit.
  • the program may be installed in a computer-like device from a program source.
  • the program source may be, for example, a storage medium that can be read by a program distribution server or a computer.
  • the program distribution server may include a processor (for example, a CPU) and a storage unit, and the storage unit may further store a distribution program and a program to be distributed.
  • the processor of the program distribution server executes the distribution program, so that the processor of the program distribution server may distribute the distribution target program to other computers.
  • two or more functional units may be realized as one functional unit, or one functional unit may be realized as two or more functional units.
  • FIG. 1 is a schematic block diagram of the entire system according to the embodiment.
  • a user 1000 accesses a computer system (for example, a large-scale computer system realized by a plurality of nodes 1200) 1100 from a computer system (for example, a personal computer) 1110 through a network 1400 such as a LAN, thereby giving instructions to the computer system 1100. Can send.
  • the user 1000 can also directly operate the computer system 1100.
  • the computer system 1100 has one or more nodes 1200.
  • the node 1200 is an example of a computer.
  • a plurality of nodes 1200 may be connected by a system bus 1101.
  • the node 1200 includes a memory 1202, an input / output device 1203, and a processor 1201 connected thereto.
  • the memory 1202 includes at least a main memory (for example, a volatile memory such as a DRAM (Dynamic Random Access Memory)) and an auxiliary memory (for example, a non-volatile memory such as a flash memory).
  • the input / output device 1203 may be a communication interface device or a human machine interface device (for example, an input device such as a keyboard and a pointing device and an output device such as a display device).
  • An external storage apparatus 1300 that can communicate via the network 1400 may be provided outside the computer system 1100.
  • FIG. 2 is a configuration diagram of the DBMS.
  • a DBMS (Database Management System) 1301 is configured by being executed by one or more nodes 1200 (specifically, one or more processors 1201).
  • the DBMS 1301 receives a query from a query source (for example, the computer system 1110), a query reception unit 1311 that generates a query plan that is an execution plan of the query, and a query execution that executes a query according to the query plan.
  • a query source for example, the computer system 1110
  • Tx executed in the Tx process corresponds to Tx of one query according to the query plan. That is, in this embodiment, one TxID is allocated to one query by the query execution unit 1313.
  • the query execution unit 1313 executes a process related to GC. The processing related to GC will be described later.
  • These functional units 1311, 1312, and 1313 may be realized by executing the DBMS 1301 by one or more processors 1201.
  • the query is described in, for example, SQL (Structured Query Language).
  • a database managed (referenced or updated) by the DBMS 1301 is stored in one or more memories 1202, and a so-called in-memory database is realized.
  • data can be acquired at a higher speed from the memory 1202 than from the external storage apparatus 1300. All or part of the database may be stored in the external storage device 1300.
  • FIG. 3 shows data transition management information at the first time point.
  • RecordA to RecordC are mainly taken as an example of a record group (a plurality of records).
  • the data transition management information 2000 is information for the DBMS 1301 to manage a plurality of records in the table using multi-versioning.
  • multi-versioning is one of the methods for managing the record update history. Unlike single versioning in which records are overwritten (records after update remain but records before update do not remain), 1 This is a method of managing both the record before update and the record after update for one record.
  • the data transition management information 2000 is held in at least one of the memory 1202 or the external storage device 1300.
  • the data transition management information 2000 has a column for each time stamp.
  • Information stored in each column is, for example, a time stamp 301 and record values 302A to 302C.
  • the time stamp 301 is a time stamp value.
  • the record value 302 is a value stored in the corresponding record.
  • the column is added every time Tx that changes the state of the record group occurs (every time stamp is added).
  • the time stamp value may be a time or a counter (for example, it may be a counter incremented by 1 at the time of Tx commit of update), and may be any information that can specify the record update order. In the present embodiment, the time stamp value is newer (in the future) and larger (older in the past). For reference only, the timestamp may not be updated.
  • the time stamp may be rephrased as a version of the record group. According to the example of FIG. 3, the state of the record group corresponding to the time stamp “0” (version “0”) is Record A “100”, Record B “200”, and Record C “300”. In the time stamp “1”, Record A is updated from “100” to “101”, and as a result, the state of the record group corresponding to the time stamp “1” is Record A “101”, Record B “200”, and Record C “300”. It is.
  • FIG. 4 shows the TxID list at the first time point. That is, FIG. 4 and FIG. 3 correspond to each other.
  • the TxID list 2100 is a list for managing the time stamp for each Tx for which execution has been started, and is held in at least one of the memory 1202 and the external storage device 1300.
  • the TxID list 2100 has a column for each Tx for which execution has started.
  • the information stored in each column is, for example, TxID 401, start time 402, reference time stamp 403, update time stamp 404, and status 405.
  • the columns are arranged in ascending order of the reference time stamp 403.
  • TxID 401 is an ID of Tx.
  • the start time 402 indicates the start time of Tx.
  • the reference time stamp 403 is a time stamp at the start of Tx.
  • the reference time stamp 403 is used for determining whether or not the record can be referred to.
  • the reference time stamp 403 corresponding to TxID “1” is “1”.
  • the state of the record group corresponding to the time stamp “1” is Record A “101”, Record B “201”, and Record C “300”.
  • the update time stamp 404 is a time stamp after update when the record is updated with Tx.
  • the value of the update time stamp 404 is acquired only by Tx that updated the record. For example, when Tx “0” (Tx of TxID “0”) is updated in Record A, a new column is added to the data transition management information 2000, and the value of Record A is updated to “101”.
  • the time stamp is updated to “1”, and the updated time stamp “1” is stored in the column corresponding to TxID “0” (the column of the TxID list 2100). In this way, Record A “101” and time stamp “1” are associated with each other.
  • State 405 stores the type (processing content) of Tx. Specifically, for example, “R” (Read) is stored for Tx to be referred to, “W” (Write) is stored for Tx to be updated, and “C” ( Commit) is stored.
  • R Read
  • W Write
  • C Commit
  • the state 405 becomes “R” when SELECT
  • the state 405 becomes “RW” when UPDATE
  • the state 405 becomes “RWC” when COMMIT. It becomes.
  • a specific value such as “OR” (Only Read) may be stored.
  • the state 405 becomes “RWC” in any of SELECT, UPDATE, and COMMIT.
  • FIG. 5A to FIG. 5C show transitions of Record A to C.
  • FIG. 6 shows the TxID list at the second time point. 5A to 5C and FIG. 6 correspond to each other.
  • the TxID list at the second time point is given a different reference number (2500), and the information stored in each column of the TxID list 2500 is also Different reference numerals (601) to (605) are attached.
  • Each column in FIG. 5A is a version of RecordA corresponding to that column.
  • Record A stores time stamp 501A, Next 502A, Prev 503A, GC 504A, and Data 505A.
  • the time stamp 501A is a time stamp value indicating the version of Record A.
  • the time stamp 501A is related to the update time stamp 604 and is a time stamp for the record acquired when the record is updated.
  • Next 502A is the address of Record A after the update.
  • the updated Record A may be an address of a memory area (or a value associated therewith). If there is no Record A after the update, Next 502A may be an indefinite value.
  • Prev 503A is the address of Record A before update.
  • the address of Record A before update may also be the address of the memory area (or a value associated therewith).
  • Prev 503A may be an indefinite value.
  • the GC504A is information used in GC.
  • the GC 504A is information (for example, an address (or ID)) that specifies a record other than Record A of this version (time stamp).
  • Data 505A is a value stored in Record A.
  • the value is referred to or updated by Tx.
  • Next 502A is an address of Record A including the time stamp “155”.
  • Prev 503A is an address of Record A including the time stamp “80”.
  • the GC 504A is an indefinite value because the GC process described later is not started.
  • Data 505A is a value stored by Tx of the time stamp “124”.
  • FIG. 7 is a GC list.
  • the record with the time stamp “n” is referred to as “record #n”.
  • the record storing the value y is expressed as “record“ y ””, but the record with the time stamp “n” has a different description “record #n”.
  • the GC list 2600 is held in at least one of the memory 1202 and the external storage device 1300.
  • the GC list 2600 has a column for each time stamp referred to in the GC processing.
  • Information stored in each column is, for example, a time stamp 701 and a record group 702.
  • the time stamp 701 is a time stamp value indicating a record group (a plurality of records) that can be referred to by Tx.
  • the record group 702 is information (for example, an address (or ID) for each record) that identifies a record group that can be referred to corresponding to the time stamp 701. For example, when the record group that can be referred to at the time of the time stamp “102” is Record A # 80 and Record C # 86, the record group 702 corresponding to the time stamp “102” has the smallest time stamp “80”. It is the address (for example, memory address) of the included Record A # 80. And GC504A in RecordA # 80 is the address of RecordC # 86.
  • the record group 702 corresponding to the time stamp “102” is the address of the record that becomes the starting point when managing the record group that can be referred to at the time of the time stamp “102” in a list format (linked list). is there. With such a configuration, a record group that can be referred to can be specified from the reference time stamp 603 of Tx.
  • FIG. 8 shows GC setting information
  • the GC setting information 6000 stores various settings for GC processing.
  • the GC setting information 6000 is information defined by the user 1000 or the computer system 1100, and is held in at least one of the memory 1202 and the external storage device 1300.
  • the GC setting information 6000 includes an execution presence / absence 801, a method 802, an interval threshold value 803, and a start threshold value 804.
  • Execution presence / absence 801 is a flag indicating whether or not to execute the GC process ("ON" means execution).
  • Method 802 represents a GC processing method.
  • Values representing the GC processing method include “MULTI” which means a GC method specific to the present application and “OLD” which means a legacy GC method.
  • the interval threshold value 803 is a threshold value of a difference between two time stamps.
  • the interval threshold 803 is used for determination when registering a Tx time stamp in the GC list 2600. If the difference between two consecutive execution time Tx reference time stamps is more than the interval threshold 803, the time stamp record between the two reference time stamps can be the target of GC processing.
  • “Two consecutive in-execution Tx” refers to any one in-execution Tx and the in-execution Tx corresponding to the next reference time stamp after the reference time stamp of the in-execution Tx.
  • the start threshold 804 is a time (time length) threshold.
  • the start threshold value 804 is used for determination when a Tx time stamp is registered in the GC list 2600.
  • a record with a time stamp of Tx whose start time is a time before the start threshold 804 before the current time can be the target of the GC process.
  • the query execution unit 1313 can determine a candidate for GC processing as follows, for example. That is, a Tx time stamp record whose start time is a time in the past before the start threshold 804 than the current time is set as a candidate for GC processing. In addition, the query execution unit 1313 determines that two reference times having a difference that is greater than or equal to the interval threshold 803 only for a record with a time stamp of Tx having a start time between the current time and the start time 804 before the current time. A record corresponding to the time stamp between the stamps (the reference time stamps of two consecutive Tx being executed) may be identified and used as a candidate for GC processing.
  • the query execution unit 1313 may select a GC target candidate record using the interval threshold value 803 for a Tx time stamp record whose start time is at or before the start threshold value 804 before the current time. Good. At least one of the interval threshold value 803 and the start threshold value 804 may be set by the user 1000. One of the interval threshold value 803 and the start threshold value 804 may not be set.
  • At least one value of the interval threshold value 803 and the start threshold value 804 is a time stamp value or time information (information in which the value is expressed in time). Good.
  • FIG. 9 is a flowchart of the GC process.
  • the query execution unit 1313 When the query execution unit 1313 starts the GC process (S3000), the query execution unit 1313 divides the process based on the value of the execution presence / absence 801 of the GC setting information 6000 (S3100). For example, if the execution presence / absence 801 is “OFF” (S3100: OFF), the query execution unit 1313 ends the GC process (S3900). On the other hand, if the execution presence / absence 801 is “ON” (S3100: ON), the query execution unit 1313 generates the TxID list 2500 (S3200). Specifically, the query execution unit 1313 generates a TxID list 2500 in which information on Tx being executed is registered. The columns of the TxID list 2500 are preferably arranged in ascending order of the reference time stamp 603. This is because the GC process proceeds in ascending order of the reference time stamp 603.
  • the query execution unit 1313 divides processing to be executed based on the method 802 of the GC setting information 6000 (S3300). Specifically, the query execution unit 1313 executes multi-GC processing if the method 802 is “MULTI” (S3600: see FIG. 10), and the old GC processing (legacy) if the method 802 is “OLD”. GC processing) is executed (S3700). By setting the value of the method 802 to a value according to the property of Tx, appropriate GC processing can be performed. In the old GC process, the query execution unit 1313 deletes a record including a time stamp before the earliest reference time stamp 102 registered in the TxID list 2500.
  • the query execution unit 1313 After executing the process of S3600 or S3700, the query execution unit 1313 ends the GC process (S3900).
  • FIG. 10 is a flowchart of the multi-GC process (S3600).
  • the query execution unit 1313 starts the multi-GC process (S3610), and refers to the interval threshold value 803 and the start threshold value 804 of the GC setting information 6000 (S3620). Note that S3620 may be merged with S3630, and in this case, S5000 may be performed without S3620.
  • the query execution unit 1313 performs GC list collection processing (S5000: see FIG. 11) that executes GC based on the determination result of whether or not GC of the record group corresponding to the time stamp registered in the GC list 2600 is possible.
  • GC list collection processing S5000: see FIG. 11
  • executes GC based on the determination result of whether or not GC of the record group corresponding to the time stamp registered in the GC list 2600 is possible.
  • a time stamp that does not correspond to the reference time stamp 603 of the TxID list 2500 that is, the time stamp of the completed Tx
  • a version record corresponding to the time stamp is stored in the GC list. It is deleted in the collection process (S5000).
  • the query execution unit 1313 selects a time stamp to be registered in the GC list 2600 based on the interval threshold value 803 and the start threshold value 804 referred to in S3620, and registers the selected time stamp in the GC list 2600 (S3630). . Specifically, the query execution unit 1313 registers the time stamp of Tx whose start time is the time before the start threshold 804 before the current time in the GC list 2600 and the difference that is more than the interval threshold 803. At least one of registering the two reference time stamps to the GC list 2600 is executed.
  • the current time is “12:10”
  • the GC setting information 6000 is in the state shown in FIG. 8
  • the TxID list 2500 is in the state shown in FIG. 6, and Records A to Record C are shown in FIG.
  • the time “11:10” before the start threshold “01:00” from the current time “12:10” is the time “11:10”.
  • the Tx whose execution has started in the past at time “11:10” is Tx “1” whose start time 602 is “10:23”, and the reference time stamp of Tx “1” is “102”.
  • the processing load for selecting the GC target Tx using the start threshold 804 is lower than the processing load for selecting the GC processing target Tx without using the start threshold. This is because the number of Tx is small.
  • two reference time stamps (differences between two consecutive Txs being executed Tx) having a difference that is more than or equal to the interval threshold “30” are a set of “102” and “203” and “203” ”And“ 234 ”. Therefore, the time stamps registered in the GC list 2600 are “102”, “203”, and “234”, and Tx corresponding to them is Tx “1”, “0”, and “4”.
  • the reason for selecting a time stamp registered in the GC list 2600 using the interval threshold value 803 is that if many updates occur between the current time and the current time before the start threshold value 804, many records remain in the memory. Because it is.
  • the query execution unit 1313 registers the record group in the GC list 2600 and executes GC (S3650).
  • the query execution unit 1313 generates a linked list for the record group 702 corresponding to the registered time stamp 701, and stores the address of the first record in the linked list in the GC list 2600 as the record group 702. sign up.
  • the query execution unit 1313 generates a linked list in descending order of time stamps (the arrangement of records in the linked list is not limited to the order in which the time stamps are large, but may be in an order according to other criteria, or It may be a regular order).
  • the record group 702 that can be referred to corresponding to the time stamp 701 (the first record in the linked list) is the latest record having a time stamp 501 smaller than the time stamp 701.
  • Each time a record is updated (UPDATE), the existing record becomes an old record, and the updated record becomes the “latest record”. For example, referring to RecordA in FIG. 5A, RecordA # 264 (RecordA corresponding to time stamp “264”) is the latest RecordA, and RecordA # 80 is the oldest RecordA. At this time, Record A # 124 that can be referred to for the time stamp “130” is Record A # 124. Further, when the linked list is generated, if the GC 504 of a certain record has already been described, the query execution unit 1313 deletes the time stamp 701 corresponding to the record group including the record from the GC list 2600. In addition, the record 504 updated in the generation of the linked list is initialized.
  • the query execution unit 1313 sets a value (for example, “Null”) indicating the end to the GC 504 of the last record in the linked list.
  • the query execution unit 1313 executes GC. For example, the query execution unit 1313 executes the following process when GC (deleting) a record having a time stamp that is larger than the time stamp “102” and smaller than the time stamp “203”. That is, the query execution unit 1313 first identifies Record A # 155 indicated by the record group 702 corresponding to the larger time stamp “203” of the time stamps “102” and “203”. The query execution unit 1313 refers to the Prev 503A of Record A # 155 and identifies the pre-update Record A # 124.
  • Record A # 124 is not a record referred to by the execution Tx “0” of the time stamp “203” of the GC list 2600, and the execution Tx of the time stamp “102” immediately before the time stamp “203”. Since it is not a record referred to by “1”, it is determined that GC is possible. Similarly, the query execution unit 1313 determines whether or not the pre-update RecordA # 80 indicated by the Prev 503A of the RecordA # 124 can be GC. Since Record A # 80 is a record that can be referred to by Tx “1” during execution of time stamp “102”, query execution unit 1313 determines that GC is impossible.
  • the query execution unit 1313 changes the Next 502A of the Record A # 80 from the address of the Record A # 124 to the address of the Record A # 155.
  • the Prev 503A of 155 is changed from the address of Record A # 124 to the address of Record A # 80, and then Record A # 124 is deleted from the memory.
  • the query execution unit 1313 displays Record B # 172 (record including the time stamp “172” next to the time stamp “155” among the time stamps registered in the record group) indicated by the GC 504A of Record A # 155. Identify.
  • the query execution unit 1313 executes the same process as the series of processes until the referenced GC 504 reaches the termination value (NULL). By this process, a record corresponding to a time stamp (version) larger than the time stamp “102” and smaller than the time stamp “203” and not referenced by the executing Tx can be deleted from the memory.
  • a record that is not referred to by Tx during execution can be deleted from the memory.
  • tracing the link of the record group the address indicated by the record group 702 and the address indicated by the GC 504
  • the query execution unit 1313 deletes a record corresponding to a time stamp smaller than the smallest time stamp “102” in the GC list 2600 and not referenced by the currently executing Tx from the memory.
  • a record corresponding to a time stamp smaller than the minimum time stamp “102” is identified by tracing from the record group 702 corresponding to the minimum time stamp “102”.
  • a record with a time stamp (old version) smaller than the minimum time stamp “102” and not referenced can be deleted from the memory.
  • the query execution unit 1313 ends the multi-GC process (S3690).
  • FIG. 11 is a flowchart of the GC list collection process (S5000).
  • the query execution unit 1313 determines whether or not there is a time stamp designated for execution of GC (hereinafter, designated time stamp) (S5200). As a result, if there is a specified time stamp (S5200: applicable), the query execution unit 1313 proceeds to S5300, and if there is no specified time stamp (S5200: not applicable), the GC list collection process is terminated ( S5900).
  • time stamp designated for execution of GC
  • the query execution unit 1313 executes the GC with the specified time stamp.
  • the designated time stamp is the time stamp “203” of the GC list 2600 is taken as an example.
  • a record group 702 corresponding to the designated time stamp “203” indicates the address of Record A # 155.
  • the query execution unit 1313 associates the updated Record A # 231 indicated by Next 502A of Record A # 155 with the pre-update Record A # 124 indicated by Prev 503A of Record A # 155.
  • the query execution unit 1313 changes the Prev 503A of RecordA # 231 to the address of RecordA # 124, and changes the Next 502A of RecordA # 124 to the address of RecordA # 231. Thereby, even if the record corresponding to the specified time stamp is deleted, the context of the record version is maintained.
  • the query execution unit 1313 specifies RecordB # 172 indicated by the GC 504A of RecordA # 155, and performs the same processing as Record # 155 for Record # 172.
  • the query execution unit 1313 executes such processing until the GC 504 reaches the termination value “NULL”. Thereafter, the query execution unit 1313 deletes the records in the record group starting with Record A # 155 from the memory.
  • the query execution unit 1313 After executing S5300, the query execution unit 1313 ends the GC list collection process (S5900). Note that this GC list collection process (S5000) may be executed at another trigger instead of or in addition to the trigger described above.
  • FIG. 12 is a flowchart of the Tx process.
  • the query execution unit 1313 starts Tx processing, and adds a column including a TxID 601 corresponding to the Tx, a start time 602, a reference time stamp 603, an update time stamp 604, and a state 605 to the TxID list 2500.
  • the reference time stamp 603 is a value of the current time stamp (latest time stamp).
  • the query execution unit 1313 executes an SQL process including at least one of reference and update of a record in the database (S4100).
  • the query execution unit 1313 updates the state 605 of the TxID list 2500 according to the contents of the SQL process.
  • the state 605 registered in S4000 may be an indefinite value.
  • the state 605 registered in S4000 may be a value declared from a query source (for example, the computer system 1110).
  • the SQL process is a process according to a query execution plan generated based on an accepted query.
  • the query execution unit 1313 acquires an update time stamp corresponding to the Tx to be ended as a post-processing (COMMIT processing) of Tx, and performs log output (S4200).
  • the query execution unit 1313 executes a GC list collection process at the end of Tx (S5000).
  • the query execution unit 1313 if the GC list 2600 has a time stamp 701 having the same value as the reference time stamp 603 corresponding to the Tx ID of the Tx to be ended, the record corresponding to the time stamp 701 is stored. Run GC. After the end of the GC list collection process (S5000), the query execution unit 1313 ends the Tx process (S4900).
  • the GC of this record can be performed after the end of Tx (COMMIT).
  • the memory 1202 may be an example of a storage unit.
  • the storage unit may include an auxiliary storage device (typically a nonvolatile storage device) instead of or in addition to the memory 1202.
  • Computer system 1200 Node 1201: Processor 1202: Memory 1301: DBMS

Abstract

 計算機システム(例えばデータベースシステム)が、トランザクションを実行することにより記憶部内の複数のレコードのうちのいずれかのレコードを更新する場合、タイムスタンプが関連付けられている更新前レコードを記憶部に維持し、更新後のタイムスタンプを関連付けた更新後レコードを記憶部に格納する。計算機システムは、実行中の第1のトランザクションに対応付けられたタイムスタンプである第1のタイムスタンプと、実行中の第2のトランザクションに対応付けられたタイムスタンプである第2のタイムスタンプとの間のタイムスタンプに対応したレコードのうち、実行中の他のトランザクションから参照されないレコードを、複数のタイムスタンプの各々での複数のレコードを基に特定し、特定したレコードを記憶部から削除する。

Description

データベースシステム、計算機システム、及び、データベース管理方法
 本発明は、概して、トランザクション処理に関し、例えば、データベースの一貫性制御等のトランザクション処理におけるデータを管理する技術に関する。
 一般に、計算機システムにおいてトランザクションの処理が行われている。トランザクションを処理するシステムとして、例えば、DBMS(データベース管理システム)が知られている。DBMSは、入出力するデータであるレコードの一貫性を制御するいわゆるトランザクション処理(Tx処理)を実行する。これにより、DBMSにおいては、ユーザは常に意図したレコードを入出力することが可能となる。Tx処理は、複数の参照、更新命令をアトミックに実現するときに用いられる。Tx処理では、アトミックに実行したい命令区間の始めと終わり(Tx処理区間)を宣言することにより、指定した区間の複数の命令をアトミックに処理する。
 Tx処理を実現するためには、ACID特性を満たす必要がある。ACID特性とは、原子性(Atomicity)、一貫性(Consistency)、独立性(Isolation)及び永続性(Durability)を示す。原子性とは、Tx処理区間の複数の命令を全て実行するか、全て実行させないことである。一貫性とは、データベースに与えられたルール以外の状態に遷移させないことである。独立性とは、Tx処理の結果は、必ずTx処理を逐次的に実行したときと同じになることをいう。永続性とは、Tx処理がコミットしていれば、DBMSに故障が発生していても必ずTx処理の結果を復元できることをいう。このように、DBMSでは、ACID特性を満たすことによって、Tx処理の一貫性を維持している。
 しかし、高度な一貫性制御により、DBMSの処理能力が低下する課題がある。例えば、Tx処理の一貫性制御を維持しつつ、不要なレコードを削除するガベージコレクション(GC)が処理能力低下の原因となる。
 この課題に対し、特許文献1又は2に開示の技術がある。特許文献1には、Tx処理やレコードがタイムスタンプで管理されるシステムにおいて、DBMSの永続化処理であるスナップショットより以前のタイムスタンプを持つレコードを削除する技術が開示されている。特許文献2には、動作中のTx処理で最も古いタイムスタンプより以前のタイムスタンプを持つレコードを削除する技術が開示されている。
米国特許公開2014/149353号明細書 米国特許6125371号
 DBMSはデータベースの少なくとも一部であるレコード群(複数のレコード)をメモリで管理することが可能である。これにより、Tx処理におけるストレージアクセス回数を軽減でき、Tx処理を高速に実行することが可能である。
 特定の一貫性制御において、Tx処理期間中にTx処理が同一レコードを複数回参照するのであれば、必ず同じ結果が得られることが保証されなければならない。このとき、Tx処理が参照しているレコードがGCによってメモリから削除された場合、このTx処理が繰り返し同じレコードを参照するには、このレコードが永続化されているストレージ装置からそのレコードをメモリへと読み出す必要がある。
 また、近年、マルチバージョニングを用いてレコードを管理ことが行われている。マルチバージョニングでは、同一のレコードに関する複数のバージョン(同じレコードに関する複数の時点の状態)を管理する。このようなマルチバージョニングを用いてレコードを管理する場合には、同一のレコードについての複数のバージョンのレコードがメモリ上に配置される。
 例えば、大規模なレコード参照があると、その処理に長い時間(例えば数時間)かかることがある。また、たくさんのレコード更新があると、参照処理において参照済みのレコードを削除することはできても、最新の更新から参照処理間のレコードを削除することはできない。
 メモリ容量には制限があり、複数のバージョンのレコードがメモリに配置されると、メモリ容量の不足が生じやすくなり、結果として、レコードの追加、更新、及び削除といった操作ができなくなる懸念がある。一方、無闇にGCを実施すると、レコードを記憶するストレージ装置へのアクセス回数が増加し、Tx処理時間が長くなる懸念がある。
 上述のような課題は、DBMSを実行する計算機システムに限らず、レコード(データ単位)をトランザクション処理において更新する他の計算機システムにも有り得る。
 計算機システム(例えばデータベースシステム)が、トランザクションを実行することにより記憶部内の複数のレコードのうちのいずれかのレコードを更新する場合、タイムスタンプが関連付けられている更新前レコードを記憶部に維持し、更新後のタイムスタンプを関連付けた更新後レコードを記憶部に格納する。計算機システムは、実行中の第1のトランザクションに対応付けられたタイムスタンプである第1のタイムスタンプと、実行中の第2のトランザクションに対応付けられたタイムスタンプである第2のタイムスタンプとの間のタイムスタンプに対応したレコードのうち、実行中の他のトランザクションから参照されないレコードを、複数のタイムスタンプの各々での複数のレコードを基に特定し、特定したレコードを記憶部から削除する。
 実行中のトランザクション処理に関与しないレコードを特定してそのようなレコードを記憶部から削除できる。
実施形態に係るシステム全体の概要のブロック図である。 DBMSの構成図である。 第1の時点でのデータ遷移管理情報を示す。 第1の時点でのTxIDリストを示す。 RecordAの遷移を示す。 RecordBの遷移を示す。 RecordCの遷移を示す。 第2の時点でのTxIDリストを示す。 第2の時点でのGC(ガベージコレクション)リストである。 GC設定情報を示す。 GC処理のフローチャートである。 マルチGC処理のフローチャートである。 GCリスト回収処理のフローチャートである。 Tx(トランザクション)処理のフローチャートである。
 以下、図面を参照して、本発明の一実施形態が適用されたDBMSを実行する計算機システムを説明する。
 以下の説明では、「×××リスト」の表現にて情報を説明することがあるが、情報は、どのようなデータ構造で表現されていてもよい。すなわち、情報がデータ構造に依存しないことを示すために、「×××リスト」を「×××情報」と呼ぶことができる。
 また、以下の説明では、「PDEV」は、物理的な記憶デバイスを示し、典型的には、不揮発性の記憶デバイス(例えば補助記憶デバイス)でよい。PDEVは、例えば、HDD(Hard Disk Drive)又はSSD(Solid State Drive)でよい。
 また、以下の説明では、機能部(例えば、クエリ受付部、クエリプラン生成部、クエリ実行部)を主語として処理を説明する場合があるが、機能部は、プログラムがプロセッサ(例えばCPU(Central Processing Unit))によって実行されることで、定められた処理を、適宜に記憶部(例えばメモリ)及び/又はインターフェースデバイス(例えば通信ポート)等を用いながら行うため、処理の主語がプロセッサとされてもよい。機能部を主語として説明された処理は、プロセッサあるいはそのプロセッサを有する装置又はシステムが行う処理としてもよい。また、プロセッサは、処理の一部または全部を行うハードウェア回路を含んでもよい。複数の機能部のうちの少なくとも一部がハードウェア回路で実現されてもよい。プログラムは、プログラムソースから計算機のような装置にインストールされてもよい。プログラムソースは、例えば、プログラム配布サーバまたは計算機が読み取り可能な記憶メディアであってもよい。プログラムソースがプログラム配布サーバの場合、プログラム配布サーバはプロセッサ(例えばCPU)と記憶部を含み、記憶部はさらに配布プログラムと配布対象であるプログラムとを記憶してよい。そして、プログラム配布サーバのプロセッサが配布プログラムを実行することで、プログラム配布サーバのプロセッサは配布対象のプログラムを他の計算機に配布してよい。また、以下の説明において、2以上の機能部が1つの機能部として実現されてもよいし、1つの機能部が2以上の機能部として実現されてもよい。
 また、以下の説明では、「トランザクション」を「Tx」と表記し、ガベージコレクションを「GC」と表記する。
 また、以下の説明では、同一の要素を区別しないで説明する場合、参照符号の共通符号又は名称のみを使用するが(例えば、TxID、データ遷移管理情報2000)、同一の要素を区別して説明する場合、要素の参照符号全体、ID又は値を使用する(例えば、TxID「200」、レコード管理情報2200A)ことがある。
 図1は、実施形態に係るシステム全体の概要のブロック図である。
 ユーザ1000は、計算機システム(例えばパーソナルコンピュータ)1110からLAN等のネットワーク1400を通じて、計算機システム(例えば複数のノード1200により実現される大規模計算機システム)1100にアクセスすることによって、計算機システム1100に命令を送ることができる。ユーザ1000は、計算機システム1100を直接操作することも可能である。
 計算機システム1100は、1以上のノード1200を有する。ノード1200は、計算機の一例である。複数のノード1200間は、システムバス1101によって接続されていてもよい。
 ノード1200は、メモリ1202、入出力デバイス1203、及びそれらに接続されたプロセッサ1201を有する。メモリ1202は、主メモリ(例えば、DRAM(Dynamic Random Access Memory)のような揮発メモリ)及び補助メモリ(例えばフラッシュメモリのような不揮発メモリ)のうちの少なくとも主メモリを含む。入出力デバイス1203は、通信インターフェイスデバイスでもよいし、ヒューマンマシンインターフェイスデバイス(例えば、キーボード及びポインティングデバイスのような入力デバイスと、表示デバイスのような出力デバイス)でもよい。また、計算機システム1100の外部に、ネットワーク1400経由で通信可能な外部ストレージ装置1300があってもよい。
 図2は、DBMSの構成図である。
 DBMS(Database Management System)1301は、1以上のノード1200(具体的には、1以上のプロセッサ1201)で実行されることにより構成される。DBMS1301は、クエリソース(例えば計算機システム1110)からクエリを受け付けるクエリ受付部1311と、そのクエリの実行プランであるクエリプランを生成するクエリプラン生成部1312と、そのクエリプランに従いクエリを実行するクエリ実行部1313とを有する。Tx処理で実行されるTxは、クエリプランに従う1つのクエリのTxに対応する。つまり、本実施形態では、1つのクエリに対して1つのTxIDがクエリ実行部1313により割り振られる。クエリ実行部1313は、GCに関する処理を実行する。GCに関する処理については、後述する。これらの機能部1311、1312、及び1313は、DBMS1301が1以上のプロセッサ1201に実行されることにより実現されてよい。クエリは、例えば、SQL(Structured Query Language)で記述されている。
 DBMS1301によって管理(参照又は更新等)されるデータベースは、1以上のメモリ1202に格納されており、いわゆるインメモリデータベースが実現されている。ここで、外部ストレージ装置1300からよりも、メモリ1202からの方が、高速にデータを取得することができる。データベースの全部又は一部が、外部ストレージ装置1300に格納されてもよい。
 図3は、第1の時点でのデータ遷移管理情報を示す。以下、レコード群(複数のレコード)として、主に、RecordA~RecordCを例に取る。
 データ遷移管理情報2000は、DBMS1301がマルチバージョニングを用いてテーブルの複数のレコードを管理するための情報である。ここで、マルチバージョニングとは、レコードの更新履歴を管理する方法の一つであり、レコードが上書きされる(更新後のレコードが残るが更新前のレコードが残らない)シングルバージョニングとは異なり、1つのレコードについて更新前のレコードと更新後のレコードの両方を管理する方法である。データ遷移管理情報2000は、メモリ1202又は外部ストレージ装置1300の少なくとも1つに保持される。
 データ遷移管理情報2000は、タイムスタンプ毎にカラムを有する。各カラムが記憶する情報は、例えば、タイムスタンプ301及びレコード値302A~302Cである。タイムスタンプ301は、タイムスタンプの値である。レコード値302は、対応するレコードに格納されている値である。
 カラムは、レコード群の状態を遷移させるTxが発生する都度に(タイムスタンプが追加される都度に)追加される。タイムスタンプの値は、時刻やカウンタでもよく(例えば更新のTxのコミットのときに1インクリメントされるカウンタでよく)、要は、レコード更新の順序を特定することのできる情報であればよい。本実施形態では、タイムスタンプの値は、新しいほど(将来であるほど)大きく古いほど(過去であるほど)小さい。参照のみの場合、タイムスタンプは更新されないでよい。タイムスタンプは、レコード群のバージョンと言い換えられてもよい。図3の例によれば、タイムスタンプ「0」(バージョン「0」)に対応するレコード群の状態は、RecordA「100」、RecordB「200」、RecordC「300」である。タイムスタンプ「1」では、RecordAが「100」から「101」に更新され、結果、タイムスタンプ「1」に対応するレコード群の状態は、RecordA「101」、RecordB「200」、及びRecordC「300」である。
 図4は、第1の時点でのTxIDリストを示す。つまり、図4と図3は互いに対応している。
 TxIDリスト2100は、実行が開始されたTxごとのタイムスタンプを管理するためのリストであり、メモリ1202又は外部ストレージ装置1300の少なくとも1つに保持される。
 TxIDリスト2100は、実行が開始されたTx毎にカラムを有する。各カラムが記憶する情報は、例えば、TxID401、開始時刻402、参照タイムスタンプ403、更新タイムスタンプ404、及び、状態405である。TxIDリスト2100(及び後述のTxIDリスト2500)では、参照タイムスタンプ403の小さい順にカラムが並ぶ。
 TxID401は、TxのIDである。開始時刻402は、Txの開始時刻を示す。
 参照タイムスタンプ403は、Txの開始時のタイムスタンプである。参照タイムスタンプ403は、レコードを参照可能か否かの判断のために用いられる。例えば、TxID「1」に対応する参照タイムスタンプ403は「1」である。データ遷移管理情報2000を参照することにより、タイムスタンプ「1」に対応したレコード群の状態は、RecordA「101」、RecordB「201」、RecordC「300」であることを把握できる。
 更新タイムスタンプ404は、Txでレコードを更新した際の更新後のタイムスタンプである。更新タイムスタンプ404の値は、レコードを更新したTxのみにより取得される。例えば、Tx「0」(TxID「0」のTx)は、RecordAの更新を行った場合には、データ遷移管理情報2000に新たなカラムを追加し、RecordAの値を「101」に更新し、タイムスタンプを「1」に更新し、TxID「0」に対応したカラム(TxIDリスト2100のカラム)に、更新タイムスタンプ「1」を格納する。このようにして、RecordA「101」と、タイムスタンプ「1」とが関連付けられる。
 状態405は、Txの種類(処理内容)を格納する。具体的には、例えば、参照を行うTxについては「R」(Read)が格納され、更新を行うTxについては「W」(Write)が格納され、処理内容が確定したときに「C」(Commit)が格納される。従って、例えば、SELECT、UPDATE、COMMITの順に処理が進む場合、SELECTのときに状態405が「R」となり、UPDATEのときに状態405が「RW」となり、COMMITのときに状態405が「RWC」となる。なお、参照のみに限定したTxについては、「OR」(Only Read)のような特定の値が格納されてよい。また、処理内容が事前にクエリソース(例えば計算機システム1110)から宣言された場合、SELECT、UPDATE及びCOMMITのいずれのときも状態405は「RWC」となる。
 図5A~図5Cは、RecordA~Cの遷移を示す。図6は、第2の時点でのTxIDリストを示す。図5A~図5Cと図6は互いに対応している。第1の時点でのTxIDリストとの混同を避けるために、第2の時点でのTxIDリストには、異なる参照符号(2500)を付し、TxIDリスト2500の各カラムが記憶する情報にも、異なる参照符号(601)~(605)を付す。
 RecordAを例に取り、レコードの構成を説明する。図5Aの各カラムが、そのカラムに対応したバージョンのRecordAである。RecordAは、タイムスタンプ501A、Next502A、Prev503A、GC504A、及び、Data505Aを記憶する。
 タイムスタンプ501Aは、RecordAのバージョンを示すタイムスタンプの値である。タイムスタンプ501Aは、更新タイムスタンプ604と関連し、レコードが更新された際に取得されるレコードに対するタイムスタンプである。
 Next502Aは、更新後RecordAのアドレスである。本実施形態では、インメモリデータベースが採用されているので、更新後RecordAは、メモリ領域のアドレス(又はそれに関連付けられた値)でよい。更新後RecordAが無い場合、Next502Aは、不定値でよい。
 Prev503Aは、更新前RecordAのアドレスである。更新前RecordAのアドレスも、メモリ領域のアドレス(又はそれに関連付けられた値)でよい。更新前RecordAのアドレスが無い場合、Prev503Aには、不定値でよい。
 GC504Aは、GCにて用いられる情報である。GC504Aは、このバージョン(タイムスタンプ)のRecordA以外のレコードを特定する情報(例えばアドレス(又はID)である。
 Data505Aは、RecordAに格納された値である。その値が、Txにより、参照又は更新される。
 タイムスタンプ「124」を含んだRecordAを説明する。Next502Aは、タイムスタンプ「155」を含んだRecordAのアドレスである。Prev503Aは、タイムスタンプ「80」を含んだRecordAのアドレスである。GC504Aは、後述するGC処理が開始されていない状態であるので、不定値である。Data505Aは、タイムスタンプ「124」のTxにより格納された値である。
 図7は、GCリストである。なお、以下、タイムスタンプ「n」のレコードを、「レコード#n」と表記する。値yを格納したレコードは、「レコード「y」」と表記されるが、タイムスタンプ「n」のレコードは、異なる表記「レコード#n」となる。
 GCリスト2600は、メモリ1202及び外部ストレージ装置1300の少なくとも1つに保持される。GCリスト2600は、GC処理で参照するタイムスタンプ毎のカラムを有する。各カラムが記憶する情報は、例えば、タイムスタンプ701及びレコード群702である。
 タイムスタンプ701は、Txで参照可能なレコード群(複数のレコード)を示すタイムスタンプの値である。
 レコード群702は、タイムスタンプ701に対応する参照可能なレコード群を特定する情報(例えばレコード毎のアドレス(又はID))である。タイムスタンプ「102」の時点で参照可能なレコード群は、例えば、RecordA#80及びRecordC#86であるとすると、タイムスタンプ「102」に対応したレコード群702は、最も小さいタイムスタンプ「80」を含んだRecordA#80のアドレス(例えば、メモリアドレス)である。そして、RecordA#80内のGC504Aが、RecorodC#86のアドレスである。このように、タイムスタンプ「102」に対応したレコード群702は、 タイムスタンプ「102」の時点で参照可能なレコード群をリスト形式(リンクドリスト)で管理するときの起点となるレコードのアドレスである。このような構成により、Txの参照タイムスタンプ603から、参照可能なレコード群を特定できる。
 図8は、GC設定情報である。
 GC設定情報6000は、GC処理の各種設定を格納する。GC設定情報6000は、ユーザ1000又は計算機システム1100が定義する情報であり、メモリ1202及び外部ストレージ装置1300の少なくとも1つに保持される。
 GC設定情報6000は、実行有無801、方式802と、間隔閾値803及び開始閾値804を含む。
 実行有無801は、GC処理を実行するか否かのフラグである(「ON」が実行を意味)。
 方式802は、GC処理の方式を表す。GC処理の方式を表す値としては、本願特有のGC方式を意味する「MULTI」と、レガシーなGC方式を意味する「OLD」がある。
 間隔閾値803は、2つのタイムスタンプ間の差の閾値である。間隔閾値803は、GCリスト2600にTxのタイムスタンプを登録するときの判断に用いられる。連続した2つの実行中Txの参照タイムスタンプ間の差が間隔閾値803以上離れていれば、その2つの参照タイムスタンプ間のタイムスタンプのレコードが、GC処理の対象となり得る。「連続した2つの実行中Tx」とは、任意の1つの実行中Txと、その実行中Txの参照タイムスタンプの次に新しい参照タイムスタンプに対応した実行中Txである。間隔閾値803の値を、Txの性質等に応じて変えることにより、GC処理対象のレコードを適切に決定できる。
 開始閾値804は、時間(時間長)の閾値である。開始閾値804は、GCリスト2600にTxのタイムスタンプを登録するときの判断に用いられる。現在時刻よりも開始閾値804前以上過去における時刻が開始時刻であるTxのタイムスタンプのレコードが、GC処理の対象となり得る。開始閾値804の値を、Txの性質等に応じて変えることにより、GC処理対象のレコードを適切に決定できる。
 本実施形態では、クエリ実行部1313が、GC処理対象の候補を例えば次のように決定できる。すなわち、現在時刻よりも開始閾値804前以上過去における時刻が開始時刻であるTxのタイムスタンプのレコードを、GC処理対象の候補とする。また、クエリ実行部1313は、現在時刻と現在時刻よりも開始閾値804前との間を開始時刻とするTxのタイムスタンプのレコードについてのみ、間隔閾値803以上離れている差を有する2つの参照タイムスタンプ(連続した2つの実行中Txの参照タイムスタンプ)間のタイムスタンプに対応したレコードを特定し、GC処理対象の候補としてよい。これにより、現在時刻と現在時刻から開始閾値804前との間にたくさんの更新が発生することによりたくさんのレコードがメモリに格納されることになっても、そのたくさんのレコードからGC処理対象を適切に選択し削除することができる。勿論、クエリ実行部1313は、現在時刻よりも開始閾値804前以上過去における時刻が開始時刻であるTxのタイムスタンプのレコードについても、間隔閾値803を用いてGC対象候補のレコードを選定してもよい。間隔閾値803及び開始閾値804の少なくとも1つは、ユーザ1000により設定可能でよい。間隔閾値803及び開始閾値804の一方が設定されていなくてもよい。
 なお、タイムスタンプ値と時刻との間には、相関関係が成り立つので、間隔閾値803及び開始閾値804の少なくとも1つの値は、タイムスタンプ値又は時間情報(値が時刻で表現された情報)でもよい。
 以下、本実施形態で行われる処理を説明する。
 図9は、GC処理のフローチャートである。
 GC処理は、クエリ実行部1313により実行される。クエリ実行部1313は、GC処理を開始すると(S3000)、GC設定情報6000の実行有無801の値に基づいて処理を分ける(S3100)。例えば、実行有無801が「OFF」であれば(S3100:OFF)、クエリ実行部1313は、GC処理を終了する(S3900)。一方、実行有無801が「ON」であれば(S3100:ON)、クエリ実行部1313は、TxIDリスト2500を生成する(S3200)。具体的には、クエリ実行部1313は、実行中のTxの情報が登録されたTxIDリスト2500を生成する。TxIDリスト2500のカラムは、参照タイムスタンプ603の小さい順に並んでいることが好ましい。参照タイムスタンプ603が小さい順にGC処理が進むためである。
 次に、クエリ実行部1313は、GC設定情報6000の方式802に基づいて、実行する処理を分ける(S3300)。具体的には、クエリ実行部1313は、方式802が「MULTI」であれば、マルチGC処理を実行し(S3600:図10参照)、方式802が「OLD」であれば、旧GC処理(レガシーのGC処理)を実行する(S3700)。方式802の値がTxの性質に応じた値とすることで、適切なGC処理を行うことができる。なお、旧GC処理では、クエリ実行部1313は、TxIDリスト2500に登録されている最先の参照タイムスタンプ102よりも前のタイムスタンプを含むレコードを削除する。
 S3600又はS3700の処理を実行した後、クエリ実行部1313は、GC処理を終了する(S3900)。
 図10は、マルチGC処理(S3600)のフローチャートである。
 クエリ実行部1313は、マルチGC処理を開始すると(S3610)、GC設定情報6000の間隔閾値803と開始閾値804とを参照する(S3620)。なお、S3620は、S3630にマージされてもよく、その場合、S3620が無しにS5000が行われてよい。
 次に、クエリ実行部1313は、GCリスト2600に登録されているタイムスタンプに対応するレコード群のGCが可能か否かの判断結果に基づきGCを実行するGCリスト回収処理(S5000:図11参照)を実行する。ここでは、TxIDリスト2500の参照タイムスタンプ603に該当しないタイムスタンプ(すなわち、終了したTxのタイムスタンプ)がGCリスト2600に残っている場合に、そのタイムスタンプに対応するバージョンのレコードが、GCリスト回収処理(S5000)において削除される。
 次に、クエリ実行部1313は、S3620で参照した間隔閾値803及び開始閾値804に基づいて、GCリスト2600に登録するタイムスタンプを選択し、選択したタイムスタンプをGCリスト2600に登録する(S3630)。具体的には、クエリ実行部1313は、現在時刻より開始閾値804前以上過去における時刻が開始時刻であるTxのタイムスタンプをGCリスト2600に登録することと、間隔閾値803以上離れている差を有する2つの参照タイムスタンプをGCリスト2600に登録することとの少なくとも一方を実行する。
 より具体的には、例えば、現在時刻が「12:10」であり、GC設定情報6000が図8に示す状態であり、TxIDリスト2500が図6に示す状態であり、RecordA~RecordCが、図5A~図5Cに示す状態である場合、現在時刻「12:10」から開始閾値「01:00」前は、時刻「11:10」である。時刻「11:10」以上過去に実行が開始されたTxは、開始時刻602が「10:23」であるTx「1」であり、Tx「1」の参照タイムスタンプは「102」である。開始閾値804を用いてGC対象のTxを選択することの処理負荷は、開始閾値を用いないでGC処理対象のTxを選択することの処理負荷に比べて低い。Txの数が少なくて済むからである。
 また、例えば、間隔閾値「30」以上離れている差を有する2つの参照タイムスタンプ(連続した2つの実行中Txの参照タイムスタンプ)は、「102」と「203」の組、及び、「203」と「234」の組である。従って、GCリスト2600に登録されるタイムスタンプは、「102」、「203」及び「234」であり、それらに対応したTxは、Tx「1」、「0」及び「4」である。間隔閾値803を用いてGCリスト2600に登録されるタイムスタンプを選択する理由は、現在時刻と現在時刻から開始閾値804前との間にたくさんの更新が発生すると、メモリに多くのレコードが残っているためである。
 以上の結果、S3630では、タイムスタンプ701として、「102」、「203」及び「234」が、GCリスト2600に登録される。
 S3630の後、クエリ実行部1313は、GCリスト2600へのレコード群の登録、及び、GCを実行する(S3650)。
 具体的には、クエリ実行部1313は、登録されたタイムスタンプ701に対応するレコード群702についてのリンクドリストを生成し、リンクドリストの先頭のレコードのアドレスをレコード群702としてGCリスト2600に登録する。ここで、クエリ実行部1313は、タイムスタンプの大きい順にリンクドリストを生成する(リンクドリストにおけるレコードの並びは、タイムスタンプの大きい順に限らず、他の基準に沿った順序でもよいし、不規則な順序でもよい)。なお、タイムスタンプ701に対応する参照可能なレコード群702(リンクドリストの先頭のレコード)は、タイムスタンプ701より小さなタイムスタンプ501を持つ最新のレコードである。レコードは更新(UPDATE)される度に、既存のレコードは古いレコードとなり、更新されたレコードが「最新のレコード」となる。例えば、図5AのRecordAで言うと、RecordA#264(タイムスタンプ「264」に対応したRecordA)が最新のRecordAであり、RecordA#80が、最古のRecordAである。このとき、タイムスタンプ「130」について参照可能なRecordAは、RecordA#124である。また、リンクドリストを生成するときに、或るレコードのGC504が既に記載済みであれば、クエリ実行部1313は、そのレコードを含んだレコード群に対応するタイムスタンプ701をGCリスト2600から削除し、且つ、リンクドリストの生成において更新したレコードの504を初期化する。クエリ実行部1313は、リンクドリストの生成において、リンクドリストの最後のレコードのGC504には、終端を意味する値(例えば「Null」)を設定する。このようにレコード群をリンク構造とすることにより、データベースの全てのレコードを順次参照してレコードを探すいわゆるデータベーススキャン処理に比べて、低負荷でGC可能なレコードを見つけることができる。
 レコード群702を登録した後、クエリ実行部1313は、GCを実行する。例えば、クエリ実行部1313は、タイムスタンプ「102」より大きくタイムスタンプ「203」より小さいタイムスタンプのレコードをGC(削除)する場合、以下の処理を実行する。すなわち、クエリ実行部1313は、まず、タイムスタンプ「102」と「203」のうち大きい方のタイムスタンプ「203」に対応するレコード群702が示すRecordA#155を特定する。クエリ実行部1313は、RecordA#155のPrev503Aを参照して、それの更新前RecordA#124を特定する。RecordA#124は、GCリスト2600のタイムスタンプ「203」の実行中Tx「0」で参照されるレコードでなく、また、タイムスタンプ「203」の1つ前のタイムスタンプ「102」の実行中Tx「1」で参照されるレコードでもないため、GC可能であると判断する。同様に、クエリ実行部1313は、RecordA#124のPrev503Aが示す更新前RecordA#80をGC可能であるか否かを判断する。RecordA#80は、タイムスタンプ「102」の実行中Tx「1」で参照可能なレコードであるため、クエリ実行部1313は、GC不可能であると判断する。次に、GC可能であると判断されたRecordA#124をGCするために、クエリ実行部1313は、RecordA#80のNext502Aを、RecordA#124のアドレスからRecordA#155のアドレスに変更し、RecordA#155のPrev503Aを、RecordA#124のアドレスからRecordA#80のアドレスに変更し、その後、RecordA#124をメモリから削除する。次に、クエリ実行部1313は、RecordA#155のGC504Aが示すRecordB#172(レコード群に登録されているタイムスタンプのうちタイムスタンプ「155」の次に大きいタイムスタンプ「172」を含むレコード)を特定する。クエリ実行部1313は、このような一連の処理と同様な処理を、参照したGC504が終端値(NULL)になるまで実行する。この処理により、タイムスタンプ「102」より大きくタイムスタンプ「203」より小さいタイムスタンプ(バージョン)に対応したレコードであって、実行中Txによって参照されないレコードを、メモリから削除することができる。
 同様に、GCリスト2600の他のタイムスタンプ間(例えば、タイムスタンプ「203」と「234」の間)のバージョンのレコードについても、実行中Txにより参照されないレコードをメモリから削除することができる。この処理では、レコード群のリンク(レコード群702が示すアドレス及びGC504が示すアドレス)を辿ることにより、データベーススキャン無しに、GC対象になり得るレコードを特定でき、また、レコードのPrev503を辿ることにより、データベーススキャン無しに、更新前レコードを特定できるので、処理の負荷を抑えることができる。
 また、クエリ実行部1313は、GCリスト2600の最も小さいタイムスタンプ「102」より小さいタイムスタンプに対応したレコードであって、実行中のTxに参照されていないレコードもメモリから削除する。なお、最小タイムスタンプ「102」より小さいタイムスタンプに対応したレコードは、最小タイムスタンプ「102」に対応したレコード群702から辿ることで特定される。これにより、最小タイムスタンプ「102」より小さいタイムスタンプ(古いバージョン)のレコードであって、参照されないレコードをメモリから削除できる。
 S3650の後に、クエリ実行部1313は、マルチGC処理を終了する(S3690)。
 図11は、GCリスト回収処理(S5000)のフローチャートである。
 GCリスト回収処理を開始すると(S5100)、クエリ実行部1313は、GCの実行を指定されたタイムスタンプ(以下、指定タイムスタンプ)があるか否かを判断する(S5200)。この結果、指定タイムスタンプがあれば(S5200:該当あり)、クエリ実行部1313は、処理をS5300に移行し、指定タイムスタンプがなければ(S5200:該当なし)、GCリスト回収処理を終了する(S5900)。
 S5300では、クエリ実行部1313は、指定タイムスタンプのGCを実行する。ここで、指定タイムスタンプがGCリスト2600のタイムスタンプ「203」である場合を例に取る。指定タイムスタンプ「203」に対応するレコード群702は、RecordA#155のアドレスを示す。クエリ実行部1313は、RecordA#155を削除するために、RecordA#155のNext502Aが示す更新後RecordA#231と、RecordA#155のPrev503Aが示す更新前RecordA#124とを関連付ける。つまり、クエリ実行部1313は、RecordA#231のPrev503AをRecordA#124のアドレスに変更するとともに、RecordA#124のNext502AをRecordA#231のアドレスに変更する。これにより、指定タイムスタンプに対応したレコードが削除されてもレコードバージョンの前後関係が維持される。次に、クエリ実行部1313は、RecordA#155のGC504Aが示すRecordB#172を特定し、そのRecord#172について、Record#155と同様の処理を行う。クエリ実行部1313は、このような処理を、GC504が終端値「NULL」になるまで実行する。この後、クエリ実行部1313は、RecordA#155を先頭とするレコード群のレコードをメモリから削除する。
 S5300を実行した後、クエリ実行部1313は、GCリスト回収処理を終了する(S5900)。なお、このGCリスト回収処理(S5000)は、上述した契機に代えて又は加えて別の契機に実行されてもよい。
 図12は、Tx処理のフローチャートである。
 クエリ実行部1313は、Tx処理を開始し、TxIDリスト2500に、そのTxに対応したTxID601、開始時刻602、参照タイムスタンプ603、更新タイムスタンプ604、及び、状態605を含んだカラムを追加する。参照タイムスタンプ603は、現在のタイムスタンプ(最新のタイムスタンプ)の値である。その後、クエリ実行部1313は、データベースのレコードの参照及び更新のうちの少なくとも1つを含むSQL処理を実行する(S4100)。この際、クエリ実行部1313は、SQL処理の内容に応じてTxIDリスト2500の状態605を更新する。このため、S4000において登録された状態605は、不定値でよい。なお、S4000において登録された状態605は、クエリソース(例えば計算機システム1110)から宣言された値でもよい。また、SQL処理とは、受け付けたクエリに基づき生成されたクエリ実行プランに従う処理である。
 次に、クエリ実行部1313は、Txの後処理(COMMIT処理)として、終了するTxに対応する更新タイムスタンプを取得し、ログ出力を行う(S4200)。次に、クエリ実行部1313は、Tx終了時のGCリスト回収処理を実行する(S5000)。このGCリスト回収処理では、クエリ実行部1313は、終了するTxのTxIDに対応する参照タイムスタンプ603と同じ値のタイムスタンプ701が、GCリスト2600にあれば、このタイムスタンプ701に対応したレコードのGCを実行する。GCリスト回収処理(S5000)の終了後、クエリ実行部1313は、Tx処理を終了する(S4900)。
 このTx処理においては、Txが参照していたバージョンのレコードがGC対象であれば、このレコードのGCをTxの終了時に(COMMIT)後に行うことができる。
 以上、実施形態を説明したが、本発明は、この実施形態に限定されるものでなく、その要旨を逸脱しない範囲で種々変更可能であることはいうまでもない。例えば、メモリ1202は、記憶部の一例でよい。記憶部は、メモリ1202に代えて又は加えて、補助記憶デバイス(典型的には不揮発性の記憶デバイス)を含んでもよい。
 1100:計算機システム 1200:ノード 1201:プロセッサ 1202:メモリ 1301:DBMS

Claims (13)

  1.  記憶部に格納されており複数のレコードを有するデータベースに対するクエリを受け付ける受付部と、
     前記クエリに従いトランザクションを実行することによりいずれかのレコードを更新する場合、タイムスタンプが関連付けられている更新前レコードを前記記憶部に維持し、レコードの更新に伴いタイムスタンプを更新し、更新後のタイムスタンプを関連付けた更新後レコードを前記記憶部に格納する実行部と
    を有し、
     前記実行部は、
      実行中の第1のトランザクションに対応付けられたタイムスタンプである第1のタイムスタンプと、実行中の第2のトランザクションに対応付けられたタイムスタンプである第2のタイムスタンプとの間のタイムスタンプに対応したレコードのうち、実行中の他のトランザクションから参照されないレコードを、複数のタイムスタンプの各々での複数のレコードを基に特定し、
      特定したレコードを前記記憶部から削除する、
    データベースシステム。
  2.  前記第1のトランザクションは、任意の1つの実行中のトランザクションであり、
     前記第2のトランザクションは、実行中のトランザクションのうちの、前記第1のタイムスタンプの次に値が大きいタイムスタンプに対応したトランザクションであり、
     前記第1及び第2のタイムスタンプは、それらの差分がタイムスタンプ間の差分の閾値である間隔閾値以上である、
    請求項1記載のデータベースシステム。
  3.  前記実行部が、現在時刻よりも所定時間前以上過去において開始された実行中トランザクションに対応したタイムスタンプのレコードを前記記憶部から削除し、
     前記実行部は、現在時刻と現在時刻よりも所定時間前との間に開始された実行中のトランザクションから、前記間隔閾値を用いて、前記第1及び第2のトランザクションに該当するトランザクションを特定する、
    請求項2記載のデータベースシステム。
  4.  前記実行部が、現在時刻よりも所定時間前以上過去において開始された実行中トランザクションに対応したタイムスタンプのレコードを前記記憶部から削除し、
     前記実行部は、現在時刻よりも所定時間前以上過去において開始された実行中トランザクションに対応したタイムスタンプと、前記第1及び第2のタイムスタンプとのうちの最も古いタイムスタンプよりも古いタイムスタンプのレコードを前記記憶部から削除する、
    請求項3記載のデータベースシステム。
  5.  前記間隔閾値は、ユーザから入出力デバイス経由で設定された値である、
    請求項2記載のデータベースシステム。
  6.  前記実行部は、タイムスタンプ毎に、そのタイムスタンプの時点でのレコード群を構成する2以上のレコードがシーケンシャルになるようレコード間を関連付ける、
     前記実行部は、対象のタイムスタンプの時点でのレコード群をレコード間の関連付けを辿ることで特定する、
    請求項1記載のデータベースシステム。
  7.  前記実行部は、前記第1及び第2のタイムスタンプの各々について、そのタイムスタンプと、そのタイムスタンプの時点でのレコード群の先頭のレコードのアドレスとを、削除対象のレコードに関する情報が登録される削除管理情報に登録し、
     前記実行部は、前記第1及び第2のタイムスタンプの各々について、前記削除管理情報を参照し、そのタイムスタンプに対応したアドレスからレコード間の関連付けを辿ることで、そのタイムスタンプの時点でのレコード群を特定する、
    請求項6記載のデータベースシステム。
  8.  前記実行部は、更新前レコードにその更新前レコードの更新後レコードのアドレスを関連付け、その更新後レコードにその更新後レコードの更新前レコードのアドレスを関連付け、
     前記実行部は、前記2のタイムスタンプに対応したレコードに関連付けられているアドレスに従いそのレコードの更新前レコードを特定し、特定した更新前レコードに対応するタイムスタンプを特定する、
    請求項6記載のデータベースシステム。
  9.  前記実行部は、
      削除対象のレコードの更新後レコードに関連付けられている更新前レコードアドレスを、前記削除対象のレコードの更新前レコードアドレスに変更し、
      前記削除対象のレコードの更新前レコードに関連付けられている更新後レコードアドレスを、前記削除対象のレコードの更新後レコードアドレスに変更する、
    請求項1記載のデータベースシステム。
  10.  前記実行部は、
      トランザクションをコミットした後に、そのトランザクションが参照可能なレコードが削除対象か否かを判断し、
      その判断結果が肯定の場合に、その削除対象のレコードを前記記憶部から削除する、
    請求項1記載のデータベースシステム。
  11.  前記実行部は、複数の方式のうちから選択されている方式に従ってレコード削除を実行し、
     前記複数の方式の1つが、前記第1及び第2のタイムスタンプ間のタイムスタンプに対応したレコードのうち実行中の他のトランザクションから参照されないレコードを削除する方式である、
    請求項1記載のデータベースシステム。
  12.  記憶部内のデータベースが有する複数のレコードのうちのいずれかのレコードを、トランザクションを実行することにより更新する場合、タイムスタンプが関連付けられている更新前レコードを記憶部に維持し、レコードの更新に伴いタイムスタンプを更新し、
     更新後のタイムスタンプを関連付けた更新後レコードを記憶部に格納し、
     実行中の第1のトランザクションに対応付けられたタイムスタンプである第1のタイムスタンプと、実行中の第2のトランザクションに対応付けられたタイムスタンプである第2のタイムスタンプとの間のタイムスタンプに対応したレコードのうち、実行中の他のトランザクションから参照されないレコードを、複数のタイムスタンプの各々での複数のレコードを基に特定し、
     特定したレコードを前記記憶部から削除する、
    データベース管理方法。
  13.  複数のレコードを記憶する記憶部と、
     トランザクションを実行することによりいずれかのレコードを更新する場合、タイムスタンプが関連付けられている更新前レコードを前記記憶部に維持し、レコードの更新に伴いタイムスタンプを更新し、更新後のタイムスタンプを関連付けた更新後レコードを前記記憶部に格納するプロセッサと
    を有し、
     前記プロセッサは、
      実行中の第1のトランザクションに対応付けられたタイムスタンプである第1のタイムスタンプと、実行中の第2のトランザクションに対応付けられたタイムスタンプである第2のタイムスタンプとの間のタイムスタンプに対応したレコードのうち、実行中の他のトランザクションから参照されないレコードを、複数のタイムスタンプの各々での複数のレコードを基に特定し、
      特定したレコードを前記記憶部から削除する、
    計算機システム。
PCT/JP2015/051414 2015-01-20 2015-01-20 データベースシステム、計算機システム、及び、データベース管理方法 WO2016117032A1 (ja)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/JP2015/051414 WO2016117032A1 (ja) 2015-01-20 2015-01-20 データベースシステム、計算機システム、及び、データベース管理方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2015/051414 WO2016117032A1 (ja) 2015-01-20 2015-01-20 データベースシステム、計算機システム、及び、データベース管理方法

Publications (1)

Publication Number Publication Date
WO2016117032A1 true WO2016117032A1 (ja) 2016-07-28

Family

ID=56416598

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2015/051414 WO2016117032A1 (ja) 2015-01-20 2015-01-20 データベースシステム、計算機システム、及び、データベース管理方法

Country Status (1)

Country Link
WO (1) WO2016117032A1 (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020531949A (ja) * 2017-08-11 2020-11-05 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation ブロックチェーン内のデータベース・ハッシュコードの遅延更新

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007501468A (ja) * 2003-08-06 2007-01-25 オラクル・インターナショナル・コーポレイション 効率的なバージョン制御を有するデータベース管理システム
US20110153566A1 (en) * 2009-12-18 2011-06-23 Microsoft Corporation Optimistic serializable snapshot isolation
US20110252000A1 (en) * 2010-04-08 2011-10-13 Microsoft Corporation In-memory database system
JP2013522778A (ja) * 2010-03-18 2013-06-13 ヌオディービー インコーポレイテッド データベース管理システム
EP2738697A1 (en) * 2012-11-29 2014-06-04 Sap Ag Version garbage collection using snapshot lists

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007501468A (ja) * 2003-08-06 2007-01-25 オラクル・インターナショナル・コーポレイション 効率的なバージョン制御を有するデータベース管理システム
US20110153566A1 (en) * 2009-12-18 2011-06-23 Microsoft Corporation Optimistic serializable snapshot isolation
JP2013522778A (ja) * 2010-03-18 2013-06-13 ヌオディービー インコーポレイテッド データベース管理システム
US20110252000A1 (en) * 2010-04-08 2011-10-13 Microsoft Corporation In-memory database system
EP2738697A1 (en) * 2012-11-29 2014-06-04 Sap Ag Version garbage collection using snapshot lists

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020531949A (ja) * 2017-08-11 2020-11-05 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation ブロックチェーン内のデータベース・ハッシュコードの遅延更新
JP7044447B2 (ja) 2017-08-11 2022-03-30 インターナショナル・ビジネス・マシーンズ・コーポレーション ブロックチェーン内のデータベース・ハッシュコードの遅延更新

Similar Documents

Publication Publication Date Title
US9953051B2 (en) Multi-version concurrency control method in database and database system
CN106462592B (zh) 优化对索引的多版本支持的系统和方法
CN105630863B (zh) 用于多版本并发提交状态的事务控制块
US11556501B2 (en) Determining differences between two versions of a file directory tree structure
US20170185326A1 (en) Consistent transition from asynchronous to synchronous replication in hash-based storage systems
US9892183B2 (en) Computer system, computer system management method, and program
CN106874281B (zh) 实现数据库读写分离的方法和装置
CN111046034A (zh) 管理内存数据及在内存中维护数据的方法和系统
US8832022B2 (en) Transaction processing device, transaction processing method and transaction processing program
US10007548B2 (en) Transaction system
CN111241108B (zh) 基于键值对kv系统的索引方法、装置、电子设备和介质
JP6242930B2 (ja) センサデータ管理装置、センサデータ管理方法およびプログラム
US8595190B2 (en) Methods and apparatus related to completion of large objects within a DB2 database environment
CN114116613A (zh) 基于分布式文件系统的元数据查询方法、设备和存储介质
WO2010084754A1 (ja) データベースシステム、データベース管理方法、データベース構造および記憶媒体
CN110704194A (zh) 管理内存数据及在内存中维护数据的方法和系统
JP6293709B2 (ja) ストレージシステムおよびストレージシステム用プログラム
US10095737B2 (en) Information storage system
CN108334333B (zh) 一种源代码库更新方法及装置
JP6127608B2 (ja) 情報処理装置、データベースアクセス方法、及びプログラム
WO2016117032A1 (ja) データベースシステム、計算機システム、及び、データベース管理方法
WO2012081165A1 (ja) データベース管理装置及びデータベース管理方法
CN113961592A (zh) 基于主从数据库的数据查询方法、装置、设备及存储介质
JP6688433B2 (ja) 計算機システム
JP2018032072A (ja) プログラム、情報処理装置、ストレージシステム、およびストレージシステムの制御方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15878727

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15878727

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: JP