Adding a key column to a table to be replicated
AssigneeInternational Business Machines Corporation
InventorsPrasad S. Mujumdar, Clarence M. Pruet, III
Life of this patent
Estimating the term…
Abstract
Techniques are disclosed for adding a key column to a table to be replicated, where the key column stores key values for use in replication. In one embodiment, a request is received to add a table to a replication domain, such that the table is replicated from a first database server to at least a second database server. Key values are generated for both existing records and new records subsequently requested to be inserted into the table, respectively. Each generated key value is unique across the replication domain. Further, the key column may be added to the table without requiring exclusive access to the table.
Claims11
A computer-implemented method, comprising:
- receiving a request to add a table to a replication domain, such that the table is replicated from a first database server to at least a second database server, wherein the table includes at least a first record;
- responsive to the request, generating a key value for the first record on the first database server, wherein the key value for the first record is generated by concatenating a table identifier for the table, a row identifier of the first record, and a node identifier of the first database server;
- subsequent to receiving the request, receiving a second record to be inserted into the table on the first database server;
- and
- by operation of one or more computer processors, generating a key value for the second record on the first database server, wherein the key value for the second record is generated by concatenating a first counter maintained by the first database server, a second counter maintained by the first database server, and the node identifier;
- wherein each generated key value is unique across the replication domain, wherein a column is added to the table to store the generated key values, and wherein the column is added without requiring exclusive access to the table.
A computer program product, comprising:
- a non-transitory computer-readable storage medium having computer-readable program code embodied therewith, wherein the computer-readable program code, when executed, performs an operation comprising:
- receiving a request to add a table to a replication domain, such that the table is replicated from a first database server to at least a second database server, wherein the table includes at least a first record;
- responsive to the request, generating a key value for the first record on the first database server, wherein the key value for the first record is generated by concatenating a table identifier for the table, a row identifier of the first record, and a node identifier of the first database server;
- subsequent to receiving the request, receiving a second record to be inserted into the table on the first database server;
- and
- generating a key value for the second record on the first database server, wherein the key value for the second record is generated by concatenating a first counter maintained by the first database server, a second counter maintained by the first database server, and the node identifier;
- wherein each generated key value is unique across the replication domain, wherein a column is added to the table to store the generated key values, and wherein the column is added without requiring exclusive access to the table.
A computer program product, comprising:
- a non-transitory computer-readable storage medium having computer-readable program code embodied therewith, wherein the computer-readable program code, when executed, performs an operation comprising:
- receiving a request to add a table to a replication domain, such that the table is replicated from a first database server to at least a second database server, wherein the table includes at least a first record;
- responsive to the request, generating a key value for the first record on the first database server;
- subsequent to receiving the request, receiving a second record to be inserted into the table on the first database server;
- and
- generating a key value for the second record on the first database server;
- wherein each generated key value is unique across the replication domain, wherein a column is added to the table to store the generated key values, and wherein the column is added without requiring exclusive access to the table, wherein the first database server is configured to increment the first counter upon a first period of time elapsing, and wherein the first database server is further configured to increment the second counter upon a row being inserted into the first database server, wherein the first counter is logged upon a second period of time elapsing, and wherein upon restarting the first database server, the logged first counter is retrieved and increased by at least the second period of time divided by the first period of time, to prevent collision with any key value generated prior to restarting the first database server.
A system, comprising:
- one or more computer processors;
- a memory containing a program, which when executed by the one or more computer processors is configured to perform an operation comprising:
- receiving a request to add a table to a replication domain, such that the table is replicated from a first database server to at least a second database server, wherein the table includes at least a first record;
- responsive to the request, generating a key value for the first record on the first database server, wherein the key value for the first record is generated by concatenating a table identifier for the table, a row identifier of the first record, and a node identifier of the first database server;
- subsequent to receiving the request, receiving a second record to be inserted into the table on the first database server;
- and
- generating a key value for the second record on the first database server, wherein the key value for the second record is generated by concatenating a first counter maintained by the first database server, a second counter maintained by the first database server, and the node identifier;
- wherein each generated key value is unique across the replication domain, wherein a column is added to the table to store the generated key values, and wherein the column is added without requiring exclusive access to the table.
Dependencies are inferred from the claim text.