Applying operations to replicas of a global table based on homing rules and item attribute values
Systems and methods are disclosed to implement, in a database service, applying operations to replicas of a global table based on homing rules and item attribute values. In embodiments, an instance of a database service may receive, from a client, a request to write an item to a global table. The instance may store the item at one or more replica tables at one or more different regions based a homing rule for the global table and one or more attribute values of the item.
1 . A system, comprising:
one or more hardware processors with associated memory that implement an instance of a database service, configured to:
receive a request to add an item comprising a plurality of attributes having corresponding values to a global table of the database service, wherein the global table comprises a plurality of replica tables that are respectively located at different instances of different regions of the database service, and wherein individual tables of the plurality of replica tables comprise a plurality of items of the global table, and wherein individual items of the plurality of items comprise a plurality of attributes having corresponding values; and
based at least on the received request to add the item to the global table and on a homing rule that defines logic to be applied to the plurality of values of the plurality of attributes of the item to determine replica tables, of the plurality of replica tables, to add the item to within a first subset of the different regions, cause the item to be added to the determined replica tables located at the first subset of the different regions, wherein the item is not added to replica tables, of the plurality of replica tables, located at a second subset of the different regions, and
wherein the logic of the homing rule indicates that the item is to exist at the first subset of different regions and that the item is not to exist at the second subset of different regions based on the plurality of values of the plurality of attributes of the item.
2 . The system of claim 1 , wherein the instance of the database service is at a first region of the database service, and wherein the instance is further configured to perform:
responsive to reception of the request to add the item to the global table, add the item to a local replica table of the instance, wherein the instance is located at a region of the different regions, and wherein, based on the plurality of values of the plurality of attributes, the homing rule indicates that the item is to exist at the region.
3 . The system of claim 2 , wherein to cause the item to be added to one or more of the plurality of replica tables located at one or more of the different regions, the instance of the service is configured to perform:
based at least on the homing rule and the plurality of values of the attributes of the item, replicate the item from the local replica table to the one or more replica tables located at the one or more different regions.
4 . The system of claim 1 , wherein the instance of the service is configured to perform:
receive a request to add another item to the global table of the database service; and
based at least on the homing rule and a plurality of other values of a plurality of attributes of the other item to be added to the global table, cause the item to be added to another plurality of the replica tables that includes at least one replica table that is not present in the one or more of the plurality of replica tables that the item was added to.
5 . The system of claim 1 , wherein the instance of the service is further configured to perform:
receive, via an interface, an indication of a change to the homing rule;
update the homing rule based on the indicated change; and
update one or more of the plurality of replica tables based on the updated homing rule.
6 . A method comprising:
performing, by one or more hardware processors with associated memory implementing an instance of a database service:
receiving a request to add an item comprising a plurality of attributes having corresponding values to a global table of the database service,
wherein the global table comprises a plurality of replica tables that are respectively located at different instances of different regions of the database service, and wherein individual tables of the plurality of replica tables comprise a plurality of items of the global table, and wherein individual items of the plurality of items comprise a plurality of attributes having corresponding values; and
based at least on the received request to add the item to the global table and on a homing rule that defines logic to be applied to one or more values of one or more attributes of the item to determine replica tables, of the plurality of replica tables, to add the item to within a first subset of the different regions, causing the item to be added to the determined replica tables located at the first subset of the different regions, and
wherein the logic of the homing rule indicates that the item is to exist at the first subset of different regions and that the item is not to exist at a second subset of the different regions based on the one or more values of the one or more attributes of the item.
7 . The method of claim 6 , wherein the instance of the database service is at a first region of the database service, and further comprising:
responsive to receiving the request to add the item to the global table, performing one or more of:
adding the item to a local replica table of the instance, or
forwarding the request to add the item to one or more other instances of the database service at one or more other regions.
8 . The method of claim 6 , wherein causing the item to be added to one or more of the plurality of replica tables located at one or more of the different regions comprises:
based at least on the homing rule and the one or more values of the one or more attributes of the item, replicating the item from the local replica table to the one or more replica tables located at the one or more different regions.
9 . The method of claim 6 , further comprising:
receiving a request to add another item to the global table of the database service; and
based at least on the homing rule and one or more other values of one or more attributes of the other item to be added to the global table, causing the other item to be added to another plurality of the replica tables that includes at least one replica table that is not present in the one or more of the plurality of replica tables that the item was added to.
10 . The method of claim 6 , further comprising:
receiving, via an interface, an indication of a change to the homing rule;
updating the homing rule based on the indicated change; and
updating one or more of the plurality of replica tables based on the updated homing rule.
11 . The method of claim 10 , wherein the updating of the one or more of the plurality of replica tables comprises, for a given replica table of the one or more replica tables:
based at least on the updated homing rule and the one or more values of the one or more attributes of the item, determine whether the item is to exist at the given replica table.
12 . The method of claim 6 , further comprising:
receiving a request to add another item to the global table of the database service; and
based at least the homing rule not matching the other item, causing the item to be added to one or more tables of a group of replica tables previously identified to store items that do not match homing rules.
13 . The method of claim 6 , further comprising:
adding, to a change capture log, an indication of the one or more replica tables that the item was added to.
14 . The method of claim 6 , wherein the homing rule defines a logical relationship between a plurality of attributes of the item, and wherein the database service applies logic, based on the homing rule, to values of the plurality of attributes to determine the one or more of the different regions to add the item to.
15 . One or more non-transitory computer-accessible storage media storing program instructions that when executed on or across one or more processors of an instance of a database service, cause the database service to:
receive a request to add an item comprising a plurality of attributes having corresponding values to a global table of the database service, wherein the global table comprises a plurality of replica tables that are respectively located at different instances of different regions of the database service, and wherein individual tables of the plurality of replica tables comprise a plurality of items of the global table, and wherein individual items of the plurality of items comprise a plurality of attributes having corresponding values; and
based at least on the received request to add the item to the global table and on a homing rule that defines logic to be applied to one or more values of one or more attributes of the item to determine replica tables, of the plurality of replica tables, to add the item to within a first subset of the different regions, cause the item to be added to the determined replica tables located at the first subset of the different regions, and
wherein the logic of the homing rule indicates that the item is to exist at the first subset of different regions and that the item is not to exist at a second subset of the different regions based on the one or more values of the one or more attributes of the item.
16 . The one or more non-transitory computer-accessible storage media of claim 15 , wherein the instance of the database service is at a first region of the database service, and wherein the program instructions when executed on or across the one or more processors cause the instance to:
responsive to reception of the request to add the item to the global table, add the item to a local replica table of the instance, wherein the instance is located at a region of the different regions, and wherein, based on the one or more values of the one or more attributes, the homing rule indicates that the item is to exist at the region.
17 . The one or more non-transitory computer-accessible storage media of claim 16 , wherein to cause the item to be added to one or more of the plurality of replica tables located at one or more of the different regions, the program instructions when executed on or across the one or more processors cause the instance to:
based at least on the homing rule and the one or more values of the one or more attributes of the item, replicate the item from the local replica table to the one or more replica tables located at the one or more different regions.
18 . The one or more non-transitory computer-accessible storage media of claim 15 , wherein the program instructions when executed on or across the one or more processors cause the instance to:
receive a request to add another item to the global table of the database service; and
based at least on the homing rule and one or more values of one or more attributes of the other item to be added to the global table, cause the other item to be added to another plurality of the replica tables that includes at least one replica table that is not present in the one or more of the plurality of replica tables that the item was added to.
19 . The one or more non-transitory computer-accessible storage media of claim 15 , wherein the program instructions when executed on or across the one or more processors cause the instance to:
receive, via an interface, an indication of a change to the homing rule;
update the homing rule based on the indicated change; and
update one or more of the plurality of replica tables based on the updated homing rule.
20 . The one or more non-transitory computer-accessible storage media of claim 15 , wherein the program instructions when executed on or across the one or more processors cause the instance to:
add, to a change capture log, an indication of the one or more replica tables that the item was added to.