WO2013046883A1 - トランザクション処理システム、方法及びプログラム - Google Patents

トランザクション処理システム、方法及びプログラム Download PDF

Info

Publication number
WO2013046883A1
WO2013046883A1 PCT/JP2012/068414 JP2012068414W WO2013046883A1 WO 2013046883 A1 WO2013046883 A1 WO 2013046883A1 JP 2012068414 W JP2012068414 W JP 2012068414W WO 2013046883 A1 WO2013046883 A1 WO 2013046883A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
local
global
value
lock
Prior art date
Application number
PCT/JP2012/068414
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 DE112012004099.6T priority Critical patent/DE112012004099T5/de
Priority to GB1407561.8A priority patent/GB2511222A/en
Priority to CN201280045914.9A priority patent/CN103814362B/zh
Priority to JP2013536012A priority patent/JP5940074B2/ja
Publication of WO2013046883A1 publication Critical patent/WO2013046883A1/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/2308Concurrency control
    • G06F16/2336Pessimistic concurrency control approaches, e.g. locking or multiple versions without time stamps
    • G06F16/2343Locking methods, e.g. distributed locking or locking implementation details

Definitions

  • the present invention relates to transaction processing on a distributed processing system, particularly a distributed database system, and more particularly to transaction processing in a key-value store (hereinafter referred to as KVS) method.
  • KVS key-value store
  • Japanese Patent Application Laid-Open No. 2007-188518 relates to a distributed database system using an ownership group, and the step of changing data indicating the ownership of a data item is atomic. ) Is disclosed.
  • a distributed database system generally implements a relational database and uses a SQL-like syntax for queries.
  • KVS Key Value Store
  • the transaction distributed KVS implemented in a simple manner could not realize a global transaction. This is because when one client computer requests two local transactions to two servers and performs one global transaction, the local transaction of the first server in the commit process This is because if the client computer fails after the commit is completed, it cannot be determined whether the local transaction of the second server can be committed.
  • a management map is prepared as a special map on KVS, and the committed value, the value being updated, and the transaction ID being updated are added to the value of the map (data map) that actually stores data.
  • the same function as the two-phase commit is realized on the distributed KVS that supports only the local transaction.
  • Exclusive control for data operation is performed using the transaction ID being updated included in the value of the data map, and the exclusive control mechanism (local exclusive control mechanism) for local transactions provided by KVS is not used.
  • the exclusive control mechanism of the local transaction and the exclusive control mechanism of the global transaction are not linked. And local transactions could not be mixed.
  • the first client computer uses the global transaction to change the value on the first server and the second value.
  • the value on the server can be updated atomically, the first client computer has not acquired the lock of the data being updated on the first server from the local exclusive control mechanism, so the second client computer This is because the value on the first server can be updated by a local transaction.
  • An object of the present invention is to update and query map entries on a plurality of servers in a distributed KVS system that supports only local transactions by linking a local transaction exclusive control mechanism and a global transaction exclusive control mechanism. It is to realize a local transaction that updates and inquires a map entry on one server at a high speed while realizing a distributed transaction (global transaction).
  • the present invention confirms whether or not a map entry to be inquired / updated is being updated as another global transaction during a map entry inquiry / update process permitted by the local exclusive control mechanism as a local transaction,
  • the local transaction being processed is promoted to a global transaction, and the subsequent processing is switched to processing using exclusive control (global exclusive control mechanism) on the global transaction.
  • exclusive control global exclusive control mechanism
  • the system of the present invention reacquires the shared lock acquired from the local exclusive control mechanism during the processing of the local transaction in another local transaction, and acquires the exclusive lock of the acquired map entry in the existing local transaction.
  • the system of the present invention reacquires the shared lock acquired from the local exclusive control mechanism during the processing of the local transaction in another local transaction, and acquires the exclusive lock of the acquired map entry in the existing local transaction.
  • the system of the present invention provides each server with a management map having a transaction ID of the global transaction and its state as a map on the KVS. Distribute.
  • the local exclusive control mechanism solves the conflict between local transactions and global transactions, and the sharing / exclusive lock conflict between local transactions and global transactions.
  • Exclusive lock conflicts are resolved by using the management map, and exclusive / exclusive lock conflicts between local transactions and global transactions are resolved by the local exclusive control mechanism, exclusive / shared lock conflicts between global transactions and local transactions, and The exclusive / exclusive lock conflict is resolved using a management map after the local transaction is promoted to a global transaction.
  • S shared lock acquired during query of global or local transaction
  • Init no access
  • LX local Four lock states are managed: exclusive lock acquired during transaction update
  • GX exclusive lock acquired during global transaction update
  • the first step is to first determine the transaction ID by performing a global transaction start process.
  • the value CURRENT before update, the value DIRTY being updated, and the generated transaction ID are inserted as values into all map entries that are currently acquiring LX locks.
  • another local transaction is started for all map entries that are currently acquiring S locks, and S locks are acquired in duplicate. This is always successful because the S lock has been acquired in the original local transaction.
  • commit the original local transaction Then, the acquired LX lock is promoted to GX lock.
  • it waits for the end of the global transaction that has acquired GX. At the end of the global transaction to be waited for, an attempt is made to acquire an S lock (GX lock) as a global transaction.
  • GX lock S lock
  • a local transaction for updating / querying a map entry on one server is provided by providing a function of promoting a local transaction to a global transaction according to circumstances.
  • a global transaction for updating and querying map entries on a plurality of servers is realized while realizing high speed.
  • FIG. 1 is a schematic diagram showing the entire system for carrying out the present invention.
  • a plurality of client computers 102a, 102b,... 102z access the distributed processing system 106 via the Internet 104 using a protocol such as HTTP.
  • the distributed processing system 106 has a plurality of servers 106a, 106b,..., 106z interconnected by a mechanism such as a LAN or a WAN.
  • the distributed server system 106 is a system for constructing a distributed database with a key-value store (KVS) mechanism. That is, each server 106a, 106b,..., 106z is assigned an ID and is not limited to this method, but preferably a server that holds the key by calculating the mod of the hash value of the key. Is uniquely determined.
  • KVS key-value store
  • the client computers 102a, 102b,... 102z determine the servers 106a, 106b,.
  • one of the servers 106a, 106b,..., 106z is a server called a catalog server, in which keys and other information stored in other servers are stored.
  • the computer 102a, 102b,... 102z once accesses the catalog server, acquires information on which of the servers 106a, 106b,. Establish a connection with.
  • a system in which an arbitrary server accessed by a client computer broadcasts to a plurality of other servers to acquire information can also be used. In the following description, for the sake of convenience, the description starts from the point where the client computer finds the target server and establishes the connection.
  • the client computers 102 a, 102 b,... 102 z generate a unique global transaction ID to access the distributed processing system 106, and then transfer the global transaction ID to transactions with the distributed processing system 106. Is used.
  • the client computer has a main memory 206, a CPU 204, and an IDE controller 208, which are connected to the bus 202.
  • a display controller 214, a communication interface 218, a USB interface 220, an audio interface 222, and a keyboard / mouse controller 228 are connected to the bus 202.
  • a hard disk drive (HDD) 210 and a DVD drive 212 are connected to the IDE controller 208.
  • the DVD drive 212 is used for introducing a program from a CD-ROM or DVD as necessary.
  • a display device 216 having an LCD screen is preferably connected to the display controller 214.
  • the display device 216 displays an application screen through a Web browser.
  • a device such as an extended hard disk can be connected to the USB interface 220 as necessary.
  • a keyboard 230 and a mouse 232 are connected to the keyboard / mouse controller 228.
  • the keyboard 230 is used for inputting key data for search, a password, and the like.
  • the CPU 204 may be, for example, any one based on a 32-bit architecture or a 64-bit architecture, such as Intel Pentium (trademark of Intel Corporation) 4, Core (trademark) 2 Duo, AMD Athlon (trademark), etc. Can be used.
  • Intel Pentium trademark of Intel Corporation
  • Core trademark
  • AMD Athlon trademark
  • the hard disk drive 210 stores at least an operating system and a client-side application program 402a (FIG. 4) for accessing the distributed processing system 106.
  • the operating system is The main memory 206 is loaded.
  • Windows XP a trademark of Microsoft Corporation
  • Windows Vista a trademark of Microsoft Corporation
  • Windows a trademark of Microsoft Corporation
  • Linux a trademark of Linus Torvalds
  • the client-side application program 402a will be described in detail later with reference to the block diagram of FIG. 4 and the flowcharts of FIGS.
  • the communication interface 218 communicates with the distributed processing system 106 via the Internet 104 using the Ethernet (trademark) protocol or the like using a TCP / IP communication function provided by the operating system.
  • FIG. 3 is a schematic block diagram of a hardware configuration of the server 106a and the like in the distributed processing system 106.
  • servers 106 a, 106 a,... 106 z are connected via the Internet 104. Since the servers 106a, 106a,... 106z are basically the same in configuration, the server 106a is representatively shown here.
  • the client computers 102a, 102b... 102z are connected to the communication interface 302 of the server 106a via the Internet 104.
  • the communication interface 302 is further connected to a bus 304, and a CPU 306, a main memory (RAM) 308, and a hard disk drive (HDD) 310 are connected to the bus 304.
  • RAM main memory
  • HDD hard disk drive
  • a keyboard, a mouse, and a display are further connected to the server 106a, and a maintenance person may manage the entire server 106 and perform maintenance work by using these.
  • the hard disk drive 310 of the server 106a stores an operating system.
  • the hard disk drive 310 further includes software such as Apache for causing the server 106a to function as a Web server, Java EE for realizing the Java virtual environment, and an application program described later according to the present invention that operates on the Java virtual environment.
  • 402a is saved and loaded into the main memory 308 to operate when the server 106a is started up.
  • the client computers 102a, 102b,... 102z can access the server 106 using the TCP / IP protocol.
  • the hard disk drive 310 of the server 106a further stores software for realizing KVS such as IBM® WebSphere® eXtreme® Scale.
  • the hard disk drive 310 also stores a KVS transaction processing program 406a (FIG. 4) according to the present invention.
  • the function of the transaction processing program 406a will be described later in detail with reference to the block diagram of FIG. 4 and the flowcharts of FIGS.
  • a server of a model such as IBM (trademark of International Business Machines Corporation) System X, System i, System p, which can be purchased from International Business Machines Corporation is used. be able to.
  • usable operating systems include AIX (trademark of International Business Machines Corporation), UNIX (trademark of The Open Group), Linux (trademark), Windows (trademark) 2003 server, and the like.
  • FIG. 4 shows a schematic block diagram of a processing program in each of the client computers 102a, 102b,... 102z and the servers 106a, 106b,.
  • client computer 102a and the server 106a are shown.
  • An application program 402a on the client computer side is stored in the hard disk drive 210, loaded into the main memory 202 and executed by a predetermined operation of the user of the client computer, and is executed on the server from the client computer.
  • the KVS system has a function of instructing processing such as transaction start, data inquiry, data update, commit, and transaction end.
  • the application program 402a has a function 404a for generating a global transaction ID (TxID) unique to the entire system.
  • TxID global transaction ID
  • One example of a method for generating a global transaction ID is to assign a unique ID to each of the client computers 102a, 102b,... 102z and the servers 106a, 106b,. Each time a transaction is started, the ID of the client computer + the serial number incremented in the client computer is set as the global transaction ID, but the global transaction ID is unique throughout the system. Any method may be used.
  • the application program 402a can access the server 106a by generating a global transaction ID. However, by generating another global transaction ID, the application program 402a accesses a plurality of servers at the same time and processes a plurality of global transactions. can do.
  • the hard disk drive 310 of the server 106a includes a transaction processing program 406a, a KVS program 408a such as IBM® WebSphere® eXtreme® Scale, and a key and a value (VALUE) that are referred to by the KVS program 408a.
  • the transaction processing program 406a and the KVS program 408a are loaded into the main memory 308 and operate when the server 106a is started up.
  • the transaction processing program 406a responds to a request with a transaction ID of a global transaction from the client computer 102a so as to perform operations such as processing involving acquisition of a map entry lock and processing of commit / rollback.
  • the KVS program 408a is controlled, and a management map 412a having an entry including a global transaction ID, a state, and a waiting global transaction ID is preferably created in the main memory 308 and maintained for each server.
  • FIG. 5 is a diagram showing a configuration of a conventional typical KVS.
  • KVS will be described again.
  • data is divided into data 502a, 502b, 502c, and 502d, and is distributed and arranged in a plurality of servers 102a, 102b, 102c, and 102d.
  • the client computer 102b requests transaction processing from one server, it can also request transaction processing from two servers like the client computer 102a.
  • the data are distributed and arranged so as to be disjoint.
  • the server that arranges the data is preferably determined by calculating the mod of the hash value of the key.
  • the client computers 102a and 102b are commands such as begin (start a transaction), put (associate a key and value), get (get a value corresponding to a key), commit (commit, that is, confirm an update), etc. Is sent to the server uniquely determined by the key to request processing.
  • FIG. 6 is a diagram illustrating an example of transaction processing between the client computer 102a and the client computer 102b and the server 106a and the server 106b in a conventional typical KVS system.
  • Tx1, Tx2, and Tx3 are transaction IDs of local transactions, respectively.
  • client 1, client computer 102a performs a put (K1, U1) on the data map for server 1, server 106a, and then the data map for server 2, server 106b. After executing get (K4) for, instruct to execute put (K3, U3) for the data map, then instruct server 1 to execute commit, and execute commit to server 1 Instruct.
  • the client 2 that is, the client computer 102b, sequentially performs the process of put (K2, U2), get (K5), put (K1, U1 '), and commit on the data map to the server 1.
  • the shared lock is held by the local transaction
  • the exclusive lock is the global value that is acquiring the exclusive lock, along with the committed value (CURRENT) and the value being updated (DIRTY) before the update. It is held as a value [CURRENT-> DIRTY, LOCK] of the map entry including the transaction ID (LOCK) of the transaction.
  • the map entry will be composed of the KEY column, VALUE column, and LOCK column.
  • the VALUE column contains CURRENT and DIRTY values (CURRENT-> DIRTY), and the LOCK column contains LOCK values. Is stored.
  • Tx1-1, Tx1-2, Tx2-1, Tx2-2, Tx2-3, GTX1-1, GTx1-2 are transaction IDs of local transactions, and GTx1, GTx2 are global This is the transaction ID of the transaction.
  • the local transactions indicated by Tx1-1, Tx1-2, GTx1-1, and GTx1-2 are local transaction processes for processing the global transaction indicated by GTx1.
  • the local transaction GTx1-1 first instructs the server 3 (server 106c) to commit to the management map after put (GTxA, working).
  • the client 1 instructs the server 1 (server 106a) to commit to the data map after put (K1, V1-> U1, GTxA).
  • the client 1 instructs the server 2 (server 106b) to execute get (K4) on the data map in the local transaction Tx2-1.
  • the client 1 executes the put (K3, V3-> U3, GTxA) on the data map in the local transaction Tx2-2 and instructs the server 2 to commit.
  • the client 1 instructs the server 3 to commit after put (GTxA, committed) to the management map.
  • client 1 executes put (K1, U1, NULL) on the data map in local transaction Tx1-2 and instructs server 1 to commit.
  • client 1 instructs server 2 to commit using local transaction Tx2-1.
  • the client 1 instructs the server 2 to commit after put (K1, U3, NULL) to the data map in the local transaction Tx2-3.
  • the client 2 that is, the client computer 102b, performs a local transaction Tx3 to the server 1 and put (K2, U2, NULL), get (K5), put (K1, U1) to the data map. ', NULL), instruct to execute commit.
  • the client 1 can update the values of K1 and K3 atomically, but the client 2 must not update the value of K1 in a local transaction. This is because the client 1 does not hold the lock of the local exclusive control mechanism on the server 1 with respect to the map entry of K1 being updated, so that the client 2 can update the data for the value of K1.
  • the global transaction processing since client 1 has entered GTxA as the LOCK value, it should not be updated. To prevent this, all transactions must be global transactions, but global transactions implemented by multiple local transactions have more overhead than local transactions, which reduces overall system performance. End up.
  • FIG. 8 shows the configuration of the present invention.
  • the reference numbers here correspond to the functional block diagram of FIG. That is, management maps 412a, 412b, 412c, and 412d having columns of transaction IDs (TxID) and transaction states are separately provided for the servers 106a, 106b, 106c, and 106d, respectively. Therefore, the transaction status is stored in the VALUE column.
  • TxID transaction IDs
  • Each server 106a, 106b, 106c, 106d is also provided with tables (data maps) 410a, 410b, 410c, 410d for storing KVS data.
  • Each of the data maps 410a, 410b, 410c, and 410d includes a KEY column that is a column for storing a key, a VALUE column that is a column for storing a committed value and a value being updated, and a lock state, that is, a transaction being updated. It has a LOCK column that stores the ID.
  • Each server 106a, 106b, 106c, 106d manages the four lock states for each map entry using the KVS transaction mechanism in the data maps 410a, 410b, 410c, 410d.
  • the four lock states are S (global transaction or local transaction is querying), Init (no access), LX (local transaction is updating), GX (global transaction is updating), 4
  • the two lock states transition according to the transition diagram of FIG.
  • a client computer 102a that requests a global transaction requests processing of a plurality of local transactions
  • a client computer 102b that requests a local transaction requests processing of a single local transaction
  • each of the servers 106a, 106b, 106c, and 106d has a local exclusive control mechanism, and the management maps 412a, 412b, 412c, and 412d are arranged on the servers 106a, 106b, 106c, and 106d, respectively.
  • Local exclusive control mechanism resolves local transaction-to-local transactions, global transaction-to-local transactions and global transaction sharing / exclusive lock conflicts, and global transaction-exclusive / exclusive lock conflicts are resolved using a management map.
  • the local exclusive control mechanism resolves the exclusive / exclusive lock conflict between the local transaction and the global transaction, and the exclusive / shared lock conflict between the global transaction and the local transaction.
  • Fine exclusive-exclusive lock conflict is solved by using a map for the management after promoted a local transaction in the global transaction.
  • a shared lock is issued when Get is requested, an exclusive lock is issued when Put is requested, and an exclusive lock is issued when GetForUpdate is requested, to the client requesting the requested local transaction.
  • S global transaction or local transaction is querying
  • Init no access
  • LX local transaction is updating
  • GX global transaction is updating
  • the local transaction When the local transaction requests an S lock, the local transaction is started, and inquiry processing (Get) is performed. After confirming that it is not GX, inquiry processing is performed. In the case of GX, the local transaction is promoted to a global transaction, and as a global transaction, it waits for the end of the global transaction being updated. Then, S is requested as the global transaction.
  • inquiry processing Get
  • GX the local transaction is promoted to a global transaction, and as a global transaction, it waits for the end of the global transaction being updated. Then, S is requested as the global transaction.
  • the local transaction requests an LX lock
  • start the local transaction perform an inquiry process (GetForUpdate) with acquisition of an exclusive lock, and perform an update process after confirming that it is not a GX.
  • GetForUpdate the local transaction is promoted to a global transaction, waits for the end of the global transaction being updated, and then requests GX as a global transaction.
  • a global transaction requests a GX lock
  • start a local transaction and use GetForUpdate on the data map to confirm that it is Init, then the DIRTY and LOCK columns of the VALUE column in the map entry Update processing and commit the local transaction.
  • For GX commit the local transaction and wait for the end of the global transaction being updated.
  • a transaction ID may be abbreviated as TxID, a local transaction as LocalTx, and a global transaction as GlobalTx.
  • FIG. 10 is a diagram showing a flowchart of processing at the time of processing at the time of the first inquiry / update of a transaction.
  • step 1002 in response to a request from a transaction, for example, once accessing the catalog server, the server is specified based on the key to be inquired / updated.
  • the server ID is specified by a remainder value obtained by dividing the hash value of the key by the number of servers.
  • step 1004 the identified server starts a local transaction.
  • step 1006 the identified server queries the value corresponding to the key, and in step 1008, it is determined whether there is any other transaction ID in the LOCK column of the queried map entry. After being promoted, the query processing is performed as a global transaction. Specific processing for promotion to a global transaction will be described later with reference to the flowchart of FIG.
  • step 1012 If it is determined in step 1008 that there is no other transaction ID in the LOCK column of the queried value, it is determined in step 1012 whether or not it is a query process. If not, an update process is performed as a local transaction in step 1014.
  • LOCK is a value in the LOCK column of the data table 410a,.
  • FIG. 11 is a diagram showing a flowchart of processing at the time of processing at the time of inquiry / update after the second transaction.
  • step 1102 it is determined whether the transaction is operating as a global transaction. If so, in step 1104, a query / update process is performed as a global transaction.
  • the server is specified based on the key to be queried and updated by, for example, accessing the catalog server once.
  • the server ID is specified by a remainder value obtained by dividing the hash value of the key by the number of servers.
  • step 1108 it is determined whether or not the server is the same as the previous one. If so, in step 1110, the specified server queries the value corresponding to the key. At this time, in the case of an update process, the inquiry is accompanied by an exclusive lock (GetForUpdate).
  • step 1112 the identified server determines whether there is another transaction ID (TxID) in the lock of the inquired value. If so, in step 1114, after being promoted to a global transaction, a query process is performed as a global transaction.
  • TxID transaction ID
  • step 1112 If it is determined in step 1112 that there is no other transaction ID in the lock of the inquired value, it is determined in step 1116 whether or not it is an inquiry process. If not, an update process is performed as a local transaction in step 1118.
  • step 1114 after being promoted to a global transaction, a query process is performed as a global transaction.
  • FIG. 12 is a flowchart of the global transaction start process.
  • step 1202 a transaction ID that is an identifier of a global transaction is generated in the client.
  • the server is specified based on the transaction ID.
  • the server ID is specified by a remainder value obtained by dividing the hash value of the transaction ID by the number of servers.
  • step 1206 a management local transaction is started on the identified server.
  • step 1208 an exclusive lock of the map entry using the transaction ID as a key is acquired in the management local transaction.
  • FIG. 13 is a diagram showing a flowchart of processing for promoting a local transaction to a global transaction.
  • step 1302 a global transaction with the transaction ID as an identifier is started.
  • step 1304 a local transaction for inquiry is started on the server that is processing the local transaction.
  • step 1306 all values being queried in the local transaction, that is, acquiring the S lock, are queried in the local transaction for inquiry.
  • step 1308 all values being updated in the local transaction, that is, acquiring the LX lock are the value before updating (CURRENT), the value being updated (DIRTY), and the transaction ID (LOCK) acquiring the exclusive lock. Update to the value [CURRENT-> DIRTY, LOCK] that is a combination of.
  • the LOCK value is a value in the LOCK column of the data table 410a,.
  • step 1310 the original local transaction is committed.
  • the acquired LX lock is promoted to GX lock. Note that the local query transaction is not committed at this point.
  • FIG. 14 is a flowchart of the global transaction inquiry process.
  • a server is identified based on the key.
  • the server ID is specified by a remainder value obtained by dividing the hash value of the key by the number of servers.
  • step 1404 a local transaction for inquiry is started on the identified server.
  • step 1406 the value corresponding to the key is queried in the local transaction for inquiry.
  • step 1408 it is determined whether or not there is another transaction ID in the inquired LOCK value. If so, a waiting process for the other transaction ID is performed in step 1410, and the process returns to step 1402.
  • FIG. 15 is a flowchart of the global transaction update process.
  • a server is identified based on the key.
  • the server ID is specified by a remainder value obtained by dividing the hash value of the key by the number of servers.
  • step 1504 an update local transaction is started on the identified server.
  • step 1506 the value corresponding to the key is queried in the local transaction for update.
  • step 1508 it is determined whether there is another transaction ID in the LOCK value of the inquired value. If so, standby processing for the other transaction ID is performed in step 1510, and the process returns to step 1502.
  • step 1512 the value before updating (CURRENT), the value being updated (DIRTY), and the transaction ID that is acquiring the exclusive lock in the local transaction for update ( TxID) is updated to the combined value [CURRENT-> DIRTY, TxID].
  • step 1514 the update local transaction is committed.
  • FIG. 16 is a flowchart of the global transaction commit process.
  • the corresponding server updates the value with the transaction ID of the management map as a key to “Committed” in the management local transaction.
  • step 1604 the server commits the management local transaction.
  • step 1606 it is determined whether or not the commit is successful. If not, rollback is performed in step 1608.
  • step 1610 all the queries are committed.
  • step 1612 it is determined whether or not all VALUEs being updated have been selected. If so, the process ends.
  • the server is specified based on the key.
  • the server ID is specified by a remainder value obtained by dividing the hash value of the key by the number of servers.
  • step 1618 an update local transaction is started on the identified server.
  • step 1620 the value corresponding to the key is queried in the update local transaction.
  • step 1622 it is determined whether or not the queried value is [CURRENT-> DIRTY, TxID]. If so, in step 1624, the value corresponding to the key is updated to [DIRTY, NULL] in the update local transaction. In step 1626, the update local transaction is committed, and the process returns to step 1612.
  • step 1622 If it is determined in step 1622 that the inquired value is not [CURRENT-> DIRTY, TxID], the update local transaction is immediately committed in step 1626 and the process returns to step 1612.
  • FIG. 17 is a diagram showing a flowchart of global transaction standby processing using the transaction ID “TxID” as an identifier.
  • Step 1702 is a local transaction for management, and a process of updating the value with transaction ID TxID as a key to [Waiting, TxID '] is performed.
  • step 1704 the management local transaction is committed.
  • step 1706 it is determined whether or not the commit is successful. If not, rollback is performed in step 1708.
  • step 1710 the server is specified based on TxID ′. This is determined, for example, by a value obtained by dividing the hash value of TxID ′ by the number of servers.
  • step 1712 a standby local transaction is started on the identified server.
  • step 1714 the value of TxID 'is queried in the management map in the standby local transaction.
  • step 1716 it is determined whether the value of TxID 'is Committed or Rollbacked. If Committed, the server is identified based on TxID in step 1718. The value to be updated to Working, and the process ends.
  • TxID ' If the value of TxID 'is Rollbacked, it is determined in step 1722 whether TxID is included in the value of TxID'. If not, the process proceeds to rollback processing in step 1724.
  • step 1722 If it is determined in step 1722 that TxID is included in the value of TxID ′, the standby local transaction is committed in step 1726, then the server is identified based on TxID in step 1728, and then At 1730, a management local transaction is initiated at the identified server.
  • step 1732 the TxID 'global transaction waiting process is started.
  • FIG. 18 is a flowchart of the global transaction end process.
  • step 1802 using the local transaction started at the start of the global transaction, the value for the map entry indicating the state of the global transaction is updated to Committed or Rollbacked, and the commit is performed.
  • step 1804 a branch is made depending on whether the state of the global transaction is Committed or Rollbacked.
  • step 1806 all the map entries updated in the global transaction are stored in the VALUE column. Processing to update CURRENT-> DIRTY to DIRTY and delete the LOCK column (local commit) is performed. If Rollbacked, in step 1808, all map entries updated in the global transaction are updated in the VALUE column. Processing to delete the DIRTY and LOCK columns (local rollback) is performed.
  • each map entry remains in the GX state. Then, the local transaction corresponding to the map entry indicating the global transaction state of the management map is rolled back by the server, and the state is not saved. Next time, the transaction that inquires and updates the map entry can confirm that the transaction has been rolled back by confirming the management map. If the rollback has been completed, the local rollback processing is performed by the transaction that has confirmed that the rollback has been completed.
  • each map entry remains in the GX state.
  • the transaction that inquires and updates the map entry can confirm that it has been committed by checking the management map. If it has been committed, the local commit process is performed by the transaction that has confirmed that it has been committed.
  • the local transaction Tx1-1 of the client 1 instructs the server 1 (server 106a) to execute put (K1, V1-> U1, GTxA), and then instructs to commit.
  • the local transaction Tx2-1 of the client 1 instructs the server 2 (server 106b) to execute put (K3, V3-> U3, GTxA), and then instructs to commit.
  • the local transaction Tx1-2 of the client 1 instructs the server 1 to execute put (GTx1, committed), and then commits.
  • the global transaction GTxA-1 of the client 1 instructs the server 3 to execute put (GTxA, committed), and then instructs to commit.
  • the local transaction Tx3 of the client 2 (client computer 102b) tries to execute GetForUpdate (K1) on the server 1.
  • the processing is divided into a case where an exclusive lock is not acquired by another global transaction and a case where an exclusive lock is acquired by another global transaction.
  • Tx3-1 GetForUpdate (K2) Tx3-2 '. Put (K2, U2, NULL) Tx3-3 '. Get (K5) Tx3-4 '. GetForUpdate (K1) Tx3-5 '. Put (K1, U1', NULL) Tx3-6 '. Commit

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)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

分散KVSシステムにおいて、他のグローバル・トランザクションがロック中のマップ・エントリを、ローカル・トランザクションが照会・更新する際、そのローカル・トランザクションをグローバル・トランザクションに昇格させるため、クライアント・コンピュータにおいて、トランザクションIDを確定してグローバル・トランザクションを開始するステップと、複数のサーバのうちローカル・トランザクションを処理しているサーバで、照会用ローカル・トランザクションを開始するステップと、前記ローカル・トランザクションで照会中の全ての値を前記照会用ローカル・トランザクションで照会するステップと、前記ローカル・トランザクションで更新中の全ての値を、前記データ・テーブルにおいて、更新前の値と更新中の値と、前記トランザクションIDを値とするロック値の組み合わせに更新するステップと、前記ローカル・トランザクションをコミットするステップとを実行する。

Description

トランザクション処理システム、方法及びプログラム
 この発明は、分散処理システム、特に分散データベース・システム上でのトランザクションの処理に関し、より詳しくは、キー・バリュー・ストア(Key Value Store、以下KVSと称する)方式におけるトランザクションの処理に関するものである。
 分散データベース・システムは周知であり、例えば、特開2007-188518号公報は、オーナーシップグループを用いる分散データベース・システムに関し、データ項目のオーナーシップを示すデータを変更するステップを、不可分(atomic、アトミック)の動作とすることを開示する。
 分散データベース・システムは一般に、リレーショナル・データベースを実装し、問い合わせにSQLのような構文を用いる。
 最近になって、キー(key)とバリュー(value)の組を書き込み、キーを指定することでバリューを読み出すことができる、キー・バリュー・ストア(KVS)と呼ばれるデータベース管理ソフトウェアが使われるようになってきた。KVSの特徴は、問い合わせがシンプルであるため検索が高速であり、使用するサーバの台数が増えるほど性能を高めることができるというケーラビリティに優れる。そこで、複数台のサーバにデータを分散させることができる分散KVSも実装されている。
 さて、一般に分散データベース・システムでは、2フェーズ・コミットを利用した分散トランザクションが処理される。各リソース・マネージャとトランザクション・モニターがトランザクションの状態を管理し、複数の分散されたリソースに跨ったトランザクションが実現される。しかしながら、KVSでこのような機構を導入する場合、KVS本来が持っているシンプルな属性が失われるため、管理の利便性、スケーラビリティが損なわれることになる。よって、特表2009-525536号公報に開示されているように、分散ロック・マネジャを使用して、グローバル・トランザクションを実現する技法を分散KVSに適用することは好ましくない。そのため、一般的な分散KVSでは、各サーバ内でのトランザクション(ローカル・トランザクション)のみをクライアントが要求可能であり、複数のサーバが管理するデータに関するトランザクション処理に関しては、ローカル・トランザクションを組み合わせて分散トランザクション(グローバル・トランザクション)を実現することが求められる。
 しかし、素朴に実装されたトランザクション分散KVSでは、グローバル・トランザクションを実現することができなかった。というのは、1台のクライアント・コンピュータが2台のサーバに対して2つのローカル・トランザクションを要求し、1つのグローバル・トランザクションを行っているとき、コミット処理において、第1のサーバのローカル・トランザクションがコミットを終了した後、クライアント・コンピュータに障害が発生すると、第2のサーバのローカル・トランザクションがコミットしてよいのかどうか判断できなくなるためである。
 そこで、「オープンソース徹底活用 Slim3 on Google App Engine for Java」ひがやすお・小川信一著、秀和システム、p.241-251には、Google App Engineでグローバル・トランザクションを実現する方法が開示されている。この方法では、KVS上の特別のマップとして管理用マップを用意し、実際にデータを格納するマップ(データ・マップ)の値に、コミット済みの値、更新中の値、更新中のトランザクションIDを含ませ、管理用のマップにトランザクションの状態を管理させることで、2フェーズ・コミットと同機能を、ローカル・トランザクションのみをサポートする分散KVS上で実現する。データ操作に対する排他制御は、データ・マップの値に含まれる更新中のトランザクションIDを利用して行われ、KVSが提供するローカル・トランザクション用の排他制御機構(ローカル排他制御機構)は利用しない。
 このように従来知られている技術で、分散KVS上のグローバル・トランザクションを実現しようとすると、ローカル・トランザクションの排他制御機構と、グローバル・トランザクションの排他制御機構が連動していないため、グローバル・トランザクションとローカル・トランザクションを混在させることができなかった。例えば、第1のクライアント・コンピュータが2台のサーバが管理する値に対して更新を行っているとき、第1のクライアント・コンピュータはグローバル・トランザクションにより、第1のサーバ上の値と第2のサーバ上の値をアトミックに更新可能であるが、第1のクライアント・コンピュータは第1のサーバ上で更新中のデータのロックをローカル排他制御機構より獲得していないため、第2のクライアント・コンピュータがローカル・トランザクションにより、第1のサーバ上の値を更新できてしまうからである。
 よって、従来知られている技術ではローカル・トランザクションで間に合うような処理でも、グローバル・トランザクションにより実行する必要があり、グローバル・トランザクションはローカル・トランザクションよりもオーバーヘッドが大きいので、処理速度が低下するという問題があった。
特開2007-188518号公報 特表2009-525536号公報
「オープンソース徹底活用 Slim3 on Google App Engine for Java」ひがやすお・小川信一著、秀和システム、p.241-251
 この発明の目的は、ローカル・トランザクションの排他制御機構と、グローバル・トランザクションの排他制御機構を連動させ、ローカル・トランザクションのみをサポートする分散KVSシステムにおいて、複数のサーバ上のマップ・エントリを更新・照会する分散トランザクション(グローバル・トランザクション)を実現しつつ、1台のサーバ上のマップ・エントリを更新・照会するローカル・トランザクションを高速に実現することにある。
 本発明は、ローカル・トランザクションとしてローカル排他制御機構により許可されたマップ・エントリの照会・更新処理の際に、照会・更新するマップ・エントリが他グローバル・トランザクションとして更新中か否かを確認し、更新中の場合は、処理中のローカル・トランザクションをグローバル・トランザクションに昇格させ、以降の処理をグローバル・トランザクション上の排他制御(グローバル排他制御機構)を利用する処理に切り替えることによって、ローカル・トランザクションとグローバル・トランザクション間の排他制御を実現することにより、上記課題を解決する。
 すなわち、本発明のシステムは、ローカル・トランザクションの処理中にローカル排他制御機構より獲得した共有ロックを別ローカル・トランザクションで再取得し、獲得したマップ・エントリの排他ロックを、既存のローカル・トランザクションでグローバル・トランザクション用にマップ・エントリを修正することによって、グローバル排他制御機構の排他ロックに切り替え、グローバル・トランザクションに昇格させる。
 この目的のため、本発明のシステムは、グローバル・トランザクションの状態を管理するため、各サーバに、グローバル・トランザクションのトランザクションIDとその状態を対でもつ、管理用マップを、KVS上のマップとして、分散配置する。こうして管理用マップを配置しておくことで、ローカル・トランザクション同士及びグローバル・トランザクション同士及びローカル・トランザクションとグローバル・トランザクションの共有・排他ロック衝突はローカル排他制御機構が解決し、グローバル・トランザクション同士の排他・排他ロック衝突は管理用マップを用いて解決し、ローカル・トランザクションとグローバル・トランザクションの排他・排他ロック衝突はローカル排他制御機構が解決し、グローバル・トランザクションとローカル・トランザクションの排他・共有ロック衝突及び排他・排他ロック衝突は、ローカル・トランザクションをグローバル・トランザクションに昇格後に管理用マップを利用して解決する。
 本発明によれば、マップ・エントリ毎に、KVSのトランザクション機構を利用して、S(グローバル・トランザクションまたはローカル・トランザクションの照会中に獲得する共有ロック)、Init(アクセスなし)、LX(ローカル・トランザクションの更新中に獲得する排他ロック)、GX(グローバル・トランザクションの更新中に獲得する排他ロック)という4つのロック状態が管理される。
 そして本発明によれば、あるマップ・エントリに対するSロック(LXロック)獲得試行時、他のグローバル・トランザクションによってそのマップ・エントリに対するロックがGXであることが認識された場合、ローカル・トランザクションからグローバル・トランザクションへの昇格処理が開始される。
 最初のステップは、グローバル・トランザクションの開始処理を行うことで、先ずトランザクションIDを確定する。
 次に、現在LXロックを獲得中の全マップ・エントリに対して、更新前の値CURRENTと更新中の値 DIRTYと、生成したトランザクションIDを値として挿入する。
 次に、現在Sロックを獲得中の全マップ・エントリに対し、別のローカル・トランザクションを起動し、重複してSロックを獲得する。このとき、元のローカル・トランザクションでSロックを獲得済みのため、これは必ず成功する。
 次に、元のローカル・トランザクションをコミットする。すると、獲得していたLXロックは、GXロックに昇格する。
 次に、GXを獲得しているグローバル・トランザクションの終了を待機する。
 待機対象のグローバル・トランザクションの終了後、グローバル・トランザクションとしてSロック(GXロック)の獲得を試行する。
 この発明によれば、分散KVSシステムにおいて、ローカル・トランザクションを場合に応じてグローバル・トランザクションに昇格させる機能を提供することによって、1台のサーバ上のマップ・エントリを更新・照会するローカル・トランザクションを高速に実現しつつ、複数のサーバ上のマップ・エントリを更新・照会するグローバル・トランザクションが実現される。
本発明の実施するためのシステム全体の概要図である。 クライアント・コンピュータのハードウェアの概要ブロック図である。 サーバのハードウェアの概要ブロック図である。 クライアント・コンピュータとサーバにおける機能ブロック図である。 従来のKVSシステムの概要を示す図である。 従来のKVSシステムの処理の例を示す図である。 グローバル・トランザクションを実行する従来のKVSシステムの処理の例を示す図である。 本発明のKVSシステムの概要を示す図である。 ロックの状態遷移を示す図である。 トランザクションの最初の照会・更新時の処理のフローチャートを示す図である。 トランザクションの2回目以降の照会・更新時の処理のフローチャートを示す図である。 グローバル・トランザクションの開始処理のフローチャートを示す図である。 ローカル・トランザクションからグローバル・トランザクションに昇格させる処理のフローチャートを示す図である。 グローバル・トランザクションの照会処理のフローチャートを示す図である。 グローバル・トランザクションの更新処理のフローチャートを示す図である。 グローバル・トランザクションのコミット処理のフローチャートを示す図である。 グローバル・トランザクションの待機処理のフローチャートを示す図である。 グローバル・トランザクションの終了処理のフローチャートを示す図である。 本発明のKVSシステムの動作の例を示す図である。
 以下、図面を参照して、本発明の実施例を説明する。特に断わらない限り、同一の参照番号は、図面を通して、同一の対象を指すものとする。また、以下で説明するのは、本発明の一実施形態であり、この発明を、この実施例で説明する内容に限定する意図はないことに留意されたい。
 図1は、本発明の実施するためのシステムの全体を示す概要図である。図1において、複数のクライアント・コンピュータ102a、102b・・・102zは、インターネット104を介して、HTTPなどのプロトコルにより、分散処理システム106にアクセスする。
 分散処理システム106は、LANまたはWANなどの仕組みにより相互接続された複数のサーバ106a、106b、・・・、106zをもつ。分散サーバ・システム106は、キー・バリュー・ストア(KVS)の仕組みで、分散データベースを構築するシステムである。すなわち、各サーバ106a、106b、・・・、106zにはIDが付与され、この方式には限定されないが、好適には、キーのハッシュ値のmodを計算することで、そのキーを保持するサーバが一意的に決まる。
 従って、クライアント・コンピュータ102a、102b・・・102zは、照会するキーで、アクセスするサーバ106a、106b、・・・、106zが決定される。好適には、サーバ106a、106b、・・・、106zのうちの一台がカタログ・サーバと呼ばれるサーバで、そこには、他のサーバに格納されているキーその他の情報が格納され、クライアント・コンピュータ102a、102b・・・102zは、カタログ・サーバに一旦アクセスして、サーバ106a、106b、・・・、106zのうちのどのサーバにアクセスするかの情報を取得してから、指示されたサーバとの接続を確立する。あるいは、クライアント・コンピュータがアクセスした任意のサーバが他の複数のサーバにブロードキャストして、情報を取得する方式も使用できる。以下での説明では便宜上、クライアント・コンピュータが、目的とするサーバを見つけて接続を確立したところから説明する。
 クライアント・コンピュータ102a、102b・・・102zは、分散処理システム106にアクセスするために、一意的なグローバル・トランザクションIDを生成して、その後の分散処理システム106とのトランザクションに、そのグローバル・トランザクションIDを使用する。
 次に、図2を参照して、図1で参照番号102a、102b・・・102zのように示されているクライアント・コンピュータのハードウェア構成について、説明する。図2において、クライアント・コンピュータは、主記憶206、CPU204、IDEコントローラ208をもち、これらは、バス202に接続されている。バス202には更に、ディスプレイ・コントローラ214と、通信インターフェース218と、USBインターフェース220と、オーディオ・インターフェース222と、キーボード・マウス・コントローラ228が接続されている。IDEコントローラ208には、ハードディスク・ドライブ(HDD)210と、DVDドライブ212が接続されている。DVDドライブ212は、必要に応じて、CD-ROMやDVDから、プログラムを導入するために使用する。ディスプレイ・コントローラ214には、好適には、LCD画面をもつディスプレイ装置216が接続されている。ディスプレイ装置216には、Webブラウザを通じて、アプリケーションの画面が表示される。
 USBインターフェース220には、必要に応じて、拡張ハードディスクなどのデバイスを接続をすることができる。
 キーボード・マウス・コントローラ228には、キーボード230と、マウス232が接続されている。キーボード230は、検索のためのキーデータや、パスワードなどを打ち込むために使用される。
 CPU204は、例えば、32ビット・アーキテクチャまたは64ビット・アーキテクチャに基づく任意のものでよく、インテル社のPentium(インテル・コーポレーションの商標)4、Core(商標)2 Duo、AMD社のAthlon(商標)などを使用することができる。
 ハードディスク・ドライブ210には、少なくとも、オペレーティング・システムと、、分散処理システム106にアクセスするためのクライアント側のアプリケーション・プログラム402a(図4)が格納されており、システムの起動時に、オペレーティング・システムは、メインメモリ206にロードされる。オペレーティング・システムは、Windows XP(マイクロソフト・コーポレーションの商標)、Windows Vista(マイクロソフト・コーポレーションの商標)、Windows(マイクロソフト・コーポレーションの商標) 7、Linux(Linus Torvaldsの商標)などを使用することができる。クライアント側のアプリケーション・プログラム402aは、図4のブロック図や、図9~図14のフローチャートを参照して、後で詳細に説明する。
 通信インターフェース218は、オペレーティング・システムが提供するTCP/IP通信機能を利用して、イーサネット(商標)・プロトコルなどにより、インターネット104を介して、分散処理システム106と通信する。
 図3は、分散処理システム106における、サーバ106aなどのハードウェア構成の概要ブロック図である。図示されているように、インターネット104を介して、サーバ106a、106a、・・・106zが接続されている。サーバ106a、106a、・・・106zは基本的に同一の構成なので、ここでは代表的にサーバ106aを示す。図3に示すように、クライアント・コンピュータ102a、102b・・・102zは、インターネット104を経由して、サーバ106aの通信インターフェース302に接続される。通信インターフェース302はさらに、バス304に接続され、バス304には、CPU306、主記憶(RAM)308、及びハードディスク・ドライブ(HDD)310が接続されている。
 図示しないが、サーバ106aにはさらに、キーボード、マウス、及びディスプレイが接続され、これらによって、保守担当者が、サーバ106全体の管理やメンテナンス作業を行うようにしてもよい。
 サーバ106aのハードディスク・ドライブ310には、オペレーティング・システムが保存されている。
 ハードディスク・ドライブ310にはさらに、サーバ106aをWebサーバとして機能させるためのApacheなどのソフトウェア、及びJava仮想環境を実現するJava EE、及びJava仮想環境上で動作する本発明に係る後述するアプリケーション・プログラム402aが保存され、サーバ106aの立ち上げ時に、主記憶308にロードされて、動作する。これによって、クライアント・コンピュータ102a、102b・・・102zが、TCP/IPのプロトコルで、サーバ106にアクセスすることが可能となる。
 サーバ106aのハードディスク・ドライブ310にはさらに、IBM(R) WebSphere eXtreme ScaleなどのKVSを実現するためのソフトウェアが保存されている。ハードディスク・ドライブ310にはまた、本発明に従う、KVS用のトランザクション処理プログラム406a(図4)が保存されている。このトランザクション処理プログラム406aの機能については、図4のブロック図や、図9~図14のフローチャートを参照して、後で詳細に説明する。
 尚、上記サーバ106aとして、インターナョナル・ビジネス・マシーンズ・コーポレーションから購入可能な、IBM(インターナョナル・ビジネス・マシーンズ・コーポレーションの商標)System X、System i、System pなどの機種のサーバを使うことができる。その際、使用可能なオペレーティング・システムは、AIX(インターナョナル・ビジネス・マシーンズ・コーポレーションの商標)、UNIX(The Open Groupの商標)、Linux(商標)、Windows(商標)2003 Serverなどがある。
 図4は、クライアント・コンピュータ102a、102b・・・102zと、サーバ106a、106b、・・・106zの各々における、処理プログラムの概要ブロック図を示す。なおここでは代表的に、クライアント・コンピュータ102aとサーバ106aを示す。
 クライアント・コンピュータ側のアプリケーション・プログラム402aは、ハードティスク・ドライブ210に保存されており、クライアント・コンピュータのユーザーの所定の操作で主記憶202にロードされて実行され、クライアント・コンピュータから、サーバ上にあるKVSシステムに対して、トランザクションの開始、データの照会、データの更新、コミット、トランザクションの終了などの処理を指示する機能をもつ。
 アプリケーション・プログラム402aは、システム全体で一意的なグローバル・トランザクションID(TxID)を生成する機能404aをもつ。グローバル・トランザクションIDの生成方法の1つの例は、クライアント・コンピュータ102a、102b・・・102zと、サーバ106a、106b、・・・106zの各々に固有のIDを付与しておき、各クライアント・コンピュータでトランザクションを開始する度に、そのクライアント・コンピュータのID+クライアント・コンピュータ内の増分される通し番号をグローバル・トランザクションIDとすることであるが、システム全体で一意的なグローバル・トランザクションIDになるようにする任意の方法を使用してもよい。
 アプリケーション・プログラム402aは、グローバル・トランザクションIDを生成してサーバ106aにアクセスすることができるが、別グローバル・トランザクションIDを生成することにより、同時に複数のサーバにアクセスし、複数のグローバル・トランザクションを処理することができる。
 サーバ106aのハードティスク・ドライブ310には、トランザクション処理プログラム406aと、例えばIBM(R) WebSphere eXtreme ScaleであるKVSプログラム408aと、KVSプログラム408aによって参照される、キー(KEY)とバリュー(VALUE)のペアが保存され、トランザクション処理プログラム406aとKVSプログラム408aは、サーバ106aのスタートアップ時に、主記憶308にロードされて動作する。
 トランザクション処理プログラム406aは、クライアント・コンピュータ102aからの、グローバル・トランザクションのトランザクションIDを伴うリクエストに応答して、マップ・エントリのロック獲得を伴う処理、コミット・ロールバックの処理などの動作を行うようにKVSプログラム408aを制御するとともに、好適には主記憶308に、グローバル・トランザクションIDと、状態と、待ちグローバル・トランザクションIDを含むエントリをもつ管理用マップ412aを作成して、サーバ毎に維持する。
 さて、本発明に従うKVSシステムの構成と動作を説明する前に、従来の典型的ないくつかのKVSシステムの構成と動作を説明する。これらを参照することにより、本発明に従うシステムの特徴がより明らかになるものと思量する。
 図5は、従来の典型的なKVSの構成を示す図である。ここで改めてKVSについて説明すると、図示されているように、データはデータ502a、502b、502c、502dのように分割され、複数のサーバ102a、102b、102c、102dに分散して配置される。クライアント・コンピュータ102bは、1台のサーバに対して、トランザクション処理を要求するが、クライアント・コンピュータ102aのように、2台のサーバに対してトランザクション処理を要求することもできる。このとき、互いに素(disjoint)になるように、データは分散配置されている。データを配置するサーバは、好適には、キーのハッシュ値のmodを計算することで決定される。
 クライアント・コンピュータ102a、102bは、begin(トランザクションを開始する)、put(キーとバリューを対応付ける)、get(キーに対応するバリューを取得する)、commit(コミット、すなわち更新を確定する)などのコマンドを、キーによって一意的に決まるサーバに送って処理を要求する。
 図6は、従来の典型的なKVSシステムにおける、クライアント・コンピュータ102a、クライアント・コンピュータ102bと、サーバ106a、サーバ106bの間のトランザクション処理の例を示す図である。Tx1、Tx2、Tx3はそれぞれ、ローカル・トランザクションのトランザクションIDである。この例では、クライアント1、すなわちクライアント・コンピュータ102aがサーバ1、すなわちサーバ106aに対してデータ・マップに対するput(K1,U1)を実行し、次にサーバ2、すなわちサーバ106bに対してデータ・マップに対するget(K4)を実行後、データ・マップに対するput(K3,U3)を実行するよう指示し、次にサーバ1に対してcommitを実行するよう指示し、サーバ1に対してcommitを実行するよう指示する。
 一方、クライアント2、すなわちクライアント・コンピュータ102bは、データ・マップに対するput(K2,U2)、get(K5)、put(K1,U1')、commitという処理を順次サーバ1に対して行う。
 この場合、commit処理において、サーバ1がcommitを終了した後、サーバ2のcommit処理前にクライアント1に障害が発生した場合、サーバ2はトランザクションをcommitしていいのかどうか判断できないため、クライアント1は、K1とK3をアトミックに更新できず、よってグローバル・トランザクションは実現できない。
 これを解決するために、図7に示すような、2フェーズ・コミットを応用し、グローバル・トランザクションを可能とするKVSシステムが開発された。このようなシステムにおいては、共有ロックが、ローカル・トランザクションで保持され、排他ロックは、更新前のコミット済みの値(CURRENT)・更新中の値(DIRTY)とともに、排他ロックを獲得中のグローバル・トランザクションのトランザクションID(LOCK)を含んだマップ・エントリの値[CURRENT->DIRTY, LOCK]として保持される。なお、便宜上、以降、マップ・エントリはKEY列、VALUE列、LOCK列から構成されるものとし、VALUE列には、CURRENT及びDIRTYの値(CURRENT->DIRTY)を、LOCK列にはLOCKの値が格納されるものとする。DIRTYの値が存在しない場合は、VALUE列にはCURRENTのみを格納される。また、図7において、Tx1-1、Tx1-2、Tx2-1、Tx2-2、Tx2-3、GTX1-1、GTx1-2はローカル・トランザクションのトランザクションIDであり、GTx1、GTx2は、グローバル・トランザクションのトランザクションIDである。また、Tx1-1、Tx1-2、GTx1-1、GTx1-2で示されるローカル・トランザクションは、GTx1で示されるグローバル・トランザクションを処理するためのローカル・トランザクション処理である。
 クライアント1である、クライアント・コンピュータ102aにおいてまず、ローカル・トランザクションGTx1-1がまず、管理用マップに対し、put(GTxA,working)の後、commitするようにサーバ3(サーバ106c)に指示する。
 続いてクライアント1は、ローカル・トランザクションTx1-1で、データ・マップに対し、put(K1,V1->U1,GTxA)の後、commitするようにサーバ1(サーバ106a)に指示する。
 次にクライアント1は、ローカル・トランザクションTx2-1で、データ・マップに対し、get(K4)を実行するようにサーバ2(サーバ106b)に指示する。
 次にクライアント1は、ローカル・トランザクションTx2-2で、データ・マップに対し、put(K3,V3->U3,GTxA)を実行し、commitするようにサーバ2に指示する。
 次にクライアント1は、ローカル・トランザクションGTx1-2で、管理用マップに対し、put(GTxA,committed)の後、commitするようにサーバ3に指示する。
 次にクライアント1は、ローカル・トランザクションTx1-2で、データ・マップに対し、put(K1,U1,NULL)を実行し、commitするようにサーバ1に指示する。
 次にクライアント1は、ローカル・トランザクションTx2-1で、commitするようにサーバ2に指示する。
 次にクライアント1は、ローカル・トランザクションTx2-3で、データ・マップに対し、put(K1,U3,NULL)の後、commitするようにサーバ2に指示する。
 一方、クライアント2、すなわち、クライアント・コンピュータ102bは、サーバ1に対して、ローカル・トランザクションTx3で、データ・マップに対し、put(K2,U2,NULL)、get(K5)、put(K1,U1',NULL)、commitを実行するように指示する。
 このような構成だと、クライアント1は、K1とK3の値をアトミックに更新可能であるが、クライアント2は、ローカル・トランザクションでK1の値を更新してはならない。なぜなら、クライアント1は、更新中のK1のマップ・エントリに対するサーバ1上のローカル排他制御機構のロックを保持しておらず、そのため、クライアント2はK1の値に対するデータを更新できてしまう。しかし、グローバル・トランザクション処理内では、クライアント1がLOCK値としてGTxAと記入しているので、本来は更新できてはならないものである。これを防ぐには、全てのトランザクションをグローバル・トランザクションにしなくてはならないが、複数のローカル・トランザクションにより実現されるグローバル・トランザクションはローカル・トランザクションよりもオーバーヘッドが大きいので、システム全体の性能が低下してしまう。
 図8は、本発明の構成を示す。ここでの参照番号は、図4の機能ブロック図に対応する。すなわち、各サーバ106a、106b、106c、106dに、トランザクションID(TxID)とトランザクションの状態の列をもつ、管理用マップ412a、412b、412c、412dをそれぞれ別途設ける。そこで、VALUEの列に格納されるのがトランザクションの状態である。
 また、各サーバ106a、106b、106c、106dには、KVSのデータを格納するテーブル(データ・マップ)410a、410b、410c、410dも設けられる。データ・マップ410a、410b、410c、410dはそれぞれ、キーを入れる列であるKEY列と、コミット確定済みの値と更新中の値を入れる列であるVALUE列と、ロック状態、すなわち更新中のトランザクションIDを格納するLOCK列をもつ。
 各サーバ106a、106b、106c、106dは、データ・マップ410a、410b、410c、410dにおいて、マップ・エントリ毎に、KVSのトランザクション機構を利用して、4つのロック状態を管理する。4つのロック状態とは、S(グローバル・トランザクションまたはローカル・トランザクションが照会中)、Init(アクセスなし)、LX(ローカル・トランザクションが更新中)、GX(グローバル・トランザクションが更新中)であり、4つのロック状態は、図9の遷移図に従い遷移する。
 図8において、グローバル・トランザクションを要求するクライアント・コンピュータ102aは、複数のローカル・トランザクションを処理要求し、ローカル・トランザクションを要求するクライアント・コンピュータ102bは、単一のローカル・トランザクションを処理要求する。
 各サーバ106a、106b、106c、106dは、図示しないが、ローカル排他制御機構を備え、各サーバ106a、106b、106c、106dに管理用マップ412a、412b、412c、412dを配置しておくことで、ローカル・トランザクション同士及びグローバル・トランザクション同士及びローカル・トランザクションとグローバル・トランザクションの共有・排他ロック衝突はローカル排他制御機構が解決し、グローバル・トランザクション同士の排他・排他ロック衝突は管理用マップを用いて解決し、ローカル・トランザクションとグローバル・トランザクションの排他・排他ロック衝突はローカル排他制御機構が解決し、グローバル・トランザクションとローカル・トランザクションの排他・共有ロック衝突及び排他・排他ロック衝突は、ローカル・トランザクションをグローバル・トランザクションに昇格後に管理用マップを利用して解決する。なお、ローカル排他制御機構においては、Getを要求した場合は共有ロックを、Putを要求した場合は排他ロックを、GetForUpdateを要求した場合は排他ロックを、要求したローカル・トランザクションを要求するクライアントに与えるものとする。
 次に、4つのロック状態すなわち、S(グローバル・トランザクションまたはローカル・トランザクションが照会中)、Init(アクセスなし)、LX(ローカル・トランザクションが更新中)、GX(グローバル・トランザクションが更新中)について説明する。図9に示すように、Initからは、S、LX、GXのどれかに移行する。
 Sからは、Init、LX、GXのどれかに移行する。LX、GXからは、Initに戻れるだけである。
 ローカル・トランザクションがSロックを要求する場合、ローカル・トランザクションを開始し、照会処理(Get)を行い、GXでないことを確認後、照会処理を行う。GXの場合は、 ローカル・トランザクションをグローバル・トランザクションに昇格し、グローバル・トランザクションとして、更新中のグローバル・トランザクションの終了を待機し、その後、グローバル・トランザクションとして、Sを要求する。
 ローカル・トランザクションがLXロックを要求する場合、ローカル・トランザクションを開始し、排他ロックの獲得を伴う照会処理(GetForUpdate)を行い、GXでないことを確認後、更新処理を行う。GXの場合は、 ローカル・トランザクションをグローバル・トランザクションに昇格し、更新中のグローバル・トランザクションの終了を待機し、その後、 グローバル・トランザクションとして、GXを要求する。
 ローカル・トランザクションがCommit/Rollbackを要求する場合、ローカル・トランザクションのCommit/Rollbackを行う。
 グローバル・トランザクションがSロックを要求する場合、ローカル・トランザクションを開始し、GXでないことを確認後、照会処理を行う。GXの場合は、ローカル・トランザクションをコミットし、更新中のグローバル・トランザクションの終了を待機する。
 グローバル・トランザクションがGXロックを要求する場合、ローカル・トランザクションを開始し、データ・マップに対してGetForUpdateを利用して、Initであることを確認後、マップ・エントリ中のVALUE列のDIRTY、LOCK列の更新処理を行い、ローカル・トランザクションをコミットする。GXの場合は、ローカル・トランザクションをコミットし、更新中のグローバル・トランザクションの終了を待機する。
 グローバル・トランザクションがGXからCommitを要求する場合、ローカル・トランザクションを開始し、VALUE列のCURRENT->DIRTYをDIRTYに更新し、LOCK列を削除し、ローカル・トランザクションをコミットする。
 グローバル・トランザクションがGXからRollbackを要求する場合、ローカル・トランザクションを開始し、VALUE列のDIRTY、LOCK列を削除し、ローカル・トランザクションをコミットする。
 次に、クライアント・コンピュータからの指示に従って、サーバで実行される処理について、フローチャートを参照して説明する。以下では特にフローチャートでの説明の便宜上、トランザクションIDをTxID、ローカル・トランザクションをLocalTx、グローバル・トランザクションをGlobalTxと略記することがある。
 図10は、トランザクションの最初の照会・更新時の処理時の処理のフローチャートを示す図である。
 ステップ1002では、トランザクションからのリクエストに応答して、例えばカタログ・サーバに一旦アクセスことによって、照会・更新するキーを基に、サーバが特定される。このために例えば、キーのハッシュ値をサーバの数で割った余りの値で、サーバIDを特定する。
 ステップ1004では、特定したサーバが、ローカル・トランザクションを開始する。ステップ1006では特定したサーバがキーに対応する値を照会し、ステップ1008では、照会したマップ・エントリのLOCK列に他のトランザクションIDがあるかどうか判断し、もしそうなら、ステップ1010でグローバル・トランザクションに昇格後、グローバル・トランザクションとして照会処理を行う。グローバル・トランザクションへの昇格の具体的処理については、図13のフローチャートを参照して、後で説明する。
 ステップ1008で、照会した値のLOCK列に他のトランザクションIDはないと判断されると、ステップ1012で照会処理かどうか判断され、そうでないなら、ステップ1014で、ローカル・トランザクションとして更新処理が行われる。なお、ここでLOCKとは、データ・テーブル410a、・・・などのLOCK列の値のことである。
 図11は、トランザクションの2回目以降の照会・更新時の処理時の処理のフローチャートを示す図である。
 ステップ1102では、トランザクションが、グローバル・トランザクションとして稼動中かどうかが判断される。もしそうなら、ステップ1104で、グローバル・トランザクションとして照会・更新処理が行われる。
 グローバル・トランザクションとして稼動中でないなら、ステップ1106で、例えばカタログ・サーバに一旦アクセスことによって、照会・更新するキーを基に、サーバが特定される。このために例えば、キーのハッシュ値をサーバの数で割った余りの値で、サーバIDを特定する。
 ステップ1108では前回と同じサーバかどうか判断され、もしそうなら、ステップ1110で、特定されたサーバがキーに対応する値を照会する。この際、更新処理の場合は、排他ロックを伴う照会(GetForUpdate)となる。
 ステップ1112では、特定したサーバは、照会した値のロックに他トランザクションID(TxID)があるかどうかを判断する。もしそうなら、ステップ1114で、グローバル・トランザクションに昇格後、グローバル・トランザクションとして照会処理が行われる。
 ステップ1112で、照会した値のロックに他のトランザクションIDはないと判断されると、ステップ1116で照会処理かどうか判断され、そうでないなら、ステップ1118で、ローカル・トランザクションとして更新処理が行われる。
 ステップ1108に戻って、前回の処理と同じサーバでないと判断されると、ステップ1114で、グローバル・トランザクションに昇格後、グローバル・トランザクションとして照会処理が行われる。
 図12は、グローバル・トランザクションの開始処理のフローチャートを示す図である。
 ステップ1202では、グローバル・トランザクションの識別子であるトランザクションIDが、クライアント内で生成される。
 ステップ1204では、トランザクションIDを基に、サーバが特定される。このとき例えば、トランザクションIDのハッシュ値をサーバの数で割った余りの値で、サーバIDを特定する。
 ステップ1206では、特定したサーバで、管理用ローカル・トランザクションが開始される。そしてステップ1208で、管理用ローカル・トランザクション内で、トランザクションIDをキーとするマップ・エントリの排他ロックが獲得される。
 図13は、ローカル・トランザクションからグローバル・トランザクションに昇格する処理のフローチャートを示す図である。
 ステップ1302では、トランザクションIDを識別子とするグローバル・トランザクションが開始される。
 ステップ1304では、ローカル・トランザクションを処理しているサーバで、照会用ローカル・トランザクションが開始される。
 ステップ1306では、ローカル・トランザクションで照会中、すなわちSロックを獲得中の全ての値が、照会用ローカル・トランザクションで照会される。
 ステップ1308では、ローカル・トランザクションで更新中、すなわちLXロックを獲得中の全ての値が、更新前の値(CURRENT)と更新中の値(DIRTY)と排他ロックを獲得中のトランザクションID(LOCK)を組み合わせた値[CURRENT->DIRTY,LOCK]に更新する。なお、ここでLOCK値とは、データ・テーブル410a、・・・などのLOCK列の値のことである。
 ステップ1310では、元のローカル・トランザクションがコミットされる。これによって、獲得していたLXロックは、GXロックに昇格する。なお、この時点で照会用ローカル・トランザクションをコミットしないことに留意されたい。
 図14は、グローバル・トランザクションの照会処理のフローチャートを示す図である。ステップ1402では、キーを基に、サーバが特定される。このために例えば、キーのハッシュ値をサーバの数で割った余りの値で、サーバIDを特定する。
 ステップ1404では、特定されたサーバで照会用ローカル・トランザクションを開始する。
 ステップ1406では、照会用ローカル・トランザクションでキーに対応する値が照会される。
 ステップ1408では、照会した値のLOCK値に他トランザクションIDがあるかどうかが判断され、もしそうならステップ1410で他トランザクションIDの待機処理が行われ、ステップ1402に戻る。
 照会した値のLOCK値に他トランザクションIDがないなら、処理は終了するが、この時点では照会用ローカル・トランザクションはコミットされない。
 図15は、グローバル・トランザクションの更新処理のフローチャートを示す図である。ステップ1502では、キーを基に、サーバが特定される。このために例えば、キーのハッシュ値をサーバの数で割った余りの値で、サーバIDを特定する。
 ステップ1504では、特定されたサーバで更新用ローカル・トランザクションを開始する。
 ステップ1506では、更新用ローカル・トランザクションでキーに対応する値が照会される。
 ステップ1508では、照会した値のLOCK値に他トランザクションIDがあるかどうかが判断され、もしそうならステップ1510で他トランザクションIDの待機処理が行われ、ステップ1502に戻る。
 照会した値のLOCK値に他トランザクションIDがないなら、ステップ1512で、更新用ローカル・トランザクションで、更新前の値(CURRENT)と更新中の値(DIRTY)と排他ロックを獲得中のトランザクションID(TxID)を組み合わせた値[CURRENT->DIRTY,TxID]に更新される。
 ステップ1514では、更新用ローカル・トランザクションがコミットされる。
 図16は、グローバル・トランザクションのコミット処理のフローチャートを示す図である。ステップ1602では、該当するサーバが、管理用ローカル・トランザクションで、管理用マップのトランザクションIDをキーとする値をCommittedに更新する。
 当該サーバは、ステップ1604で、管理用ローカル・トランザクションをコミットする。
 ステップ1606でコミットが成功したかどうかの判断が行われ、そうでないならステップ1608でロールバックが行われる。
 ステップ1606でコミットが成功したと判断されると、ステップ1610で、全ての照会用がコミットされる。
 ステップ1612では、全ての更新中のVALUEを選択したかどうかが判断され、もしそうなら処理は終了する。
 全ての更新中のVALUEがまだ選択されたのでないなら、ステップ1614で、更新中のキー(KEY)とその値[CURRENT->DIRTY,TxID]が選択される。
 ステップ1616では、キーを基にサーバが特定される。このために例えば、キーのハッシュ値をサーバの数で割った余りの値で、サーバIDを特定する。
 ステップ1618では、特定したサーバで更新用ローカル・トランザクションが開始される。
 ステップ1620では、更新用ローカル・トランザクションで、キーに対応する値が照会される。
 ステップ1622では、照会した値が[CURRENT->DIRTY,TxID]かどうか判断し、もしそうなら、ステップ1624で更新用ローカル・トランザクションで、キーに対応する値が[DIRTY,NULL]に更新され、ステップ1626で更新用ローカル・トランザクションがコミットされ、ステップ1612に戻る。
 ステップ1622で、照会した値が[CURRENT->DIRTY,TxID]でない場合は直ちにステップ1626で更新用ローカル・トランザクションがコミットされ、ステップ1612に戻る。
 図17は、トランザクションID TxID'を識別子とするグローバル・トランザクションの待機処理のフローチャートを示す図である。
 ステップ1702は、管理用ローカル・トランザクションで、トランザクションID TxIDをキーとする値を、[Waiting,TxID']に更新する処理が行われる。
 ステップ1704で、管理用ローカル・トランザクションがコミットされる。
 ステップ1706でコミットが成功したかどうかの判断が行われ、そうでないならステップ1708でロールバックが行われる。
 ステップ1706でコミットが成功したと判断されると、ステップ1710で、TxID'を基にサーバが特定される。これは例えば、TxID'のハッシュ値をサーバ数で割った値で決定する。
 ステップ1712では、特定したサーバで待機用ローカル・トランザクションが開始される。
 ステップ1714では、待機用ローカル・トランザクションで、TxID'の値が管理用マップで照会される。
 ステップ1716では、TxID'の値がCommittedとRollbackedのどちらかが判断され、Committedの場合は、ステップ1718でTxIDを基にサーバが特定され、ステップ1720で、管理用ローカル・トランザクションで、TxIDをキーとする値を、Workingに更新し、処理を終了する。
 TxID'の値がRollbackedであった場合には、ステップ1722で、TxID'の値にTxIDが含まれているかどうかが判断され、そうでないならステップ1724でロールバック処理に進む。
 ステップ1722で、TxID'の値にTxIDが含まれていると判断されると、ステップ1726で待機用ローカル・トランザクションがコミットされ、次にステップ1728でTxIDを基にサーバが特定され、次にステップ1730で、特定したサーバで管理用ローカル・トランザクションが開始される。
 そして、ステップ1732で、TxID'のグローバル・トランザクションの待機処理が開始される。
 図18は、グローバル・トランザクションの終了処理のフローチャートを示す図である。
 ステップ1802では、グローバル・トランザクションの開始時に開始したローカル・トランザクションを用いて、グローバル・トランザクションの状態を表すマップ・エントリに対する値を、CommittedもしくはRollbackedに更新してコミットが行われる。
 ステップ1804では、グローバル・トランザクションの状態がCommittedまたはRollbackedのどちらかであるかに応じて分岐され、Committedの場合はステップ1806で、グローバル・トランザクション内で更新した全マップ・エントリに対し、 VALUE列のCURRENT->DIRTYをDIRTYに更新し、LOCK列を削除する処理(ローカル・コミット)が行われ、Rollbackedの場合はステップ1808で、グローバル・トランザクション内で更新した全マップ・エントリに対し、VALUE列のDIRTY、LOCK列を削除する処理(ローカル・ロールバック)が行われる。
 次に、クライアントの障害時の処理について説明する。
 先ず、グローバル・トランザクションのコミット前に、クライアントに障害が発生した場合、各マップ・エントリはGX状態のまま残る。そして、管理マップのグローバル・トランザクションの状態を表すマップ・エントリに対するローカル・トランザクションは、当該サーバによりロールバックされ、状態が保存されていない状態になる。次回、当該マップ・エントリを照会・更新するトランザクションは、管理マップを確認することで、トランザクションがロールバック済みであることを確認可能である。ロールバック済みであった場合は、 ローカル・ロールバック処理は、ロールバック済みであることを確認したトランザクションが行う。
 次に、ローカル・コミット処理前に、クライアントに障害が発生した場合、各マップ・エントリはGX状態のまま残る。次回、当該マップ・エントリを照会・更新するトランザクションは、管理マップを確認することで、コミット済みであることを確認可能である。コミット済みであった場合は、 ローカル・コミット処理は、コミット済みであることを確認したトランザクションが行う。
 このように、グローバル・トランザクションのコミット前に、クライアントに障害が発生した場合でも、ローカル・コミット処理前に、クライアントに障害が発生した場合でも、本発明によれば、処理の一貫性を保つことが可能である。
 次に図19を参照して、本発明のこの実施例の動作の例を説明する。図19において先ず、クライアント1(クライアント・コンピュータ102a)のグローバル・トランザクションGTxA-1がサーバ3(サーバ106c)に対して、put(GTxA,working)を実行するよう指示し、続いてcommitするように指示する。
 次にクライアント1のローカル・トランザクションTx1-1が、サーバ1(サーバ106a)に対して、put(K1,V1->U1,GTxA)を実行するよう指示し、続いてcommitするように指示する。
 次にクライアント1のローカル・トランザクションTx2-1が、サーバ2(サーバ106b)に対して、put(K3,V3->U3,GTxA)を実行するよう指示し、続いてcommitするように指示する。
 次にクライアント1のローカル・トランザクションTx1-2が、サーバ1に対して、put(GTx1,committed)を実行するよう指示し、続いてcommitするように指示する。それと同時にクライアント1のグローバル・トランザクションGTxA-1がサーバ3に対して、put(GTxA,committed)を実行するよう指示し、続いてcommitするように指示する。
 この間にクライアント2(クライアント・コンピュータ102b)のローカル・トランザクションTx3がサーバ1に対してGetForUpdate(K1)を実行しようと試みる。このとき処理は、他のグローバル・トランザクションによって排他ロックがとられていない場合と、他のグローバル・トランザクションによって排他ロックがとられている場合とで分かれる。
 他のグローバル・トランザクションによって、排他ロックがとられていない場合、以下の処理が実行される。
Tx3-1’. getForUpdate(K2)
Tx3-2’. put(K2, U2, NULL)
Tx3-3’. get(K5)
Tx3-4’. getForUpdate(K1)
Tx3-5’. put(K1,U1’, NULL)
Tx3-6’. commit
 他のグローバル・トランザクションによって、排他ロックがとられている場合、以下の処理が実行される。
Tx3-1’. getForUpdate(K2)
Tx3-2’. put(K2, U2, NULL)
Tx3-3’. get(K5)
Tx3-4’. getForUpdate(K1)
Tx3-5’. put(K2, V2->U2, GTxB) // Tx3からGTxBに昇格
Tx4-1’. get(K5)        // Tx4を起動し、照会中のマップ・エントリを再照会する
Tx3-6’. commit
Wait for GTxA commit/rollback   // GTxAの終了を待機
Tx5-1’. put(K1, U1->U1’, GTxB) // 更新中のマップ・エントリの排他ロックを、既存のトランザクションで、グローバル・トランザクション用に修正する
 以上、特定のハードウェア及びソフトウェアのプラットアフォームの上で本発明の実施例を説明してきたが、本発明は、任意のコンピュータのハードウェア及びプラットフォームで実施可能であることを、この分野の当業者なら理解するであろう。
102 クライアント・コンピュータ
106 サーバ
202 主記憶
204 CPU
206 メインメモリ
206 主記憶
210 ハードディスク・ドライブ
306 CPU
308 主記憶
310 ハードディスク・ドライブ
404 アプリケーション・プログラム
406 トランザクション処理プログラム
408 KVSプログラム
410 データ・マップ
412 管理用マップ

Claims (18)

  1.  複数のサーバにデータを分散してもち、クライアント・コンピュータからデータにアクセスされる分散KVSシステムにおいて、該分散KVSシステムによって実行されるステップを有する方法であって、
     前記複数のサーバの各々に、トランザクションIDとその状態を示す値を含む管理テーブルと、キーの値と、バリューと、ロックの値を含むデータ・テーブルを配置するステップと、
     前記クライアント・コンピュータにおいて、トランザクションIDを確定して、グローバル・トランザクションを開始するステップと、
     前記複数のサーバのうちローカル・トランザクションを処理しているサーバで、照会用ローカル・トランザクションを開始するステップと、
     前記ローカル・トランザクションで照会中の全ての値を前記照会用ローカル・トランザクションで照会するステップと、
     前記ローカル・トランザクションで更新中の全ての値を、前記データ・テーブルにおいて、更新前の値と更新中前の値と、前記トランザクションIDをロックの値の組み合わせに更新するステップと、
     前記ローカル・トランザクションをコミットするステップを有する、
     分散KVSシステムの処理方法。
  2.  前記ローカル・トランザクションをコミットした時点では、前記照会用ローカル・トランザクションはコミットされない、請求項1に記載の処理方法。
  3.  前記ロックは、グローバル・トランザクションまたはローカル・トランザクションが照会中というSロックと、ローカル・トランザクションが更新中というLXロックと、グローバル・トランザクションが更新中というGXロックを有する、請求項1に記載の処理方法。
  4.  前記グローバル・トランザクションを開始するステップは、
     前記クライアント・コンピュータが前記トランザクションIDを生成するステップと、
     前記トランザクションIDを基に、前記グローバル・トランザクションの状態を表す管理用マップを保持するサーバを確定するステップと、
     前記前記グローバル・トランザクションの状態を表す前記管理用マップのマップ・エントリに対してローカル・トランザクションを開始し、ロックを獲得するステップを有する、
     請求項1に記載の処理方法。
  5.  前記ローカル・トランザクションを用いて、前記管理マップにおける、前記グローバル・トランザクションの状態を表すマップ・エントリの値を、Committedに変更しコミットするステップと、
     前記グローバル・トランザクションで更新した全マップ・エントリに対して、更新中のデータを現在データに変更し、更新中のデータとトランザクションIDを削除するステップを実行することにより前記グローバル・トランザクションを終了させるステップをさらに有する、
     請求項4に記載の処理方法。
  6.  前記ローカル・トランザクションを用いて、前記管理マップにおける、前記グローバル・トランザクションの状態を表すマップ・エントリの値を、Rollbackedに変更しコミットするステップと、
     前記グローバル・トランザクションで更新した全マップ・エントリに対して、更新中のデータとトランザクションIDを削除するステップを実行することにより前記グローバル・トランザクションを終了させるステップをさらに有する、
     請求項4に記載の処理方法。
  7.  複数のサーバにデータを分散してもち、クライアント・コンピュータからデータにアクセスされる分散KVSシステムにおいて、
     前記分散KVSシステムに、
     前記複数のサーバの各々に、トランザクションIDとその状態を示す値を含む管理テーブルと、キーの値と、バリューと、ロックの値を含むデータ・テーブルを配置するステップと、
     前記クライアント・コンピュータにおいて、トランザクションIDを確定して、グローバル・トランザクションを開始するステップと、
     前記複数のサーバのうちローカル・トランザクションを処理しているサーバで、照会用ローカル・トランザクションを開始するステップと、
     前記ローカル・トランザクションで照会中の全ての値を前記照会用ローカル・トランザクションで照会するステップと、
     前記ローカル・トランザクションで更新中の全ての値を、前記データ・テーブルにおいて、更新前の値と更新中前の値と、前記トランザクションIDをロックの値の組み合わせに更新するステップと、
     前記ローカル・トランザクションをコミットするステップを実行させる、
     分散KVSシステムの処理プログラム。
  8.  前記ローカル・トランザクションをコミットした時点では、前記照会用ローカル・トランザクションはコミットされない、請求項7に記載の処理プログラム。
  9.  前記ロックは、グローバル・トランザクションまたはローカル・トランザクションが照会中というSロックと、ローカル・トランザクションが更新中というLXロックと、グローバル・トランザクションが更新中というGXロックを有する、請求項7に記載の処理プログラム。
  10.  前記グローバル・トランザクションを開始するステップは、
     前記クライアント・コンピュータが前記トランザクションIDを生成するステップと、
     前記トランザクションIDを基に、前記グローバル・トランザクションの状態を表す管理用マップを保持するサーバを確定するステップと、
     前記前記グローバル・トランザクションの状態を表す前記管理用マップのマップ・エントリに対してローカル・トランザクションを開始し、ロックを獲得するステップを有する、
     請求項7に記載の処理プログラム。
  11.  前記ローカル・トランザクションを用いて、前記管理マップにおける、前記グローバル・トランザクションの状態を表すマップ・エントリの値を、Committedに変更しコミットするステップと、
     前記グローバル・トランザクションで更新した全マップ・エントリに対して、更新中のデータを現在データに変更し、更新中のデータとトランザクションIDを削除するステップを実行することにより前記グローバル・トランザクションを終了させるステップをさらに実行させる、
     請求項10に記載の処理プログラム。
  12.  前記ローカル・トランザクションを用いて、前記管理マップにおける、前記グローバル・トランザクションの状態を表すマップ・エントリの値を、Rollbackedに変更しコミットするステップと、
     前記グローバル・トランザクションで更新した全マップ・エントリに対して、更新中のデータとトランザクションIDを削除するステップを実行することにより前記グローバル・トランザクションを終了させるステップをさらに実行させる、
     請求項10に記載の処理プログラム。
  13.  複数のサーバにデータを分散してもち、クライアント・コンピュータからデータにアクセスされる分散KVSシステムであって、
     前記複数のサーバの各々に、トランザクションIDとその状態を示す値を含む管理テーブルと、キーの値と、バリューと、ロックの値を含むデータ・テーブルを配置する手段と、
     前記クライアント・コンピュータにおいて、トランザクションIDを確定して、グローバル・トランザクションを開始する手段と、
     前記複数のサーバのうちローカル・トランザクションを処理しているサーバで、照会用ローカル・トランザクションを開始する手段と、
     前記ローカル・トランザクションで照会中の全ての値を前記照会用ローカル・トランザクションで照会する手段と、
     前記ローカル・トランザクションで更新中の全ての値を、前記データ・テーブルにおいて、更新前の値と更新中前の値と、前記トランザクションIDをロックの値の組み合わせに更新する手段と、
     前記ローカル・トランザクションをコミットする手段を実行を有する、
     分散KVSシステムの処理システム。
  14.  前記ローカル・トランザクションをコミットした時点では、前記照会用ローカル・トランザクションはコミットされない、請求項13に記載の処理システム。
  15.  前記ロックは、グローバル・トランザクションまたはローカル・トランザクションが照会中というSロックと、ローカル・トランザクションが更新中というLXロックと、グローバル・トランザクションが更新中というGXロックを有する、請求項13に記載の処理システム。
  16.  前記グローバル・トランザクションを開始する手段は、
     前記クライアント・コンピュータが前記トランザクションIDを生成する手段と、
     前記トランザクションIDを基に、前記グローバル・トランザクションの状態を表す管理用マップを保持するサーバを確定する手段と、
     前記前記グローバル・トランザクションの状態を表す前記管理用マップのマップ・エントリに対してローカル・トランザクションを開始し、ロックを獲得する手段を有する、
     請求項13に記載の処理システム。
  17.  前記ローカル・トランザクションを用いて、前記管理マップにおける、前記グローバル・トランザクションの状態を表すマップ・エントリの値を、Committedに変更しコミットする手段と、
     前記グローバル・トランザクションで更新した全マップ・エントリに対して、更新中のデータを現在データに変更し、更新中のデータとトランザクションIDを削除する手段を実行することにより前記グローバル・トランザクションを終了させる手段をさらに有する、
     請求項16に記載の処理システム。
  18.  前記ローカル・トランザクションを用いて、前記管理マップにおける、前記グローバル・トランザクションの状態を表すマップ・エントリの値を、Rollbackedに変更しコミットする手段と、
     前記グローバル・トランザクションで更新した全マップ・エントリに対して、更新中のデータとトランザクションIDを削除する手段を実行することにより前記グローバル・トランザクションを終了させる手段をさらに有する、
     請求項16に記載の処理システム。
PCT/JP2012/068414 2011-09-30 2012-07-20 トランザクション処理システム、方法及びプログラム WO2013046883A1 (ja)

Priority Applications (4)

Application Number Priority Date Filing Date Title
DE112012004099.6T DE112012004099T5 (de) 2011-09-30 2012-07-20 Transaktionsverarbeitungssystem, Verfahren und Programm
GB1407561.8A GB2511222A (en) 2011-09-30 2012-07-20 Transaction processing system, method and program
CN201280045914.9A CN103814362B (zh) 2011-09-30 2012-07-20 用于分布式kvs系统的处理方法和系统
JP2013536012A JP5940074B2 (ja) 2011-09-30 2012-07-20 トランザクション処理システム、方法及びプログラム

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2011218145 2011-09-30
JP2011-218145 2011-09-30

Publications (1)

Publication Number Publication Date
WO2013046883A1 true WO2013046883A1 (ja) 2013-04-04

Family

ID=47993587

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2012/068414 WO2013046883A1 (ja) 2011-09-30 2012-07-20 トランザクション処理システム、方法及びプログラム

Country Status (6)

Country Link
US (1) US8930323B2 (ja)
JP (1) JP5940074B2 (ja)
CN (1) CN103814362B (ja)
DE (1) DE112012004099T5 (ja)
GB (1) GB2511222A (ja)
WO (1) WO2013046883A1 (ja)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016095638A (ja) * 2014-11-13 2016-05-26 日本電気株式会社 トランザクション処理装置、トラザクション処理方法、及びプログラム
JPWO2015097991A1 (ja) * 2013-12-24 2017-03-23 日本電気株式会社 トランザクション分散処理装置、方法、システム、および、記憶媒体
WO2018193638A1 (ja) * 2017-04-21 2018-10-25 株式会社Orb 計算機及びトランザクション処理方法
JP2019532419A (ja) * 2016-09-21 2019-11-07 アール−ストール インコーポレイテッド データ処理用の分散型台帳を使用するためのシステム及び方法

Families Citing this family (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10044548B2 (en) 2012-10-15 2018-08-07 Jetflow Technologies Flowlet-based processing
US9838242B2 (en) 2011-04-13 2017-12-05 Jetflow Technologies Flowlet-based processing with key/value store checkpointing
US11176111B2 (en) 2013-03-15 2021-11-16 Nuodb, Inc. Distributed database management system with dynamically split B-tree indexes
US10740323B1 (en) * 2013-03-15 2020-08-11 Nuodb, Inc. Global uniqueness checking in distributed databases
US10049022B2 (en) * 2013-06-24 2018-08-14 Oracle International Corporation Systems and methods to retain and reclaim resource locks and client states after server failures
US9715405B2 (en) * 2013-09-23 2017-07-25 International Business Machines Corporation Efficient coordination across distributed computing systems
US9912731B2 (en) * 2014-03-04 2018-03-06 International Business Machines Corporation Dynamic transaction coordination
CN107851101B (zh) * 2015-04-17 2022-08-12 中兴飞流信息科技有限公司 在分布式计算系统中执行容错数据处理的方法及容错分布式计算系统
CN104881766A (zh) * 2015-05-07 2015-09-02 北京京东尚科信息技术有限公司 一种分布式仓储数据处理方法、设备和系统
US10248174B2 (en) * 2016-05-24 2019-04-02 Hedvig, Inc. Persistent reservations for virtual disk using multiple targets
CN106354565B (zh) * 2016-09-21 2019-08-20 努比亚技术有限公司 一种分布式锁客户端及控制方法
CN106775468B (zh) * 2016-12-06 2020-01-10 曙光信息产业(北京)有限公司 分布式事务的实现方法和系统
KR102600366B1 (ko) 2017-08-15 2023-11-08 누오디비 인코포레이티드 분산형 데이터베이스에서의 인덱스 분할
CN109408201B (zh) * 2017-08-18 2022-07-12 中国银联股份有限公司 基于分布式数据库的事务管理方法
US10642680B2 (en) 2018-02-23 2020-05-05 International Business Machines Corporation Chronologically ordered log-structured key-value store from failures during garbage collection
US10783073B2 (en) * 2018-02-23 2020-09-22 International Business Machines Corporation Chronologically ordered out-of-place update key-value storage system
US10635523B2 (en) 2018-02-23 2020-04-28 International Business Machines Corporation Fast recovery from failures in a chronologically ordered log-structured key-value storage system
US10848468B1 (en) 2018-03-05 2020-11-24 Commvault Systems, Inc. In-flight data encryption/decryption for a distributed storage platform
WO2019177591A1 (en) * 2018-03-13 2019-09-19 Google Llc Including transactional commit timestamps in the primary keys of relational databases
CN110321374B (zh) * 2018-10-23 2022-03-25 开采夫(杭州)科技有限公司 基于分布式网络的标准文件io操作系统及方法
US11176121B2 (en) * 2019-05-28 2021-11-16 International Business Machines Corporation Global transaction serialization

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0683692A (ja) * 1992-04-15 1994-03-25 Internatl Business Mach Corp <Ibm> データベースアクセス方法およびシステム
JPH08202567A (ja) * 1995-01-25 1996-08-09 Hitachi Ltd システム間ロック処理方法
WO2010041515A1 (ja) * 2008-10-06 2010-04-15 インターナショナル・ビジネス・マシーンズ・コーポレーション 複数のアプリケーションサーバにより共有データをアクセスするシステム

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000181754A (ja) * 1998-12-11 2000-06-30 Nec Corp トランザクション処理システム及びトランザクション処理システムの制御プログラムを記録した媒体
US6321238B1 (en) * 1998-12-28 2001-11-20 Oracle Corporation Hybrid shared nothing/shared disk database system
US7206805B1 (en) * 1999-09-09 2007-04-17 Oracle International Corporation Asynchronous transcription object management system
US6671686B2 (en) * 2000-11-02 2003-12-30 Guy Pardon Decentralized, distributed internet data management
US7627574B2 (en) * 2004-12-16 2009-12-01 Oracle International Corporation Infrastructure for performing file operations by a database server
US8103642B2 (en) * 2006-02-03 2012-01-24 Oracle International Corporation Adaptive region locking
US7831574B2 (en) * 2006-05-12 2010-11-09 Oracle International Corporation Apparatus and method for forming a homogenous transaction data store from heterogeneous sources
JP4664931B2 (ja) 2007-02-27 2011-04-06 オラクル・インターナショナル・コーポレイション データベースへのアクセスを制御するための異なったデータベースサーバ間のデータベースのオーナーシップのパーティション化

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0683692A (ja) * 1992-04-15 1994-03-25 Internatl Business Mach Corp <Ibm> データベースアクセス方法およびシステム
JPH08202567A (ja) * 1995-01-25 1996-08-09 Hitachi Ltd システム間ロック処理方法
WO2010041515A1 (ja) * 2008-10-06 2010-04-15 インターナショナル・ビジネス・マシーンズ・コーポレーション 複数のアプリケーションサーバにより共有データをアクセスするシステム

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
HIROKI KUMAZAKI ET AL.: "Implementation of Obstruction-free Transaction on Distributed Key Value Store", IPSJ SIG NOTES 2011 (HEISEI 23) NENDO 2, 15 August 2011 (2011-08-15), pages 1 - 7 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPWO2015097991A1 (ja) * 2013-12-24 2017-03-23 日本電気株式会社 トランザクション分散処理装置、方法、システム、および、記憶媒体
JP2016095638A (ja) * 2014-11-13 2016-05-26 日本電気株式会社 トランザクション処理装置、トラザクション処理方法、及びプログラム
US10303676B2 (en) 2014-11-13 2019-05-28 Nec Corporation Transaction processing apparatus, transaction processing method, and computer-readable recording medium
JP2019532419A (ja) * 2016-09-21 2019-11-07 アール−ストール インコーポレイテッド データ処理用の分散型台帳を使用するためのシステム及び方法
WO2018193638A1 (ja) * 2017-04-21 2018-10-25 株式会社Orb 計算機及びトランザクション処理方法

Also Published As

Publication number Publication date
JP5940074B2 (ja) 2016-06-29
US8930323B2 (en) 2015-01-06
US20130086018A1 (en) 2013-04-04
CN103814362B (zh) 2016-06-15
JPWO2013046883A1 (ja) 2015-03-26
CN103814362A (zh) 2014-05-21
GB201407561D0 (en) 2014-06-11
GB2511222A (en) 2014-08-27
DE112012004099T5 (de) 2014-07-17

Similar Documents

Publication Publication Date Title
JP5940074B2 (ja) トランザクション処理システム、方法及びプログラム
JP2013033345A (ja) トランザクション処理システム、方法及びプログラム
US7769789B2 (en) High performant row-level data manipulation using a data layer interface
JP5536568B2 (ja) トランザクションを集約して処理する方法、システム、およびプログラム
EP2932370B1 (en) System and method for performing a transaction in a massively parallel processing database
EP2596425B1 (en) Membership tracking and data eviction in mobile middleware scenarios
US9268834B2 (en) Distributed SQL query processing using key-value storage system
US9760584B2 (en) Systems and methods for supporting inline delegation of middle-tier transaction logs to database
US9336262B2 (en) Accelerated transactions with precommit-time early lock release
US20110161281A1 (en) Distributed Transaction Management in a Distributed Shared Disk Cluster Environment
US20060190504A1 (en) Simulating multi-user activity while maintaining original linear request order for asynchronous transactional events
EP2800013B1 (en) Integration database framework
SG189412A1 (en) Online database availability during upgrade
US8600962B2 (en) Transaction processing device, transaction processing method, and transaction processing program
US20210365440A1 (en) Distributed transaction execution management in distributed databases
US20150319265A1 (en) Unique identifier for a transaction
Asano et al. Flexible framework for data integration and update propagation: system aspect
US9177008B1 (en) Positioned updates in a distributed shared-nothing data store
US11681687B2 (en) Executing transactions on distributed databases
JP2007011550A (ja) プログラム制御方法、計算機および計算機制御プログラム
Padmanabhuni et al. An approach to automating transaction management in a Data Services Platform
Le et al. A mobile database sharing protocol to increase data availability in mobile environments

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: 12835326

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2013536012

Country of ref document: JP

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 112012004099

Country of ref document: DE

Ref document number: 1120120040996

Country of ref document: DE

ENP Entry into the national phase

Ref document number: 1407561

Country of ref document: GB

Kind code of ref document: A

Free format text: PCT FILING DATE = 20120720

WWE Wipo information: entry into national phase

Ref document number: 1407561.8

Country of ref document: GB

122 Ep: pct application non-entry in european phase

Ref document number: 12835326

Country of ref document: EP

Kind code of ref document: A1