-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alternator: support "global tables" #5062
Comments
After the lengthy description, a short summary. If we want to be 100% compatible with DynamoDB's semantics of global vs. local tables,
|
Update: AWS announced two days ago, here, that it is now possible to take an existing local (normal) table, and make it into a global table. The new API described here and here adds to the So we need to support this feature too, which probably means that each Alternator table should be put in its own separate keyspace, so that its global distribution can be changed in the future independently of any other Alternator tables. We should probably make this change as soon as possible - changing this after we start to support upgrades will be messier. After a There are also two additional operations |
Since Dynamo does not have the notation of a Keyspace it makes sense |
A patch for #5611 and partially #5596 was committed, so that the current state of Alternator is:
In #5611 I explained how we can go from here to being more compatible with how DynamoDB does things, namely that tables start local but can later be made more global by joining it with additional empty tables or with new special commands. I'll copy what I proposed there: We need a way which will support all the possible ways that global and local tables are used and created, and keeping in mind that Scylla does not currently allow moving tables between keyspaces, and doesn't even allow renaming tables or keyspaces. This isn't trivial, and I propose the following plan:
|
DynamoDB did not originally support replication between different geographical regions: A table called “xyz” on one AWS region is completely separate from a table with the same name “xyz” in a different region. "global tables" is a replication solution across zones: It allows a customer to specify a table in several regions, and Amazon automatically synchronizes (via Dynamo’s CDC “Streams”) updates to these separate tables between the different regions. The customer is charged for the different writes to the different tables, and for the Streams activity used to maintain this synchronization.
Requests - reads and writes - to the global table can go to any one of the regions participating in the global table (the client decides to which region to send each request). Writes provide a “last writer wins” policy: If writes are done to multiple regions concurrently, the newest write (in wall-clock time) will eventually spread to the rest of the regions and replace the older writes.
A global table does not support strongly-consistent reads in the same sense as normal tables. A strongly-consistent read is only guaranteed to return the last written data if this write was done in the same region (otherwise, it will take more time until the update spreads between zones - Amazon claims this take “within seconds”).
In Alternator, we can implement multi-region (“global”) tables without CDC, and instead simply use Scylla’s existing multi-DC support: We can set up a keyspace with multiple DCs, one in each region, with RF=3 replication in each region. We already do writes with
LOCAL_QUORUM
, and reads withLOCAL_QUORUM
(“strong consistency”) orLOCAL_ONE
(“weak consistency”), and we will achieve the same consistency as guaranteed by DynamoDB. Also the conditional updates we should do with LWT withLOCAL_SERIAL
consistency so they are only guaranteed to be serialized inside a single data center - which is what DynamoDB guarantees.In DynamoDB, to create a global table one first creates an identically-configured table in several regions with no data, and then uses the
CreateGlobalTable
operation to join them into a global table. We can support this operation by havingCreateGlobalTable
delete the empty tables from the individual-region’s keyspace, and creating an identical (and empty) one in its own keyspace.The
UpdateGlobalTable
operation can be used to add another region to a global table, or remove one. Scylla supports changing the replication strategy of the global table’s keyspace, however we may need to also run repair on this keyspace in added data center and/or cleanup in the removed data center. Again the add region operation requires that an empty identical table exists in the new region, and we can remove that table as part of the operation.DynamoDB does not support taking an existing single-region table, with data, and converting it into a global table (UPDATE Nov 2019: this is no longer true - see additional comment below). In Alternator we could support this feature even though DynamoDB doesn’t. It would require either putting each table in its own keyspace in advance, or alternatively adding an ability to move an existing table between keyspaces.
We need to also implement additional operations:
DescribeGlobalTable
to inquire about the configuration of a global tableListGlobalTables
to get a list of global tables, or just those that have a replica in a specific region.UpdateGlobalTableSettings
operation. To inquire about the current settings of a global table, there isDescribeGlobalTableSettings
.The text was updated successfully, but these errors were encountered: