WO2015111152A1 - データベース管理システム及び方法 - Google Patents

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

Info

Publication number
WO2015111152A1
WO2015111152A1 PCT/JP2014/051263 JP2014051263W WO2015111152A1 WO 2015111152 A1 WO2015111152 A1 WO 2015111152A1 JP 2014051263 W JP2014051263 W JP 2014051263W WO 2015111152 A1 WO2015111152 A1 WO 2015111152A1
Authority
WO
WIPO (PCT)
Prior art keywords
log
database
transaction
order
checkpoint
Prior art date
Application number
PCT/JP2014/051263
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 JP2015558634A priority Critical patent/JP6152431B2/ja
Priority to DE112014002275.6T priority patent/DE112014002275T5/de
Priority to GB1521129.5A priority patent/GB2537446A/en
Priority to US14/894,042 priority patent/US10366075B2/en
Priority to PCT/JP2014/051263 priority patent/WO2015111152A1/ja
Publication of WO2015111152A1 publication Critical patent/WO2015111152A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2358Change logging, detection, and notification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution

Definitions

  • the present invention generally relates to database management, for example, to output of transaction processing logs.
  • DBMS database management system
  • main data such as tables and indexes
  • HDD Hard Disk Drive
  • a disk database and an in-memory database in which the database is arranged in a main memory are known (a hybrid DBMS combining an on-disk database and an in-memory database is also known).
  • Logs are generally output to a single log file when a transaction is executed. Even if transactions are processed in parallel by a plurality of cores (or a plurality of CPUs (Central Processing Units)), a log output destination is a single log file. For this reason, log output becomes a bottleneck.
  • cores or a plurality of CPUs (Central Processing Units)
  • CPUs Central Processing Units
  • Patent Document 1 a log file is prepared for each distributed database, and a log including a database update history is output to a log file corresponding to the database among a plurality of log files.
  • the in-memory database can divide the database into multiple partitions and manage each partition.
  • a log file is prepared for each partition managed by the in-memory database, and a log including a partition update history is output to a log file corresponding to the partition. be able to.
  • Patent Document 1 when the technique of Patent Document 1 is simply applied to the in-memory database, I / O requests several times the number of transactions are generated to the storage apparatus. This is because partitions are defined in advance, and it is inevitable that data of multiple partitions may be referred to and updated in transaction processing. In this case, even if one transaction is processed, This is because a log must be output to each of a plurality of log files corresponding to a plurality of partitions.
  • Such a problem is not limited to the in-memory database, and may be applied to another DBMS that manages a divided database or another DBMS that manages a single database.
  • the DBMS generates a transaction log for each transaction in the execution of a plurality of transactions, and stores the generated log in the log storage area.
  • the DBMS records the order of logs in at least a log generated for transactions belonging to a set of transactions that have different results depending on the transaction execution order.
  • the transaction execution order can be specified for a set of transactions with different results depending on the transaction execution order . For this reason, even if the number of logs generated for one transaction in which two or more database parts of a plurality of database parts into which the database is divided is updated is smaller than the number of updated database parts, Based on the stored log, it is possible to specify the execution order (for example, a partial order) of transactions.
  • FIG. 1 shows a configuration of a computer system according to an embodiment.
  • An example of a transaction set is shown. It is a functional block diagram of the computer system which concerns on an Example. The structure of a LLSN management part is shown. Indicates the data structure of the log. Shows the data structure of the checkpoint log.
  • An example of a transaction set is shown. The table before and after execution of the transaction set is shown. An example of the log output which concerns on an Example is shown. An example of the log output which concerns on the comparative example 1 is shown. An example of the log output which concerns on the comparative example 2 is shown.
  • the same reference numbers for the same type of elements include the same parent number.
  • the reference numerals of the elements are used (for example, partitions 111A, 111B, etc.
  • the parent of the reference signs of the elements Only numbers may be used (eg, partition 111).
  • the process may be described using “program” as a subject, but the program is executed by the processor so that the determined process can be appropriately performed with storage resources (for example, memory) and / or Since the processing is performed using a communication interface device or the like, the subject of processing may be a processor.
  • the processing described with the program as the subject may be processing performed by a processor or an apparatus (for example, a database server) having the processor.
  • the processor may include a hardware circuit that performs part or all of the processing.
  • the program may be installed on each controller from a program source.
  • the program source may be, for example, a program distribution computer or a storage medium.
  • FIG. 1 shows a configuration of a computer system according to the embodiment.
  • An external storage device 402 is connected to the database server 401 via, for example, a communication network 403.
  • the database server 401 is a computer, and may be, for example, a personal computer, a workstation, or a mainframe, or may be a virtual computer configured by a virtualization program in these computers.
  • the database server 401 includes an I / O adapter 413, a main memory 416, a storage device 415, and a processor 414 connected thereto.
  • the processor 414 may be, for example, a microprocessor or a module including a microprocessor and dedicated hardware circuitry.
  • the processor 414 executes a computer program.
  • the computer program executed by the processor 414 is, for example, an operating system (OS) 117 and a database management system (DBMS) 412.
  • OS operating system
  • DBMS database management system
  • the main memory 416 is, for example, a volatile DRAM (Dynamic Random Access Memory), and temporarily stores a program executed by the processor 414 and data used by the program.
  • the storage device 415 is non-volatile, and is, for example, an HDD (Hard Disk Drive) or an SSD (Solid State Drive).
  • the storage device 415 may store a program and data used by the program.
  • the I / O adapter 413 connects the communication network 403 and the database server 401.
  • the external storage device 402 is a device having a storage device group 451 including a plurality of storage devices, and is, for example, a disk array device, but may instead be a single storage device.
  • the external storage device 402 stores the log file 301.
  • the external storage apparatus 402 receives a log I / O request from the database server 401, reads and writes data (for example, a log) in accordance with the I / O request, and returns the result to the database server 401.
  • the storage device included in the storage device group 451 is a device having a nonvolatile storage medium, and is, for example, an HDD or an SSD.
  • the storage device group 451 may be a RAID (Redundant Array of Independent Disks) group, and may store data at a predetermined RAID level.
  • a logical storage device (for example, logical unit, logical volume, file system volume) based on the storage space of the storage device group 451 is provided to the database server 401, and the log file 301 is stored on the logical storage device. May be.
  • the log file 301 is an example of a log storage area.
  • the external storage apparatus 402 includes an I / O adapter 441 and a storage controller 442 connected thereto in addition to the storage device group 451.
  • the I / O adapter 441 connects the external storage apparatus 402 to the communication network 403, and is connected to the database server 401 via this.
  • a communication protocol via the communication network 403 for example, Fiber Channel (FC), SCSI (Small Computer System Interface), or TCP / IP (Transmission Control Protocol / Internet Protocol) may be employed.
  • the I / O adapter 441 (and 413) may be called a host bus adapter.
  • the storage controller 442 includes, for example, a memory and a processor, and reads / writes data from / to the storage device group 451 storing the log file 301 in response to an I / O request from the database server 401.
  • FIG. 2 shows an example of a transaction set.
  • This figure shows an example of a transaction executed between two checkpoints 1 and 2.
  • Each transaction executed in this embodiment is classified into either a first type transaction set or a second type transaction set.
  • the first type transaction set is a set of transactions whose results change depending on the transaction execution order.
  • a partial order is defined. According to the partial order, for example, a plurality of transactions that update the same record must be executed in a defined order, but a plurality of transactions that update different records may be executed in any order.
  • the second type transaction set is a transaction set in which the execution order of transactions does not affect the result.
  • Whether the transaction to be executed belongs to the first type or second type transaction set can be determined from one or a plurality of query execution plans, for example.
  • FIG. 3 is a functional block diagram of the computer system according to the embodiment.
  • the DBMS 412 is an in-memory database.
  • the DBMS 412 divides the database into a plurality of partitions 111 (for example, three partitions 111A to 111C) and arranges them on the main memory 416.
  • Each partition 111 includes a portion of a database, eg, a table 112 that is a portion of a table in the database, and an index 113 that is a portion of an index in the database.
  • data can be specified from the table 112 (for example, 112A) in the partition 111 using the index 113 (for example, 113A) in the partition 111.
  • Data included in one table 112 may be specified only from the index 113 in the partition 111 including the table 112.
  • Each partition 111 may include a lock mechanism 116. This is to prevent two or more threads 110 from competing for the same partition 111.
  • the lock mechanism 116 may be information indicating whether or not the partition 111 has been acquired. For example, the lock mechanism 116 may have a value “1” if the lock has been acquired, and may have a value “0” if the lock has not been acquired.
  • the lock mechanism 116 may be associated with the partition 111 and may be outside the partition 111.
  • the DBMS 412 has a log buffer 114 and an LLSN management unit 115 for each partition 111.
  • the log buffer 114 temporarily stores a log including the update history of the partition 111.
  • the LLSN management unit 115 manages the LLSN.
  • “LLSN” is an abbreviation for local log sequence number.
  • the LLSN is a number that does not overlap in one partition 111.
  • the LLSN is numbered when outputting a log of transactions belonging to the first type transaction set (transaction set whose result changes depending on the transaction execution order).
  • the LLSN may be numbered when outputting a log of transactions belonging to the second type transaction set as well as the first type transaction set.
  • the DBMS 412 receives a query from a query issuer, and executes one or more transactions in executing the received query.
  • the DBMS 412 includes a query reception unit 421, a query execution plan generation unit 422, and a query execution unit 424.
  • the query receiving unit 421 receives a query issued by a query issuer.
  • the query is described by, for example, a structured query language (SQL, Structured Query Language).
  • SQL Structured Query Language
  • a plurality of transactions may be described by one query, and a plurality of transactions may be described by a plurality of queries.
  • the query issuer may be a computer program inside the DBMS 412 or a computer program outside the DBMS 412.
  • the external computer program may be a computer program (for example, an application program) executed in the database server 401 or a computer program (for example, a client computer connected to the database server 401) (for example, Application program).
  • the query execution plan generation unit 422 generates a query execution plan including one or more database operations necessary for executing the query from the query received by the query reception unit 421.
  • the query execution plan is, for example, information including a relationship between one or more database operations and the execution order of the database operations, and is stored as query execution plan information 423.
  • a query execution plan may be represented by a tree structure in which a database operation is a node and a relation of execution order of database operations is an edge. From one query execution plan or a combination of a plurality of query execution plans, it is possible to specify one or a plurality of transaction sets and whether each transaction set is a first type or a second type transaction set. .
  • the query execution unit 424 executes the query received by the query reception unit 421 according to the query execution plan generated by the query execution plan generation unit 422, and returns the execution result to the query issuer. At this time, the query execution unit 424 issues a data read request (reference request) necessary for execution of the database operation, and uses the data read from the partition 111 in accordance with the read request to execute the database operation (for example, Then, new data is calculated using the read data (value), and a write request is issued to update the data in the read source record to the calculated data).
  • the query execution unit 424 performs database operation by executing the thread 110. In the DBMS 412, a plurality of threads 110 are executed in parallel. For this reason, the processor 414 has a plurality of cores.
  • the thread 110 may be called a task.
  • a user thread realized by a library or the like may be used in addition to a process and kernel thread realized by the OS 117.
  • One thread 110 may execute one transaction corresponding to one or more database operations.
  • the subject of processing performed when the query execution unit 424 executes the thread 110 may be referred to as the thread 110.
  • the query execution unit 424 (thread 110) issues an I / O request to the external storage apparatus 402 to the OS 117 in order to write a log to the log file 301 in the external storage apparatus 402 during execution of the transaction.
  • the OS 117 accepts the I / O request and issues an I / O request to the external storage apparatus 402.
  • a plurality of I / O queues 201 are prepared.
  • the thread 110 issues an I / O request for writing a log.
  • the I / O queue 201 stores the I / O request.
  • the I / O request is stored in the I / O queue 201 by the OS 117.
  • External storage device 402 stores a plurality of log files 301 (301A to 301C).
  • a log to which an I / O request is written is recorded.
  • the partition 111, the I / O queue 201, and the log file 301 have a 1: 1: 1 correspondence. That is, there is one I / O queue 201 and one log file 301 for each partition 111.
  • the partition 111A is associated with the I / O queue 201A and the log file 301A
  • the partition 111B is associated with the I / O queue 201B and the log file 301B
  • the partition 111C is associated with the I / O queue 201C and A log file 301C is associated.
  • the thread 110 may also correspond to the log file 301 in a 1: 1 manner for easy understanding.
  • the thread 110A issues a log I / O request indicating that a record in the table 112A in the partition 111A has been updated to the log file 301A corresponding to the partition 111A.
  • the issued I / O request is sent to the OS 117 via the log buffer 114A.
  • the OS 117 receives an I / O request for the log file 301A, and stores the I / O request in the I / O queue 201A corresponding to the log file 301A.
  • the I / O request stored in the I / O queue 201A is sent from the I / O queue 201 to the external storage apparatus 402 by the OS 117.
  • the log that is the write target data of the I / O request is written to the log file 301A.
  • the configuration of the DBMS 412 shown in FIG. 3 is merely an example.
  • a certain component may be divided into a plurality of components, and a plurality of components may be integrated into one component.
  • FIG. 4 shows the configuration of the LLSN management unit 115.
  • the LLSN management unit 115 includes a lock mechanism 121, an LLSN 122, and a log file address 123.
  • the lock mechanism 121 may be data indicating whether or not the lock of the LLSN management unit 115 has been acquired. For example, the lock mechanism 121 may have a value “1” if the lock has been acquired, and may have a value “0” if the lock has not been acquired.
  • LLSN 122 is a log sequence number (LLSN) for the partition 111 including the LLSN management unit 115.
  • the LLSN is a combination of the ID of the LLSN management unit 115 and a serial number.
  • the value represented by the LLSN 122 is updated as 1-001, 1-002, 1-003.
  • the LLSN is a combination of the ID “1” of the LLSN management unit 115A and the updated serial number.
  • the log file address 123 is a log write destination address in the log file 301 corresponding to the partition 111 including the LLSN management unit 115.
  • the address (value) represented by the log file address 123 is added by the size of the log to be output each time a log is written to the log file 301.
  • Fig. 5 shows the data structure of the log.
  • the log may be one per transaction, and includes a transaction ID, one or more LLSNs numbered during the execution of the transaction, and information indicating the update history of the transaction.
  • the number of LLSNs included in the log is the same as the number of partitions 111 updated in the execution of the transaction.
  • Fig. 6 shows the data structure of the checkpoint log.
  • the checkpoint log is a log indicating that a checkpoint has been generated.
  • the checkpoint log includes the ID of the transaction that generates the checkpoint, all the LLSNs that are numbered in the generation of the checkpoint, and the ID of the generated checkpoint.
  • the checkpoint ID can be used to specify the time point for recovery. Note that the checkpoint ID may be a value representing the time when the checkpoint is generated.
  • FIG. 7 shows an example of a transaction set.
  • FIG. 8 shows the tables 112A and 112B before and after the execution of the transaction set.
  • the transaction is abbreviated as “Tr.”.
  • a record has a row ID and Val (value).
  • a record with a row ID: X is called a record X
  • a record with a row ID: Y is called a record Y.
  • the transaction set shown in FIG. 7 is a first type of transaction set, that is, a set of transactions whose results change depending on the transaction execution order. Records X and Y are updated by the transaction set.
  • record X is a record in table 112A in partition 111A
  • record Y is a record in table 112B in another partition 111B.
  • Val (value) in the record X is “100”
  • Val (value) in the record Y is also “100”.
  • Val (value) in the record X is updated to “110”
  • Val (value) in the record Y is updated to “122”.
  • the results of transactions A, B, and E vary depending on the execution order. This is because they are transactions for updating the same record X.
  • the results of transactions A, C, and D change depending on the execution order. This is because they are transactions for updating the same record Y.
  • the following method can be considered as a method for recording the minimum necessary order relation.
  • a transaction executed between an arbitrary checkpoint 1 and a checkpoint 2 generated after checkpoint 1 and belonging to the first type of transaction set execution of transaction
  • the order according to the committed order log generation order
  • the order is not recorded in the log of transactions belonging to the second type of transaction set (transactions that only need to be executed between checkpoint 1 and checkpoint 2 without depending on the execution order between transactions). .
  • a semi-order can be defined for the log of the first type of transaction set.
  • an LLSN is assigned to each updated partition 111 in the execution of one transaction.
  • the LLSN numbered for one partition 111 is a sequence number for that partition 111 and is not related to the LLSN for the other partition 111.
  • a series of LLSNs are numbered for each partition 111, and the numbered LLSNs are recorded in a log, thereby defining a partial order for the first type of transaction set.
  • the log is output as follows. That is, as described above, the partition 111 and the log file 301 are prepared in a 1: 1 ratio, and the log including the update history of the partition 111 is written in the log file 301 corresponding to the partition 111.
  • N partitions 111 (N is an integer of 2 or more) may be updated in the execution of one transaction.
  • N log files respectively corresponding to the N partitions 111 are stored.
  • N the number of partitions 111 updated in the execution of one transaction
  • one of the updated partitions 111 corresponds to one partition 111.
  • a log is written in one log file 301.
  • N LLSNs respectively corresponding to the updated N partitions are written in the log.
  • FIG. 9 shows an example of log output according to the embodiment.
  • the LLSN of the partition 111A is 1-201 and the LLSN of the partition 111B is 2-100 before execution of the transaction set shown in FIG.
  • this is only an example and does not exclude other values.
  • both the record X of the partition 111A and the record Y of the partition 111B are updated.
  • the LLSN of each of the LLSN management units 115A and 115B is incremented by 1.
  • the LLSN of the LLSN management unit 115A may be 1-202
  • the LLSN of the LLSN management unit 115B may be 2-101.
  • the log output destination is one of the log files 301A and 301B respectively corresponding to the partitions 111A and 111B (for example, even if the output destination is sequentially switched by round robin) Either or may be predetermined).
  • the log is output to the log file A.
  • the log file address is acquired from the LLSN management unit 115A, and a value corresponding to the size of the log to be output is added to the log file address in the LLSN management unit 115A.
  • the thread 110A stores the log 901A in the log buffer 114A, and issues a write request specifying the acquired log file address with the log 901A as a write target.
  • the OS 117 receives the write request, writes the write request to the I / O queue 201A corresponding to the log file 301A, and transmits the write request from the I / O queue 201A to the external storage apparatus 402.
  • the external storage apparatus 402 receives the write request, writes the log 901A to be written in accordance with the write request to the log file 301A, and returns a write request completion response.
  • the completion response returns to the DBMS 412 through the OS 117.
  • To the log file 301B (acquired log file address) corresponding to the partition 111B.
  • LLSN 1-103 and 2-103 are assigned from the LLSN management units 115A and 115B, respectively, and a log 901E including the assigned LLSN is stored in the log file. 301B is written.
  • the order of transaction A-> B-> E and transaction A-> C-> D-> E can be recovered by referring to the LLSN in each log.
  • the fact that the first LLSN is larger than the second LLSN means that the first LLSN is numbered (in the future) after the second LLSN.
  • the first LLSN being greater than the second LLSN may mean that the first LLSN has been numbered (in the past) before the second LLSN. That is, it is only necessary that the order relationship can be specified from the LLSN size relationship.
  • an order relationship between transactions (which is expressed as “ ⁇ ” for convenience) is defined by the LLSN magnitude relationship of any one LLSN management unit 115
  • a partial order is set in the set of all transactions with some exceptions. Determined.
  • the LLSN of the LLSN management unit 115A is arranged in the order of transactions A-> B (A ⁇ B)
  • the LLSN of the LLSN management unit 115B is arranged in the order of transactions B-> A (B ⁇ A).
  • the order is not defined between transactions A and B.
  • the execution order of transactions A and B may be either.
  • FIG. 10 shows an example of log output according to Comparative Example 1.
  • Comparative Example 1 is an example in which five logs corresponding to five transactions A to E are output to a single log file.
  • logs are output to a log file in the order of transaction execution. In this case, even if two or more transactions are executed in parallel, log output is executed sequentially, and competition between I / O resources (for example, a single I / O queue corresponding to a single log file) between transactions. Will occur.
  • a plurality of log files are prepared, and a plurality of I / O resources (for example, I / O queues) respectively corresponding to the plurality of log files are prepared.
  • I / O resources for example, I / O queues
  • FIG. 11 shows an example of log output according to Comparative Example 2.
  • Comparative Example 2 is an example of log output performed in a distributed database. For transactions that update only one of the partitions 111A and 111B, such as transactions B, C, and D, log output is the same as in the embodiment. However, for transactions that update both partitions 111A and 111B, such as transaction A (and E), the same number of logs as the updated partitions are output to the same number of log files. For this reason, the number of log I / Os is larger than in the embodiment.
  • the number of logs written even if a transaction updates a plurality of partitions is smaller than the number of updated partitions. Therefore, the number of log I / Os can be suppressed.
  • the order may not be defined depending on the transaction. For example, it is indefinite on the log which transaction B and transaction C completed the transaction execution first. Therefore, in general, the database cannot be recovered to any state other than the latest state. Thus, in this embodiment, as described above, it is possible to record and recover the state of the database at a certain point in time by generating checkpoints.
  • FIG. 12 is a flowchart of transaction processing.
  • the thread executing the transaction A is the thread 110A
  • the partitions updated by the transaction A are the partitions 111A and 111B
  • the log files corresponding to the partitions 111A and 111B are the log files 301A and 301B, respectively.
  • the thread 110A When the transaction A is started, the thread 110A generates a reference / update set for each of the partitions 111A and 111B based on an instruction corresponding to the transaction A (instruction in the query) (S301).
  • the reference / update set is a set of record reference (read request for partition) and record update (write request for partition).
  • the reference / update set is a request set for updating the partition, but at the time of S301, the partitions 111A and 111B are not changed, and the local memory area corresponding to the transaction A (reserved on the main memory 461) A reference / update set is held in a region (not shown).
  • the thread 110A makes a commit determination (S302).
  • the commit determination is performed, for example, according to the isolation level of the database as to whether or not the change to the partitions 111A and 111B performed by the transaction A based on the reference / update set is consistent with other transactions.
  • the thread 110A executes a log output process (S304).
  • the thread 110A updates the partitions 111A and 111B based on the reference / update set (S305), issues a commit completion notification (S306), and ends the transaction.
  • FIG. 13 is a flowchart of the log output process (S304 in FIG. 12).
  • LLSN management unit 115 of log file 301A associated with thread 110A executing transaction A is LLSN management unit 115A.
  • the thread 110A acquires the log file address from the LLSN management unit 115A, and adds the log size of the transaction A to the log file address of the LLSN management unit 115A (S401). Note that before this series of operations, the thread 110A acquires the lock of the LLSN management unit 115A and releases the lock after the operation.
  • the thread 110A selects an arbitrary LLSN management unit 115 and performs the same processing on the selected LLSN management unit 115. However, in order to avoid a deadlock in the recovery process described later, a log needs to be written in the log file 301 corresponding to the LLSN management unit 115 operated in S401.
  • the thread 110A numbers the LLSN of the partition 111A or 111B updated by the execution of the transaction A (S402). Depending on the isolation level and data structure of the database, it may be necessary to assign the LLSN of the partition referenced by the execution of transaction A.
  • the thread 110A performs S402 on the unnumbered partition.
  • the thread 110A generates a log 901A (see FIG. 9) and writes the log 901A to the log buffer 114A.
  • a write request for the log 901A (write request specifying the log file address acquired from the LLSN management unit 115A) is issued (S404).
  • the thread 110A receives a write completion notification from the external storage apparatus 402 via the I / O adapter 413, the thread 110A sets the write completion (S405), and ends the log output flow.
  • FIG. 14 is a flowchart of the checkpoint generation process. In the description of FIG. 14, it is assumed that the thread that generates the checkpoint is the thread 110A.
  • Thread 110A first prohibits starting a new commit (S501). Specifically, the thread 110A previously sets a flag bit indicating prohibition of new commit in the thread sharing area, and sets the initial value to 0. The thread 110A changes the flag bit to 1 when prohibiting the start of a new commit. The thread that executes the transaction checks the flag bit at the start of execution of the commit process, and executes the commit process only when the flag bit is 0. When the flag bit is 1, the flag bit is changed to 0. Wait until. After the new commit start prohibition process of the thread 110A, any thread 110 cannot start commit, and the commit proceeds only for the transaction being committed.
  • the thread 110A waits until the number of transactions being committed reaches 0 (S502: No). When the number of transactions being committed becomes 0 (S502: Yes), the thread 110A assigns an LLSN and logs from the LLSN management unit 115 (eg, 115A) corresponding to the arbitrarily selected log file 301 (eg, 301A). A file address is acquired, and a value corresponding to the size of the checkpoint log is added to the log file address in the LLSN management unit 115 (for example, 115A) (S503).
  • the LLSN management unit 115 for example, 115A
  • the thread 110A numbers all the LLSNs corresponding to the remaining log files (S504).
  • the thread 110A completes a checkpoint log including the LLSN numbered in S503, the LLSN numbered in S504, and the checkpoint ID.
  • the thread 110 ⁇ / b> A sends a log write request specifying the log file address acquired in S ⁇ b> 503 (the write target is the completed checkpoint log) to the log buffer 114 (for example, 301 ⁇ / b> A) corresponding to the arbitrarily selected log file 301 (for example, 301 ⁇ / b> A).
  • 114A a log write request is issued from the log buffer 114 (for example, 114A) (S505).
  • the thread 110A determines whether or not a condition for backing up the database is satisfied (S506).
  • the condition may be that the number of checkpoint generations has reached N (N is a natural number), or that a fixed time has elapsed since the last backup time.
  • the thread 110A can include the database backup, that is, the database (the table 112 and the index 113 of each partition 111) on the main memory 416 in the checkpoint log.
  • the database (image) associated with the checkpoint ID and associated with the checkpoint ID is stored in the external storage device 402 (S507). This action is not necessary at every checkpoint. However, by backing up the database when writing the checkpoint log, the database at the time of checkpoint generation (or the database near the time of the checkpoint) can be recovered at high speed.
  • checkpoint management information including the correspondence between the backed up database (image), the checkpoint ID, and the write destination address of the checkpoint log including the checkpoint ID is determined by the thread.
  • the data may be stored in a storage area inside or outside the database server 401 (for example, the main memory 416).
  • the thread 110A cancels the prohibition of starting a new commit (S508), and the checkpoint generation process ends. Specifically, the thread 110A changes the flag bit indicating prohibition of new commit from 1 to 0.
  • FIG. 15 is a flowchart of database recovery processing (parent). In the description of FIG. 15 (and FIG. 16), it is assumed that the thread for recovering the database is the thread 110A.
  • the thread 110A is a database (backup image) associated with the checkpoint ID of the specified checkpoint, or a check generated in the past from the checkpoint ID of the specified checkpoint.
  • a database (backup image) associated with the point ID is loaded from the external storage apparatus 402 onto the main memory 416 (S601).
  • the checkpoint ID may be specified by a query received from the query issuer, or may be specified by a computer (not shown) connected to the database server 401 (for example, a management computer).
  • the thread 110A acquires a checkpoint log including a checkpoint ID associated with the database from the log address (log file), and acquires each LLSN in the log.
  • the LLSN of the LLSN management unit 115 in the partition 111 corresponding to the LLSN is set (S602). For example, the LLSN with the leading number 1 is set as the LLSN of the LLSN management unit 115A, and the LLSN with the leading number 2 is set as the LLSN of the LLSN management unit 115B.
  • the thread 110A performs a recovery process (child) on the thread 110 corresponding to each partition 111. This is executed (S604). For the partition 111A, the thread 110A also executes a recovery process (child). The thread 110A waits for the end of all recovery processing (child) (S605: Yes), and ends the recovery processing (parent).
  • the thread 110A performs the recovery process (parent) without performing S604 and 605. Exit. This is because the database loaded in S601 is a database to be recovered.
  • FIG. 16 is a flowchart of database recovery processing (child).
  • the recovery process (child) is executed for each partition 111.
  • the recovery process (child) will be described by taking one partition 111B as an example.
  • the thread 110B acquires the LLSN (LLSN in the LLSN management unit 115B) set in the recovery process (parent) as the LLSN at the time of backup (S700).
  • LLSN LLSN in the LLSN management unit 115B
  • the log including the LLSN is referred to as “post-backup log”.
  • the post-backup log including the largest LLSN among the post-backup logs may be the end log of the log file 301B.
  • post-backup logs there may be a post-backup log including LLSN other than the LLSN of the partition 111B in addition to the LLSN of the partition 111B.
  • the LLSN of the partition 111B is referred to as “corresponding LLSN”
  • the LLSN other than the LLSN of the partition 111B is referred to as “non-corresponding LLSN”.
  • the thread 110B identifies the post-backup log including the smallest relevant LLSN among the unprocessed post-backup logs in the log file 301B corresponding to the partition 111B (S701).
  • target log the post-backup log specified in S701 is referred to as “target log”.
  • the thread 110B indicates that the corresponding LLSN in the target log is the next corresponding LLSN of the corresponding LLSN in the post-backup log processed in the previous S705 or S706 (for example, the post-backup log processed in the previous S705 or S706). It is determined whether or not the corresponding LLSN is a corresponding LLSN obtained by adding 1 (S702).
  • the thread 110B determines whether or not a non-corresponding LLSN is included in the target log.
  • the thread 110B executes the update for the partition 111B to the partition 111B in the update history in the target log, and does not copy the target log. Transfer to the thread corresponding to the partition corresponding to the corresponding LLSN (thread executing the recovery process (child) of the partition corresponding to the non-corresponding LLSN) (S705). For example, when the leading number of the non-applicable LLSN is 1, a copy of the target log is transferred to the thread 110A. When the number of non-corresponding LLSNs is two or more, the copy of the target log is transferred to a thread corresponding to two or more partitions corresponding to two or more non-corresponding LLSNs.
  • the thread 110B determines whether an unprocessed post-backup log still remains after S705 or S706 (S707). If there is an unprocessed log after backup (S707: Yes), S701 is performed again, and if there is no unprocessed log after backup (S707: Yes), the recovery process (child) for the partition 111B is completed.
  • a DBMS other than the in-memory database may be adopted as the DBMS.
  • the plurality of database parts constituting the database may be distributed to a plurality of different database servers, or at least one of the plurality of database parts may be stored in the external storage device.
  • log file 301 (and database part) may be stored in the storage device 415 in the database server 401 instead of the external storage apparatus 402.
  • the order (log generation order like LLSN) may be recorded for the logs of transactions belonging to the second type transaction set.
  • the log may be generated but the LLSN may not be numbered. As a result, a reduction in the load on the processor 414 can be expected.
  • log storage area is an area in the external storage device 402, the main memory 416, or the storage device 415, and a log file generated for each log may be written in the area. That is, in the above-described embodiment, a plurality of logs are written in one log file. However, in one modified example, one log file may be written in the log storage area for each log.
  • the LLSN may be a combination of the ID of the corresponding LLSN management unit 115 and a time stamp.
  • checkpoint logs may be generated for the same checkpoint, and all LLSNs corresponding to all LLSN management units 115 may be recorded in the two or more checkpoint logs.
  • the number of checkpoint logs for the same checkpoint is preferably smaller than the number of partitions 111. This is to reduce the number of log I / Os.
  • the checkpoint log may be stored in an area other than the log file (for example, the main memory 416).
  • the recovery process may be performed by a recovery execution unit (not shown) provided separately from the query execution unit, instead of the thread (query execution unit). That is, in the above embodiment, the query execution unit also serves as the recovery execution unit, but a recovery execution unit may be provided separately from the query execution unit.
  • Database server 402 External storage device

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Debugging And Monitoring (AREA)

Abstract

 データベース管理システムは、複数のトランザクションの実行において、トランザクション毎に、トランザクションのログを生成し、生成したログをログ格納領域に格納する。データベース管理システムは、少なくとも、トランザクション実行順序によって結果が異なるトランザクションの集合に属するトランザクションについて生成されたログには、ログの順番を記録する。

Description

データベース管理システム及び方法
 本発明は、概して、データベース管理に関し、例えば、トランザクション処理のログの出力に関する。
 データベース管理システム(以下、DBMS)として、データベース(特に、テーブル及びインデックスといった主要なデータ)を不揮発性のストレージ装置(典型的にはHDD(Hard Disk Drive)のようなディスクストレージ装置)に配置するオンディスクデータベースと、データベースをメインメモリ(一般的に揮発性メモリ)に配置するインメモリデータベースが知られている(オンディスクデータベースとインメモリデータベースを組み合わせたハイブリット型のDBMSも知られている)。
 インメモリデータベースも、メインメモリ上のデータベースの状態をリカバリーするためには、不揮発性のストレージ装置に更新履歴を含んだログを出力しておく必要がある。
 ログは、一般に、トランザクション実行時に単一のログファイルに出力される。複数のコア(又は複数のCPU(Central Processing Unit))で並行してトランザクションが処理されるようになっていても、ログの出力先は、単一のログファイルである。このため、ログ出力がボトルネックとなる。
 ところで、必ずしも全てのトランザクションの間に順序を定める必要はない。例えば、2つのトランザクションが参照及び更新するデータの集合が共通部分を持たない場合には、その2つのトランザクションの実行順序を入れ替えても、データベースへの操作結果は変わらない。このため、2つのトランザクションには順序を定める必要はない。特許文献1では、分散されたデータベース毎にログファイルが用意され、データベースの更新履歴を含んだログが、複数のログファイルのうちのそのデータベースに対応したログファイルに出力される。
US5878414
 インメモリデータベースは、データベースを複数のパーティションに分割し、各パーティションを管理することができる。特許文献1に開示の技術をインメモリデータベースに適用した場合、インメモリデータベースが管理するパーティション毎にログファイルを用意し、パーションの更新履歴を含んだログをそのパーティションに対応するログファイルに出力することができる。
 しかし、特許文献1の技術を単純にインメモリデータベースに適用すると、トランザクション数の数倍のI/O要求がストレージ装置に対して発生してことになる。なぜなら、パーティションは予め定義されており、トランザクションの処理において複数のパーティションのデータを参照及び更新することがあることを避けることができず、その場合、処理されたトランザクションが1つであっても、複数のパーティションにそれぞれ対応した複数のログファイルの各々にログを出力しなければならないからである。
 このような課題は、インメモリデータベースに限らず、分割されたデータベースを管理する他のDBMS、或いは、単一のデータベースを管理する他のDBMSについてもあり得る。
 DBMSは、複数のトランザクションの実行において、トランザクション毎に、トランザクションのログを生成し、生成したログをログ格納領域に格納する。DBMSは、少なくとも、トランザクション実行順序によって結果が異なるトランザクションの集合に属するトランザクションについて生成されたログには、ログの順番を記録する。
 トランザクション実行順序によって結果が異なるトランザクションの集合に属するトランザクションについて生成されたログにログの順番が記録されるので、トランザクション実行順序によって結果が異なるトランザクションの集合について、トランザクションの実行順序を特定することができる。このため、データベースが分割された複数のデータベース部分のうちの2以上のデータベース部分を更新した1つのトランザクションについて生成されるログが、更新されたデータベース部分の数より少ない数のログであっても、格納されたログを基に、トランザクションの実行順序(例えば半順序)を特定することができる。
実施例に係る計算機システムの構成を示す。 トランザクション集合の一例を示す。 実施例に係る計算機システムの機能ブロック図である。 LLSN管理部の構成を示す。 ログのデータ構造を示す。 チェックポイントログのデータ構造を示す。 トランザクション集合の一例を示す。 トランザクション集合の実行前と実行後のテーブルを示す。 実施例に係るログ出力の一例を示す。 比較例1に係るログ出力の一例を示す。 比較例2に係るログ出力の一例を示す。 トランザクション処理のフローチャートである。 ログ出力処理のフローチャートである。 チェックポイント生成処理のフローチャートである。 データベースのリカバリー処理(親)のフローチャートである。 データベースのリカバリー処理(子)のフローチャートである。
 以下、図面を参照して、一実施例を説明する。
 なお、以下の説明では、同種の要素の参照符号には同一の親番号を含んでいる。同種の要素を区別して説明する場合には、要素の参照符号を使用し(例えばパーティション111A、111B、…)、同種の要素を区別しないで説明する場合には、要素の参照符号のうちの親番号のみ使用することがある(例えばパーティション111)。
 また、以下の説明では、「プログラム」を主語として処理を説明する場合があるが、プログラムは、プロセッサによって実行されることで、定められた処理を、適宜に記憶資源(例えばメモリ)及び/又は通信インターフェイスデバイス等を用いながら行うため、処理の主語がプロセッサとされてもよい。プログラムを主語として説明された処理は、プロセッサ或いはそのプロセッサを有する装置(例えばデータベースサーバ)が行う処理としてもよい。また、プロセッサは、処理の一部又は全部を行うハードウェア回路を含んでもよい。プログラムは、プログラムソースから各コントローラにインストールされてもよい。プログラムソースは、例えば、プログラム配布計算機又は記憶メディアであってもよい。
 図1は、実施例に係る計算機システムの構成を示す。
 データベースサーバ401に外部ストレージ装置402が、例えば通信ネットワーク403を介して接続されている。
 データベースサーバ401は、計算機であって、例えば、パーソナルコンピュータ、ワークステーション又はメインフレームであってよく、もしくは、これらの計算機において仮想化プログラムによって構成された仮想的な計算機であってよい。データベースサーバ401は、I/Oアダプタ413、メインメモリ416、記憶デバイス415及びそれらに接続されたプロセッサ414を有する。プロセッサ414は、例えば、マイクロプロセッサ、又は、マイクロプロセッサと専用ハードウェア回路を含んだモジュールでよい。プロセッサ414は、コンピュータプログラムを実行する。プロセッサ414により実行されるコンピュータプログラムは、例えば、オペレーティングシステム(OS)117及びデータベース管理システム(DBMS)412である。メインメモリ416は、例えば、揮発性のDRAM(Dynamic Random Access Memory)等であり、プロセッサ414によって実行されるプログラムと、プログラムが使用するデータを一時的に記憶する。記憶デバイス415は、不揮発性であり、例えば、HDD(Hard Disk Drive)又はSSD(Solid State Drive)である。記憶デバイス415は、プログラム及びプログラムが使用するデータを格納してよい。I/Oアダプタ413は、通信ネットワーク403とデータベースサーバ401を接続する。
 外部ストレージ装置402は、複数の記憶デバイスを含む記憶デバイス群451を有する装置であり、例えば、ディスクアレイ装置であるが、それに代えて、単一の記憶デバイスであってもよい。外部ストレージ装置402は、ログファイル301を記憶する。外部ストレージ装置402は、データベースサーバ401からログのI/O要求を受け付け、当該I/O要求に従いデータ(例えばログ)の読み書きを行い、その結果をデータベースサーバ401に返す。なお、記憶デバイス群451が有する記憶デバイスは、不揮発性の記憶媒体を有するデバイスであって、例えば、HDD又はSSDである。記憶デバイス群451は、RAID(Redundant Array of Independent Disks)グループでよく、所定のRAIDレベルでデータを記憶してもよい。記憶デバイス群451の記憶空間に基づく論理的な記憶デバイス(例えば、論理ユニット、論理ボリューム、ファイルシステムボリューム)が、データベースサーバ401に提供され、当該論理的な記憶デバイス上にログファイル301が格納されてもよい。なお、本実施例において、ログファイル301は、ログ格納領域の一例である。
 外部ストレージ装置402は、記憶デバイス群451に加えて、I/Oアダプタ441及びこれらに接続されたストレージコントローラ442を有する。I/Oアダプタ441は、外部ストレージ装置402を通信ネットワーク403に接続し、これを介して、データベースサーバ401と接続される。通信ネットワーク403を介した通信プロトコルとしては、例えば、ファイバチャネル(FC)、SCSI(Small Computer System Interface)、又は、TCP/IP(Transmission Control Protocol/Internet Protocol)が採用されてよい。例えば、ファイバチャネルもしくはSCSIが採用される場合、I/Oアダプタ441(及び413)は、ホストバスアダプタと呼ばれることがある。ストレージコントローラ442は、例えば、メモリ及びプロセッサを含み、データベースサーバ401からのI/O要求に応じて、ログファイル301を格納した記憶デバイス群451との間でデータの読出し、もしくは、書込みを行う。
 図2は、トランザクション集合の一例を示す。
 この図は、2つのチェックポイント1及び2の間で実行されるトランザクションの例を示す。本実施例において実行される各トランザクションは、第1種トランザクション集合と第2種トランザクション集合のいずれかに分類される。
 第1種トランザクション集合は、トランザクション実行順序によって結果が変化するトランザクションの集合である。図示の例では、半順序が定義されている。半順序によれば、例えば、同一のレコードを更新する複数のトランザクションは定義された順序で実行されなければならないが、異なるレコードを更新する複数のトランザクションはどのような順序で実行されてもよい。
 第2種トランザクション集合は、トランザクションの実行順序が結果に影響を与えないトランザクション集合である。
 実行対象のトランザクションが第1種及び第2種トランザクション集合のどちらに属するかは、例えば、1又は複数のクエリ実行プランから判断することができる。
 図3は、実施例に係る計算機システムの機能ブロック図である。
 DBMS412は、インメモリデータベースである。DBMS412は、データベースを複数のパーティション111(例えば3つのパーティション111A~111C)に分割してメインメモリ416上に配置する。各パーティション111は、データベースの一部分、例えば、データベース中のテーブルの一部分であるテーブル112と、データベース中のインデックスの一部分であるインデックス113とを含む。1つのパーティション111(例えば111A)において、そのパーティション111内のインデックス113(例えば113A)を用いて、そのパーティション111内のテーブル112(例えば112A)からデータを特定することができる。1つのテーブル112が有するデータは、そのテーブル112を含むパーティション111内のインデックス113のみから特定可能でよい。また、各パーティション111は、ロック機構116を含んでよい。同一のパーティション111に対して2以上のスレッド110が競合することを避けるためである。ロック機構116は、パーティション111のロックの取得済か否かを表す情報でよい。例えば、ロック機構116は、ロック取得済なら値「1」でよくロック未取得なら値「0」でよい。ロック機構116は、パーティション111に関連付けられていればよく、パーティション111の外にあってもよい。
 DBMS412は、パーティション111毎に、ログバッファ114とLLSN管理部115を有する。ログバッファ114は、パーティション111の更新履歴を含んだログを一時格納する。LLSN管理部115は、LLSNを管理する。「LLSN」は、ローカルログシーケンス番号の略である。LLSNは、1つのパーティション111において重複しない番号である。LLSNは、第1種トランザクション集合(トランザクション実行順序によって結果が変化するトランザクション集合)に属するトランザクションのログの出力の際に採番される。LLSNは、第1種トランザクション集合に限らず第2種トランザクション集合に属するトランザクションのログの出力の際にも採番されてもよい。
 DBMS412は、クエリ発行元からクエリを受信し、受信したクエリの実行において、1又は複数のトランザクションを実行する。具体的には、DBMS412は、クエリ受付部421、クエリ実行プラン生成部422及びクエリ実行部424を有する。
 クエリ受付部421は、クエリ発行元が発行するクエリを受け付ける。クエリは、例えば、構造化問合せ言語(SQL、Structured Query Language)によって記述される。1つのクエリで複数のトランザクションが記述されていてもよいし、複数のクエリで複数のトランザクションが記述されてもよい。また、クエリ発行元は、DBMS412の内部のコンピュータプログラムであってよいし、DBMS412外部のコンピュータプログラムであってよい。例えば、外部のコンピュータプログラムは、データベースサーバ401内で実行されるコンピュータプログラム(例えばアプリケーションプログラム)であってもよいし、データベースサーバ401に接続されたクライアント計算機等の装置で実行されるコンピュータプログラム(例えば、アプリケーションプログラム)であってもよい。
 クエリ実行プラン生成部422は、クエリ受付部421が受け付けたクエリから、当該クエリを実行するために必要な1以上のデータベースオペレーションを含むクエリ実行プランを生成する。クエリ実行プランは、例えば、1以上のデータベースオペレーションと、データベースオペレーションの実行順序の関係を含む情報であり、クエリ実行プラン情報423として格納される。クエリ実行プランは、データベースオペレーションをノード、データベースオペレーションの実行順序の関係をエッジとする木構造で表されることがある。1つのクエリ実行プラン、又は、複数のクエリ実行プランの組合せから、1又は複数のトランザクション集合と、各トランザクション集合が第1種及び第2種のトランザクション集合のどちらであるかを特定することができる。
 クエリ実行部424は、クエリ実行プラン生成部422が生成したクエリ実行プランに従って、クエリ受付部421が受け付けたクエリを実行し、その実行結果をクエリ発行元に返す。この際、クエリ実行部424は、データベースオペレーションの実行に必要なデータの読出し要求(参照要求)を発行し、その読出し要求に従いパーティション111から読み出されたデータを使用して、そのデータベースオペレーション(例えば、読み出されたデータ(値)を用いて新たなデータを算出し、読出し元レコードにおけるデータを算出後のデータに更新する書込み要求を発行する)を行う。クエリ実行部424は、データベースオペレーションを、スレッド110を実行することにより行う。なお、DBMS412において、複数のスレッド110が並行して実行される。このため、プロセッサ414は、複数のコアを有する。複数のコアは、1又は複数のCPUに存在する。スレッド110は、タスクと呼ばれてもよい。スレッド110の実装としては、例えば、OS117が実現するプロセスやカーネルスレッド等のほか、ライブラリ等が実現するユーザスレッドを用いてよい。1つのスレッド110により、1以上のデータベースオペレーションに対応した1つのトランザクションが実行されてよい。以下、クエリ実行部424がスレッド110を実行することにより行われる処理の主語を、スレッド110、とすることがある。
 クエリ実行部424(スレッド110)は、トランザクションの実行において、外部ストレージ装置402内のログファイル301にログを書き込むために、外部ストレージ装置402に対するI/O要求をOS117に発行する。OS117は、そのI/O要求を受け付け、外部ストレージ装置402へI/O要求を発行する。
 I/Oアダプタ413には、複数のI/Oキュー201(201A~201C)が用意される。トランザクションの処理において、スレッド110が、ログの書込みのためのI/O要求を発行するが、I/Oキュー201には、そのI/O要求が格納される。具体的には、I/O要求は、OS117によりI/Oキュー201に格納される。
 外部ストレージ装置402が、複数のログファイル301(301A~301C)を記憶する。ログファイル301に、I/O要求の書込み対象のログが記録される。
 本実施例では、パーティション111と、I/Oキュー201と、ログファイル301が、1:1:1で対応している。つまり、パーティション111毎に、1つのI/Oキュー201と、1つのログファイル301がある。具体的には、パーティション111AにI/Oキュー201A及びログファイル301Aが関連付けられており、パーティション111BにI/Oキュー201B及びログファイル301Bが関連付けられており、パーティション111CにI/Oキュー201C及びログファイル301Cが関連付けられている。スレッド110は、1つのログファイル301につき1つであっても複数であってもよい。ただし、I/O要求の完了を通知するための割り込みをI/Oキュー201毎に特定のスレッド110に送信するようにする方がI/O要求の処理が軽減できる場合があり、その場合には例えばスレッド110とパーティション111とI/Oキュー201を1対1対応させておくとよい場合がある。本実施例では、説明を分かり易くするために、スレッド110もログファイル301に1:1で対応していてよい。例えば、スレッド110Aが、パーティション111Aにおけるテーブル112A中のレコードを更新したことを表すログのI/O要求を、そのパーティション111Aに対応するログファイル301Aに対して発行するようになっている。発行されたI/O要求は、ログバッファ114Aを経由して、OS117に送られる。OS117が、ログファイル301Aに対するI/O要求を受けて、そのI/O要求を、ログファイル301Aに対応するI/Oキュー201Aに格納する。I/Oキュー201Aに格納されたI/O要求は、OS117によりI/Oキュー201から外部ストレージ装置402に送られる。それにより、そのI/O要求の書込み対象データであるログが、ログファイル301Aに書き込まれる。
 図3に示すDBMS412の構成は一例に過ぎない。例えば、或る構成要素は複数の構成要素に分割されていてもよく、複数の構成要素が1つの構成要素に統合されていてもよい。
 図4は、LLSN管理部115の構成を示す。
 LLSN管理部115は、ロック機構121と、LLSN122と、ログファイルアドレス123とを有する。
 ロック機構121も、図3に示したロック機構116と同様、LLSN管理部115のロックの取得済か否かを表すデータでよい。例えば、ロック機構121は、ロック取得済なら値「1」でよくロック未取得なら値「0」でよい。
 LLSN122は、このLLSN管理部115を含むパーティション111についてのログのシーケンス番号(LLSN)である。例えば、LLSNは、このLLSN管理部115のIDと、シリアル番号との組合せである。例えば、LLSN管理部115Aからスレッド110AによりLLSNが採番される度に、LLSN122が表す値は、1-001、1-002、1-003のように更新される。LLSNは、LLSN管理部115AのID「1」と、更新後のシリアル番号との組合せである。
 ログファイルアドレス123は、LLSN管理部115を含むパーティション111に対応したログファイル301におけるログの書込み先アドレスである。ログファイルアドレス123が表すアドレス(値)は、ログファイル301にログを書き出す度に出力するログのサイズ分だけ加算される。
 図5は、ログのデータ構造を示す。
 ログは、1つのトラザクションにつき1つでよく、トランザクションのIDと、そのトランザクションの実行中に採番された1以上のLLSNと、そのトランザクションの更新履歴を表す情報とを含む。ログに含まれるLLSNの数は、トランザクションの実行において更新されたパーティション111の数と同じである。
 図6は、チェックポイントログのデータ構造を示す。
 チェックポイントログは、チェックポイントが生成されたことのログである。チェックポイントログは、チェックポイントを生成するトランザクションのIDと、そのチェックポイントの生成において採番された全てのLLSNと、生成されたチェックポイントのIDとを含む。データベースのリカバリーの際には、チェックポイントIDを使用して、リカバリーする時点を特定することができる。なお、チェックポイントIDは、チェックポイント生成時の時刻を表す値でもよい。
 図7は、トランザクション集合の一例を示す。図8は、トランザクション集合の実行前と実行後のテーブル112A及び112Bを示す。なお、図7(及び後述の図9~図11)では、トランザクションは「Tr.」と略記されている。また、以下の説明では、レコードは、行IDとVal(値)を有していて、行ID:XのレコードをレコードXと言い、行ID:YのレコードをレコードYと言う。
 図7に示すトランザクション集合は、第1種のトランザクション集合、すなわち、トランザクション実行順序によって結果が変化するトランザクションの集合である。トランザクション集合により、レコードX及びYが更新される。
 図8に示すように、レコードXは、パーティション111A中のテーブル112Aにあるレコードであり、レコードYは、別のパーティション111B中のテーブル112Bにあるレコードである。図7に示したトランザクション集合の実行前、レコードXにおけるVal(値)は「100」であり、レコードYにおけるVal(値)も「100」である。図7に示したトランザクション集合の実行により、レコードXにおけるVal(値)は「110」に更新され、レコードYにおけるVal(値)は「122」に更新される。
 図7に示すトランザクション集合によれば、トランザクションA、B及びEは、実行順序によって結果が変化する。それらは同一のレコードXを更新するトランザクションだからである。同様に、トランザクションA、C及びDも、実行順序によって結果が変化する。それらは同一のレコードYを更新するトランザクションだからである。
 しかし、トランザクションBと、トランザクションC又はDのどちらを先に実行しても結果が変化しない。それらは異なるレコードX、Yを更新するトランザクションだから、言い換えれば、更新されるレコードが共通でないからである。
 そこで、ログに基づいてデータベースをリカバリーする際に最低限の必要なトランザクション実行順序を記録する必要がある。この実行したトランザクション集合に半順序を定義する実装方法は1つではなく、例えば必要最小限の順序関係を記録する方法として次の方法が考えられる。例えば図2に示したように、任意のチェックポイント1とチェックポイント1より後に生成されたチェックポイント2の間に実行されたトランザクションであって、第1種のトランザクション集合に属するトランザクション(トランザクションの実行順序によって結果が異なるトランザクション)のログには、コミットされた順序に従う順番(ログの生成順番)が記録される。一方、第2種のトランザクション集合に属するトランザクション(トランザクション間の実行順序によって結果が異ならず、チェックポイント1からチェックポイント2の間に実行されていればよいトランザクション)のログには、順番が記録されない。これにより、第1種のトランザクション集合のログについて、半順序を定義することができる。
 本実施例では、1つのトランザクションの実行において、更新されるパーティション111別にLLSNが採番される。1つのパーティション111について採番されるLLSNは、そのパーティション111についてのシーケンス番号であり、他のパーティション111についてのLLSNとの関連性は無い。つまり、本実施例では、パーティション111別に一連のLLSN(シーケンス番号)が採番され、採番されたLLSNがログに記録されることで、第1種のトランザクション集合について半順序が定義される。
 具体的には、次のようにログが出力される。すなわち、前述したように、パーティション111とログファイル301が1:1で用意されており、パーティション111の更新履歴を含んだログは、そのパーティション111に対応したログファイル301に書き込まれる。また、1つのトランザクションの実行においてN個のパーティション111(Nは2以上の整数)が更新されることもあるが、その場合には、N個のパーティション111にそれぞれ対応したN個のログファイルにN個のログがそれぞれ書き込まれるのではなく、更新されたパーティション111の数(N)よりも少ない数のログファイル(M個のログファイル)301にそれぞれM個のログが書き込まれる。本実施例では、M=1である。すなわち、本実施例では、Nの値(1つのトランザクションの実行において更新されたパーティション111の数)が幾つであっても、更新されたパーティション111のうちのいずれかの1つのパーティション111に対応した1つのログファイル301にログが書き込まれる。但し、そのログには、更新されたN個のパーティションにそれぞれ対応したN個のLLSNが書き込まれる。
 図9は、実施例に係るログ出力の一例を示す。
 図7に示したトランザクション集合の実行前、パーティション111AのLLSNは1-201、パーティション111BのLLSNの値は2-100であるとする。もちろん、これは一例にすぎず、これ以外の値であることを排除するものではない。
 まず、トランザクションAの実行により、パーティション111AのレコードXとパーティション111BのレコードYの両方が更新される。このため、LLSN管理部115AからLLSN=1-201が採番され、LLSN管理部115BからLLSN=2-100が採番される。この段階で、LLSN管理部115A及び115BのそれぞれのLLSNが1インクリメントされ、その結果、LLSN管理部115AのLLSNが1-202となり、LLSN管理部115BのLLSNが2-101となってよい。また、パーティション111A及び111Bが更新された場合、ログの出力先は、パーティション111A及び111Bにそれぞれ対応したログファイル301A及び301Bのうちのどちらかとなる(例えばラウンドロビンで順次出力先が切り替えられてもよいしどちらかに予め決められてもよい)。ここでは、ログファイルAにログが出力される。このため、LLSN管理部115Aからログファイルアドレスが取得され、LLSN管理部115Aにおけるログファイルアドレスに、出力するログのサイズ分の値が加算される。トランザクションAを実行したスレッド110Aが、採番されたLLSN=1-201及びLLSN=2-100、トランザクションID=A、及びレコードX及びYの更新履歴をログに記録し、それらが記録されたログ901Aを、ログファイル301Aにおける、取得したログファイルアドレスに従う位置から、書き込む。具体的には、スレッド110Aが、ログ901Aをログバッファ114Aに格納し、そのログ901Aを書込み対象とし上記取得したログファイルアドレスを指定した書込み要求を発行する。OS117が、その書込み要求を受けて、その書込み要求を、ログファイル301Aに対応したI/Oキュー201Aに書き込み、I/Oキュー201Aからその書込み要求を外部ストレージ装置402に送信する。外部ストレージ装置402が、その書込み要求を受けて、その書込み要求に従う書込み対象のログ901Aをログファイル301Aに書き込み、書込み要求の完了応答を返す。完了応答は、OS117を通じてDBMS412に戻る。
 次に、トランザクションBの実行により、パーティション111AのレコードXだけが更新される。このため、トランザクションBを実行したスレッド110Aが、LLSN管理部115AからLLSN=1-202を採番し(LLSN管理部115AのLLSNは1-203にインクリメントされ)、且つログファイルアドレスを取得し(LLSN管理部115Aのログファイルアドレスに出力対象のログのサイズが加算され)、LLSN=1-202、トランザクションID=B、及びレコードXの更新履歴を含んだログ901Bを、トランザクションBの実行により更新されたパーティション111Aに対応するログファイル301A(取得したログファイルアドレス)に出力する。
 また、トランザクションCの実行により、パーティション111BのレコードYだけが更新される。このため、トランザクションCを実行したスレッド110Bが、LLSN管理部115BからLLSN=2-101を採番し(LLSN管理部115BのLLSNは2-102にインクリメントされ)、且つログファイルアドレスを取得し(LLSN管理部115Bのログファイルアドレスに出力対象のログのサイズが加算され)、LLSN=2-101、トランザクションID=C、及びレコードYの更新履歴を含んだログ901Cを、トランザクションCの実行により更新されたパーティション111Bに対応するログファイル301B(取得したログファイルアドレス)に出力する。
 同様に、トランザクションDが実行された場合には、LLSN管理部115BからLLSN=2-102が採番され、LLSN=2-102を含んだログ901Dがログファイル301Bに書き込まれる。
 最後に、トランザクションEが実行された場合には、LLSN管理部115A及び115BからそれぞれLLSN=1-103及び2-103が採番され、それら採番されたLLSNを含んだログ901Eが、ログファイル301Bに書き込まれる。
 このようにログを出力することにより、それぞれのログにおけるLLSNを参照することで、トランザクションA->B->E、トランザクションA->C->D->Eの順序がリカバリー可能である。なお、本実施例では、同一のパーティションについて、第1のLLSNが第2のLLSNより大きいことは、第1のLLSNが第2のLLSNよりも後に(将来に)採番されたことを意味するが、一変形例では、第1のLLSNが第2のLLSNより大きいことは、第1のLLSNが第2のLLSNよりも前に(過去に)採番されたことを意味してもよい。つまり、LLSNの大小関係から順序関係が特定できればよい。
 一般に、いずれか1つのLLSN管理部115のLLSNの大小関係でトランザクション間の順序関係(これを便宜上「≧」と表す)を定義すると、トランザクション全体の集合にいくつかの例外を除いて半順序が定まる。例えば、LLSN管理部115AのLLSNではトランザクションA->Bの順に並び(A≧B)、LLSN管理部115BのLLSNではトランザクションB->Aの順に並ぶ(B≧A)ということが起こる。この場合には、トランザクションAとBの間には順序が定義されていないこととして取り扱われる。実際に、トランザクションAとBはそれぞれ更新を行ったレコードのロックをトランザクション終了まで解放しないため、このような事象が発生するのは、トランザクションA及びBがそれぞれ更新するレコードが異なるレコードであるからであり、トランザクションAとBの実行順序はどちらでもかまわない。
 以下、図7に示したトランザクション集合のログ出力の比較例1及び2を説明する。
 図10は、比較例1に係るログ出力の一例を示す。
 比較例1は、5個のトランザクションA~Eにそれぞれ対応した5個のログを単一ログファイルへ出力する例である。比較例1では、トランザクションの実行順にログがログファイルへ出力される。この場合、2以上のトランザクションが並行して実行されてもログ出力が逐次実行になってしまい、トランザクション間でI/Oリソース(例えば単一ログファイルに対応した単一I/Oキュー)の競合が発生してしまう。
 本実施例では、複数のログファイルが用意され、且つ、複数のログファイルにそれぞれ対応した複数のI/Oリソース(例えばI/Oキュー)が用意される。これにより、I/Oリソースの競合を減らすことができる。
 図11は、比較例2に係るログ出力の一例を示す。
 比較例2は、分散データベースにおいて行われているログ出力例である。トランザクションB、C及びDのように、パーティション111A及び111Bの一方のみを更新するトランザクションについては、ログの出力は、実施例と同様である。しかし、トランザクションA(及びE)のように、パーティション111A及び111Bの両方を更新するトランザクションについては、更新されたパーティションと同数のログが同数のログファイルにそれぞれ出力される。このため、ログI/O数が実施例よりも多くなる。
 すなわち、本実施例では、トランザクションが複数のパーティションを更新しても書き込まれるログの数は、更新されたパーティションの数よりも少ない。そのため、ログI/O数を抑えることができる。
 本実施例では、上述した通り、トランザクションによって順序が定義されない場合がある。例えば、トランザクションBとトランザクションCはどちらが先にトランザクション実行が完了したかログ上は不定である。従って、一般には、最新状態以外の任意のタイミングの状態にデータベースをリカバリーすることはできない。そこで、本実施例では、前述したように、チェックポイントを生成することにより、ある時点のデータベースの状態を記録しリカバリーすることが可能である。
 以下、実施例において行われる処理を説明する。
 図12は、トランザクション処理のフローチャートである。なお、以下の説明では、1つのトランザクションAを例に取り説明する。そのため、そのトランザクションAを実行するスレッドはスレッド110Aであり、そのトランザクションAにより更新されるパーティションはパーティション111A及び111Bであり、パーティション111A及び111Bにそれぞれ対応したログファイルはログファイル301A及び301Bである。
 スレッド110Aが、トランザクションAが開始されると、トランザクションAに対応した指示(クエリ中の指示)に基づいて、パーティション111A及び111Bの各々について、参照/更新セットの生成を行う(S301)。参照/更新セットは、レコードの参照(パーティションに対する読出し要求)とレコードの更新(パーティションに対する書込み要求)とのセットである。参照/更新セットは、パーティションの更新のための要求セットであるが、S301の時点では、パーティション111A及び111Bの変更は行われず、トランザクションAに対応したローカルメモリ領域(メインメモリ461上に確保された領域(図示せず))に参照/更新セットが保持される。
 次に、スレッド110Aが、コミット判定を行う(S302)。コミット判定は、例えば、トランザクションAが参照/更新セットに基づいて行うパーティション111A及び111Bへの変更が他のトランザクションとの整合性を保てているかどうかをデータベースのアイソレーションレベルに応じて行われる。
 コミット判定がNGの場合(S303:No)、スレッド110Aは、アボート処理を行う(S307)。
 コミット判定がOKの場合(S303:Yes)、スレッド110Aは、ログ出力処理を実行する(S304)。次に、スレッド110Aは、参照/更新セットに基づいてパーティション111A及び111Bをそれぞれ更新し(S305)、コミット完了通知を出して(S306)、トランザクションを終了する。
 図13は、ログ出力処理(図12のS304)のフローチャートである。
 トランザクションAを実行しているスレッド110Aと対応付けられているログファイル301AのLLSN管理部115は、LLSN管理部115Aである。スレッド110Aは、LLSN管理部115Aからログファイルアドレスを取得し、LLSN管理部115AのログファイルアドレスにトランザクションAのログサイズを加算する(S401)。なお、この一連の動作の前に、スレッド110Aが、LLSN管理部115Aのロックを取得し、動作後にロックを解放する。LLSN管理部115及びログファイル301がスレッド110Aに対応付けられていない場合には、スレッド110Aは、任意のLLSN管理部115を選択し、その選択したLLSN管理部115について同様の処理を行う。ただし、後述するリカバリー処理においてデッドロックを回避するためには、S401で操作されたLLSN管理部115に対応するログファイル301にログが書き込まれる必要がある。
 次に、スレッド110Aは、トランザクションAの実行により更新されたパーティション111A又は111BのLLSNを採番する(S402)。データベースのアイソレーションレベルやデータ構造によっては、トランザクションAの実行により参照されたパーティションのLLSNも採番する必要がある場合がある。
 スレッド110Aは、更新されたパーティション111A及び111BのうちLLSNが採番されていないパーティションがあれば(S403:No)、その採番されていないパーティションについてS402を行う。一方、更新された全てのパーティション111A及び111BのLLSNが採番されたのであれば(S403:No)、スレッド110Aは、ログ901A(図9参照)を生成しそのログ901Aをログバッファ114Aに書き込み、そのログ901Aの書込み要求(LLSN管理部115Aから取得したログファイルアドレスを指定した書込み要求)を発行する(S404)。スレッド110Aは、外部ストレージ装置402からI/Oアダプタ413を介して書込み完了通知を受信した場合に書込み完了とし(S405)、ログ出力フローを終了する。
 図14は、チェックポイント生成処理のフローチャートである。図14の説明では、チェックポイントを生成するスレッドがスレッド110Aであるとする。
 スレッド110Aは、まず、新規コミット開始を禁止する(S501)。具体的には、スレッド110Aは、スレッド共有の領域に新規コミット禁止を表すフラグビットを予め置き、初期値を0とする。スレッド110Aは、新規コミット開始を禁止する際に、該フラグビットを1に変更する。トランザクションを実行するスレッドは、コミット処理実行開始時に、該フラグビットを確認し、該フラグビットが0の時に限りコミット処理を実行し、該フラグビットが1の時には該フラグビットが0に変更されるまで待ち状態となる。スレッド110Aの新規コミット開始禁止処理以降、いずれのスレッド110もコミットを開始することできなくなり、コミット中のトランザクションについてのみコミットが進む。
 スレッド110Aは、コミット中のトランザクション数が0になるまで待つ(S502:No)。コミット中のトランザクション数が0になると(S502:Yes)、スレッド110Aは、任意に選択したログファイル301(例えば301A)に対応するLLSN管理部115(例えば115A)から、LLSNを採番し且つログファイルアドレスを取得し、チェックポイントログのサイズ分の値を、そのLLSN管理部115(例えば115A)内のログファイルアドレスに加算する(S503)。
 さらに、スレッド110Aは、残りのログファイルに対応する全てのLLSNをそれぞれ採番する(S504)。スレッド110Aは、S503で採番したLLSNと、S504で採番したLLSNと、チェックポイントIDとを含んだチェックポイントログを完成させる。スレッド110Aは、S503で取得したログファイルアドレスを指定したログ書込み要求(書込み対象は上記完成したチェックポイントログ)を、上記任意に選択したログファイル301(例えば301A)に対応したログバッファ114(例えば114A)に書き込み、ログバッファ114(例えば114A)からログ書込み要求を発行する(S505)。
 次に、スレッド110Aは、データベースのバックアップをする条件が満たされているか否かを判断する(S506)。その条件は、チェックポイント生成が行われた回数がN回(Nは自然数)に達したことでもよいし、直前回のバックアップ時刻から一定時間経過したことでもよい。
 S506の判断結果が真の場合(S506:Yes)、スレッド110Aは、データベースのバックアップ、すなわち、メインメモリ416上のデータベース(各パーティション111のテーブル112及びインデックス113)を、上記チェックポイントログに含められたチェックポイントIDに関連付け、そのチェックポイントIDが関連付けられたデータベース(イメージ)を、外部ストレージ装置402に格納する(S507)。この動作は、すべてのチェックポイントで必ずしも必要ではない。しかし、チェックポイントログの書込みの際にデータベースのバックアップが行われることで、チェックポイント生成時点のデータベース(或いは、チェックポイント時点近傍の時点のデータベース)を高速にリカバリーすることができる。なお、バックアップされたデータベース(イメージ)と、チェックポイントIDと、そのチェックポイントIDを含んだチェックポイントログの書込み先アドレスとの対応関係を含んだ情報(以下、チェックポイント管理情報)は、スレッドにより、データベースサーバ401の中又は外の記憶領域(例えばメインメモリ416)に格納されてよい。
 バックアップ完了後、又は、S506の判断結果が偽の場合(S506:No)、スレッド110Aは、新規コミット開始の禁止を解除し(S508)、チェックポイント生成処理が終了する。具体的には、スレッド110Aは、新規コミット禁止を表すフラグビットを1から0に変更する。
 図15は、データベースのリカバリー処理(親)のフローチャートである。図15(及び図16)の説明では、データベースをリカバリーするスレッドがスレッド110Aであるとする。
 スレッド110Aが、チェックポイント管理情報を基に、指定されたチェックポイントのチェックポイントIDに関連付けられたデータベース(バックアップイメージ)、又は、指定されたチェックポイントのチェックポイントIDよりも過去に生成されたチェックポイントIDに関連付けられたデータベース(バックアップイメージ)を、外部ストレージ装置402からメインメモリ416上にロードする(S601)。チェックポイントIDは、クエリ発行元から受けたクエリで指定されていてもよいし、データベースサーバ401に接続された図示しない計算機(例えば管理計算機)より指定されてもよい。
 スレッド110Aは、チェックポイント管理情報を基に、そのデータベースに関連付けられているチェックポイントIDを含んだチェックポイントログを、そのログのアドレス(ログファイル)から取得して、そのログ中の各LLSNを、そのLLSNに対応したパーティション111中のLLSN管理部115のLLSNに設定する(S602)。例えば、先頭番号が1であるLLSNは、LLSN管理部115AのLLSNに設定され、先頭番号が2であるLLSNは、LLSN管理部115BのLLSNに設定される。
 スレッド110Aは、ロードされたデータベースに関連付けられているチェックポイントIDと指定されたチェックポイントIDが違っていれば(S603:No)、各パーティション111に対応したスレッド110に、リカバリー処理(子)を実行させる(S604)。パーティション111Aについては、スレッド110Aが、リカバリー処理(子)も実行する。スレッド110Aは、全てのリカバリー処理(子)が終了となるのを待って(S605:Yes)、リカバリー処理(親)を終了する。
 一方、スレッド110Aは、ロードされたデータベースに関連付けられているチェックポイントIDと指定されたチェックポイントIDが同じであれば(S603:Yes)、S604及び605を行うこと無しに、リカバリー処理(親)を終了する。なぜなら、S601でロードされたデータベースが、リカバリーされるべきデータベースだからである。
 図16は、データベースのリカバリー処理(子)のフローチャートである。
 リカバリー処理(子)は、各パーティション111について実行される。以下、1つのパーティション111Bを例に取り、リカバリー処理(子)を説明する。
 スレッド110Bは、リカバリー処理(親)において設定されたLLSN(LLSN管理部115B内のLLSN)を、バックアップ時点のLLSNとして取得する(S700)。以下、パーティション111Bに対応したログファイル301Bにおいて、S705で取得したLLSNよりも大きなLLSNであって、指定されたチェックポイントIDより古いLLSN(指定されたチェックポイントIDの生成時点よりも過去に採番されたLLSN)を含んだログを、「バックアップ後ログ」と言うことにする。バックアップ後ログのうち最も大きいLLSNを含むバックアップ後ログは、ログファイル301Bの終端のログであることもある。また、バックアップ後ログのうち、パーティション111BのLLSNの他に、パーティション111BのLLSN以外のLLSNを含んでいるバックアップ後ログもあり得る。以下、パーティション111BのLLSNを「該当LLSN」と言い、パーティション111BのLLSN以外のLLSNを「非該当LLSN」と言う。
 スレッド110Bは、パーティション111Bに対応したログファイル301Bにおける未処理のバックアップ後ログのうち最小の該当LLSNを含んだバックアップ後ログを特定する(S701)。以下、S701で特定されたバックアップ後ログを「対象ログ」と言う。
 スレッド110Bは、対象ログ中の該当LLSNが、直前回のS705又はS706で処理されたバックアップ後ログ中の該当LLSNの次の該当LLSN(例えば、直前回のS705又はS706で処理されたバックアップ後ログ中の該当LLSNに1が加算された該当LLSN)か否かを判断する(S702)。
 S702の判断結果が真の場合(S702:Yes)、スレッド110Bは、対象ログに非該当LLSNが含まれているか否かを判断する。
 S704の判断結果が真の場合(S704:Yes)、スレッド110Bは、対象ログ中の更新履歴のうち、パーティション111Bについての更新をパーティション111Bに対して実行し、且つ、対象ログのコピーを、非該当LLSNに対応するパーティションに対応したスレッドに(非該当LLSNに対応するパーティションのリカバリー処理(子)を実行しているスレッド)に転送する(S705)。例えば、非該当LLSNの先頭番号が1の場合、対象ログのコピーは、スレッド110Aに転送される。非該当LLSNが2以上の場合、対象ログのコピーは、2以上の非該当LLSNに対応した2以上のパーティションに対応するスレッドにそれぞれ転送される。
 S704の判断結果が偽の場合(S704:No)、スレッド110Bは、対象ログ中の更新履歴通りの更新をパーティション111Bに対して実行する(S706)。
 S702の判断結果が偽の場合(S702:No)、実行すべき更新の履歴を含んだログが、ログファイル301B以外のログファイルに格納されているということである。このため、スレッド110Bは、S705とは逆に、別のスレッドから、実行すべき更新の履歴を含んだログ(直前回のS705又はS706で処理されたバックアップ後ログ中の該当LLSNの次の該当LLSNを含んだログ)のコピーを待ち、そのログのコピーを受信した場合(S703)、そのログのコピー中の更新履歴のうちの、パーティション111Bについての更新をパーティション111Bに対して実行する(S706)。
 スレッド110Bは、S705又はS706の後、未処理のバックアップ後ログが未だ残っているか否かを判断する(S707)。未処理のバックアップ後ログがあれば(S707:Yes)、再度S701が行われ、未処理のバックアップ後ログがなければ(S707:Yes)、パーティション111Bについてのリカバリー処理(子)が終了となる。
 以上、一実施例を説明したが、本発明はその実施例に限られない。
 例えば、DBMSとして、インメモリデータベース以外のDBMSが採用されてもよい。データベースを構成する複数のデータベース部分は、異なる複数のデータベースサーバに分散していてもよいし、複数のデータベース部分のうちの少なくとも1つが、外部ストレージ装置に格納されていてもよい。
 また、ログファイル301(及びデータベース部分)は、外部ストレージ装置402に代えてデータベースサーバ401内の記憶デバイス415に格納されていてもよい。
 また、第2種のトランザクション集合に属するトランザクションのログについても、順番(LLSNのようなログの生成順番)が記録されてもよい。しかし、実施例のように、第2種のトランザクション集合に属するトランザクションのログにはLLSNが記録されないようにすることで、ログを生成するがLLSNを採番しなくてもよいことがあり、結果として、プロセッサ414の負荷の軽減が期待できる。
 また、ログファイル301に代えて別のログ格納領域が採用されてもよい。例えば、ログ格納領域は、外部ストレージ装置402、メインメモリ416、又は記憶デバイス415内の領域であり、その領域に、ログ毎に生成されたログファイルが書き込まれてもよい。つまり、上記実施例では1つのログファイルに複数のログが書き込まれるが、一変形例では、1つのログにつき1つのログファイルがログ格納領域に書き込まれてもよい。
 また、LLSNは、対応するLLSN管理部115のIDと、タイムスタンプとの組み合わせでもよい。
 また、同一のチェックポイントについて2以上のチェックポイントログが生成され、それら2以上のチェックポイントログに、全てのLLSN管理部115に対応した全てのLLSNが記録されてもよい。ただし、同一のチェックポイントについてのチェックポイントログの数は、パーティション111の数よりも少ないことが望ましい。ログI/O数の削減のためである。なお、チェックポイントログは、ログファイル以外の領域(例えばメインメモリ416)に格納されてもよい。
 また、リカバリー処理は、スレッド(クエリ実行部)に代えて、クエリ実行部とは別に設けられたリカバリー実行部(図示せず)によって行われてもよい。つまり、上記実施例では、クエリ実行部がリカバリー実行部を兼ねているが、クエリ実行部とは別にリカバリー実行部が設けられてもよい。
 401:データベースサーバ 402:外部ストレージ装置

Claims (15)

  1.  データベースを管理するデータベース管理システムであって、
     前記データベースへのクエリをクエリ発行元から受け付けるクエリ受付部と、
     前記受け付けたクエリに関する情報を基に、複数のトランザクションを実行し、トランザクション毎に、トランザクションのログを生成し、前記生成したログをログ格納領域に書き込むためのログ書込み要求を発行するクエリ実行部と
    を有し、
     前記クエリ実行部は、トランザクション実行順序によって結果が異なるトランザクションの集合である第1種トランザクション集合に属するトランザクション毎に、トランザクションのログに、ログの順番を記録する、
    データベース管理システム。
  2.  分割された前記データベースである複数のデータベース部分、の各々について、ログの順番を管理する順番管理部を有し、
     各順番管理部により管理される順番は、その順番管理部に対応したデータベース部分を更新したトランザクションのログの生成の都度に更新され、
     前記複数のデータベース部分のうちN個のデータベース部分を更新したトランザクションのログとして(Nは2以上の整数)、M個のログが生成され(MはN以下であり1以上の整数)、
     前記M個のログのうちの少なくとも1つが、前記N個のデータベース部分にそれぞれ対応したN個の順番のうちの2以上の順番を含む、
    請求項1記載のデータベース管理システム。
  3.  前記N個のデータベース部分にそれぞれ対応したN個のログ格納領域があり、
     1つの順番を含んだログは、その順番に対応したログ格納領域に書き込まれ、
     前記2以上の順番を含んだログは、前記2以上の順番にそれぞれ対応した2以上のログ格納領域のうちのいずれかに書き込まれる、
    請求項2記載のデータベース管理システム。
  4.  M=1である、
    請求項2記載のデータベース管理システム。
  5.  前記複数のデータベース部分にそれぞれ対応した複数のI/O(Input/Output)リソースがあり、
     1つの順番を含んだログは、その順番に対応したI/Oリソースを通じて、そのI/Oリソースに対応したログ格納領域に書き込まれ、
     前記2以上の順番を含んだログは、前記2以上の順番にそれぞれ対応した2以上のI/Oリソースのいずれかを通じて、そのI/Oリソースに対応したログ格納領域に書き込まれる、
    請求項2記載のデータベース管理システム。
  6.  前記クエリ実行部は、トランザクション実行順序が結果に影響を与えないトランザクションの集合である第2種トランザクション集合に属するトランザクションのログには、順番を記録しない、
    請求項1記載のデータベース管理システム。
  7.  前記クエリ実行部は、前記クエリに関する情報を基に、実行対象のトランザクションが、前記第1トランザクション集合と前記第2種トランザクション集合とのどちらに属するかを判断する、
    請求項6記載のデータベース管理システム。
  8.  前記受け付けたクエリに基づいて前記受け付けたクエリを実行するために必要な1以上のデータベースオペレーションと前記1以上のデータベースオペレーションの実行手順とを表す情報を含んだクエリ実行プランを生成するクエリ実行プラン生成部を更に有し、
     前記クエリに関する情報は、前記クエリ実行プランを表す情報である、
    請求項7記載のデータベース管理システム。
  9.  前記クエリ実行部は、チェックポイント毎に、全ての順番管理部にそれぞれ対応した全ての順番を含んだ1以上のチェックポイントログを生成する、
    請求項1記載のデータベース管理システム。
  10.  チェックポイント毎に、チェックポイントログの数は、データベース部分の数よりも少ない、
    請求項9記載のデータベース管理システム。
  11.  指定された第1のチェックポイントの時点におけるデータベースをリカバリーするリカバリー実行部を更に有し、
     前記クエリ実行部は、複数のチェックポイントのうちの少なくとも1つのチェックポイントにおいてデータベースをバックアップし、
     前記リカバリー実行部は、
      バックアップされたデータベースのうち、前記第1のチェックポイントと同じ、又は、前記第1のチェックポイントよりも過去のチェックポイントである第2のチェックポイントに対応したデータベースをロードし、
      前記第2のチェックポイントに対応したチェックポイントログ中の各順番を、その順番に対応する順番管理部に設定する、
    請求項9記載のデータベース管理システム。
  12.  前記リカバリー実行部は、前記第2のチェックポイントと前記第1のチェックポイントが異なっていれば、ロードされたデータベースのデータベース部分毎に、データベース部分に対応したログ格納領域に格納されている、前記第2のチェックポイントから前記第1のチェックポイントまでの1以上のログを、ログ中の順番の小さい順に用いて、データベース部分をリカバリーし、
     前記リカバリー実行部は、データベース部分毎のリカバリーにおいて、そのデータベース部分に対応した順番である該当順番と該当順番以外の1以上の順番である1以上の非該当順番とを含んだログについては、そのログに従う更新を、そのデータベース部分と、前記1以上の非該当順番にそれぞれ対応する1以上のデータベース部分とに対して実行し、
     前記リカバリー実行部は、データベース部分毎のリカバリーにおいて、そのデータベース部分に対応したログ中の順番が、直前回に用いたログ中の順番の次の番号でなければ、前記次の番号を含んだログを待つ、
    請求項11記載のデータベース管理システム。
  13.  前記データベースは、メインメモリ上に存在する、
    請求項2記載のデータベース管理システム。
  14.  データベースを管理する計算機システムであって、
     ログ格納領域に接続されたインターフェイスデバイスと、
     前記インターフェイスデバイスに接続されたプロセッサと
    を有し、
     前記プロセッサは、複数のトランザクションを実行し、複数のトランザクションの実行において、トランザクション毎に、トランザクションのログを生成し、生成したログをログ格納領域に格納し、
     前記プロセッサは、少なくとも、トランザクション実行順序によって結果が異なるトランザクションの集合に属するトランザクションのログには、ログの順番を記録する、
    計算機システム。
  15.  データベースを管理するデータベース管理方法であって、
     複数のトランザクションの実行において、トランザクション毎に、トランザクションのログを生成し、
     生成したログをログ格納領域に格納し、
     少なくとも、トランザクション実行順序によって結果が異なるトランザクションの集合に属するトランザクションについて生成されたログには、ログの順番が記録される、
    データベース管理方法。
PCT/JP2014/051263 2014-01-22 2014-01-22 データベース管理システム及び方法 WO2015111152A1 (ja)

Priority Applications (5)

Application Number Priority Date Filing Date Title
JP2015558634A JP6152431B2 (ja) 2014-01-22 2014-01-22 データベース管理システム及び方法
DE112014002275.6T DE112014002275T5 (de) 2014-01-22 2014-01-22 Datenbankverwaltungssystem und -verfahren
GB1521129.5A GB2537446A (en) 2014-01-22 2014-01-22 Database management system and method
US14/894,042 US10366075B2 (en) 2014-01-22 2014-01-22 Database management system and method
PCT/JP2014/051263 WO2015111152A1 (ja) 2014-01-22 2014-01-22 データベース管理システム及び方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2014/051263 WO2015111152A1 (ja) 2014-01-22 2014-01-22 データベース管理システム及び方法

Publications (1)

Publication Number Publication Date
WO2015111152A1 true WO2015111152A1 (ja) 2015-07-30

Family

ID=53680984

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2014/051263 WO2015111152A1 (ja) 2014-01-22 2014-01-22 データベース管理システム及び方法

Country Status (5)

Country Link
US (1) US10366075B2 (ja)
JP (1) JP6152431B2 (ja)
DE (1) DE112014002275T5 (ja)
GB (1) GB2537446A (ja)
WO (1) WO2015111152A1 (ja)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017097639A (ja) * 2015-11-25 2017-06-01 富士通株式会社 データベース制御プログラム、データベース制御装置及びデータベース制御方法
JP2020504927A (ja) * 2016-12-19 2020-02-13 スワールズ,インコーポレイテッド イベントの削除を可能にする分散データベースのための方法および装置
US11734260B2 (en) 2015-08-28 2023-08-22 Hedera Hashgraph, Llc Methods and apparatus for a distributed database within a network
US11797502B2 (en) 2015-08-28 2023-10-24 Hedera Hashgraph, Llc Methods and apparatus for a distributed database within a network

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10002153B2 (en) 2015-05-14 2018-06-19 Illumon Llc Remote data object publishing/subscribing system having a multicast key-value protocol
US10452491B2 (en) * 2016-04-14 2019-10-22 Sap Se Scalable log partitioning system
JP6390748B1 (ja) * 2017-04-19 2018-09-19 富士通株式会社 情報処理装置、情報処理方法および情報処理プログラム
US10198469B1 (en) 2017-08-24 2019-02-05 Deephaven Data Labs Llc Computer data system data source refreshing using an update propagation graph having a merged join listener
US11334439B2 (en) 2018-08-29 2022-05-17 International Business Machines Corporation Checkpointing for increasing efficiency of a blockchain
US11196542B2 (en) 2018-08-29 2021-12-07 International Business Machines Corporation Checkpointing for increasing efficiency of a blockchain
US10901957B2 (en) * 2018-08-29 2021-01-26 International Business Machines Corporation Checkpointing for increasing efficiency of a blockchain
US11086840B2 (en) 2018-12-07 2021-08-10 Snowflake Inc. Transactional streaming of change tracking data

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01246645A (ja) * 1988-03-29 1989-10-02 Hitachi Ltd ディレイド・ジャーナル・マージ方式
JP2001229063A (ja) * 2000-02-17 2001-08-24 Mitsubishi Electric Corp データ管理システム
WO2008105098A1 (ja) * 2007-02-28 2008-09-04 Fujitsu Limited メモリミラー化制御方法
JP2012069031A (ja) * 2010-09-27 2012-04-05 Nec Corp データベースシステム

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5878414A (en) * 1997-06-06 1999-03-02 International Business Machines Corp. Constructing a transaction serialization order based on parallel or distributed database log files
US6366915B1 (en) * 1998-11-04 2002-04-02 Micron Technology, Inc. Method and system for efficiently retrieving information from multiple databases
JP2001249903A (ja) * 2000-03-07 2001-09-14 Toshiba Corp 情報処理システム
JP4437650B2 (ja) * 2003-08-25 2010-03-24 株式会社日立製作所 ストレージシステム
JP4452533B2 (ja) * 2004-03-19 2010-04-21 株式会社日立製作所 システムおよび記憶装置システム
JP4912973B2 (ja) * 2007-07-11 2012-04-11 株式会社日立製作所 端末及びデータ配信システム
JP4870190B2 (ja) * 2009-04-27 2012-02-08 株式会社日立製作所 データ処理方法、計算機、及びデータ処理プログラム
US8964849B2 (en) * 2011-11-01 2015-02-24 Blackberry Limited Multi-level significance maps for encoding and decoding

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01246645A (ja) * 1988-03-29 1989-10-02 Hitachi Ltd ディレイド・ジャーナル・マージ方式
JP2001229063A (ja) * 2000-02-17 2001-08-24 Mitsubishi Electric Corp データ管理システム
WO2008105098A1 (ja) * 2007-02-28 2008-09-04 Fujitsu Limited メモリミラー化制御方法
JP2012069031A (ja) * 2010-09-27 2012-04-05 Nec Corp データベースシステム

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
D. GAINPAOLO, BEOS: FILE SYSTEM -JISSEN FILE SYSTEM KOCHIKU, 20 November 1999 (1999-11-20), pages 134 - 135 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11734260B2 (en) 2015-08-28 2023-08-22 Hedera Hashgraph, Llc Methods and apparatus for a distributed database within a network
US11797502B2 (en) 2015-08-28 2023-10-24 Hedera Hashgraph, Llc Methods and apparatus for a distributed database within a network
JP2017097639A (ja) * 2015-11-25 2017-06-01 富士通株式会社 データベース制御プログラム、データベース制御装置及びデータベース制御方法
JP2020504927A (ja) * 2016-12-19 2020-02-13 スワールズ,インコーポレイテッド イベントの削除を可能にする分散データベースのための方法および装置
JP7211943B2 (ja) 2016-12-19 2023-01-24 スワールズ,インコーポレイテッド イベントの削除を可能にする分散データベースのための方法および装置
US11657036B2 (en) 2016-12-19 2023-05-23 Hedera Hashgraph, Llc Methods and apparatus for a distributed database that enables deletion of events

Also Published As

Publication number Publication date
GB2537446A (en) 2016-10-19
US20160125018A1 (en) 2016-05-05
US10366075B2 (en) 2019-07-30
JP6152431B2 (ja) 2017-06-21
GB201521129D0 (en) 2016-01-13
DE112014002275T5 (de) 2016-01-28
JPWO2015111152A1 (ja) 2017-03-23

Similar Documents

Publication Publication Date Title
JP6152431B2 (ja) データベース管理システム及び方法
US10977124B2 (en) Distributed storage system, data storage method, and software program
CN105339939B (zh) 对在线热备份数据库的复制
EP2731013B1 (en) Backing up method, device, and system for virtual machine
US9251233B2 (en) Merging an out of synchronization indicator and a change recording indicator in response to a failure in consistency group formation
US8086810B2 (en) Rapid defragmentation of storage volumes
JP6445049B2 (ja) ログの管理方法及び計算機システム
JP6479186B2 (ja) 計算機システム及びデータベース管理方法
US9495253B2 (en) Virtual snapshot system and method
KR100819022B1 (ko) 하나의 타겟 볼륨과 하나의 소스 볼륨 사이의 관계 관리
JPWO2012117534A1 (ja) 計算機システムおよびその制御方法
US20120198150A1 (en) Assigning device adaptors and background tasks to use to copy source extents to target extents in a copy relationship
US11169817B1 (en) Optimizing a boot sequence in a storage system
CN109313593A (zh) 存储系统
US9513840B2 (en) Parallel processes for performing multiple incremental copies
JP6272556B2 (ja) 共有リソース更新装置及び共有リソース更新方法
JP2007323657A (ja) 過渡状態情報を格納するための方法、システムおよびコンピュータ・プログラム
US8850139B2 (en) Changing ownership of cartridges
JP6210501B2 (ja) データベース管理システム、計算機、データベース管理方法
US8738823B2 (en) Quiescing input/output (I/O) requests to subsets of logical addresses in a storage for a requested operation
JP6263673B2 (ja) 計算機システム及びデータベース管理方法
US20220229693A1 (en) Centralized high-availability flows execution framework
EP3690656A1 (en) Method and system for inline deduplication using accelerator pools
WO2016120988A1 (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: 14879379

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2015558634

Country of ref document: JP

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 14894042

Country of ref document: US

ENP Entry into the national phase

Ref document number: 201521129

Country of ref document: GB

Kind code of ref document: A

Free format text: PCT FILING DATE = 20140122

WWE Wipo information: entry into national phase

Ref document number: 1120140022756

Country of ref document: DE

Ref document number: 112014002275

Country of ref document: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14879379

Country of ref document: EP

Kind code of ref document: A1

ENPC Correction to former announcement of entry into national phase, pct application did not enter into the national phase

Ref country code: GB