Use Case 4: Drop a Region
An organization deploys three on-premise KVStores, one each at Frankfurt, London, and Dublin. As per their requirement, they created a few MR Tables in all three regions. As part of business down-sizing, they decided to exclude the Dublin region resulting in a two-region NoSQL Database. In the next few topics, you learn how to drop an existing region from the NoSQL environment that you had set up in the previous sections.
Prerequisites
Learn about the conditions to be satisfied before dropping a region from a Multi-Region NoSQL Database.
- Stop writing to all the MR Tables linked to that region.
- Ensure that all writes to the MR Tables in that region have synchronized with other regions. This helps in maintaining consistent data across the different regions.
Note:
As of the current release, there is no provision in Oracle NoSQL Database to make a table read-only. Hence, you must stop writes to the identified MR Tables at the application level.Isolate the Region
Learn how to isolate a region from a Multi-Region NoSQL Database.
When you decide to drop a region, it is a good practice to isolate that region from all the other participating regions. Isolating a region disconnects it from all the MR Tables in the Multi-Region NoSQL Database.
DUBcannot see writes from the remaining regions, that is,FRAandLND.- Regions
FRAandLNDcannot see writes from theDUBregion.
Note:
Even though it is not mandatory to isolate the region before dropping it from a Multi-Region NoSQL Database, this is considered a cleaner approach and hence suggested.- Dropping the target region from all the MR Tables in the other participating
regions.
- Dropping all the other regions from all the MR Tables in the region to be
isolated.
Verifying that the DUB region is dropped from the Users
table in the Frankfurt (FRA) region:
kv-> show table -name Users
{
"json_version" : 1,
"type" : "table",
"name" : "Users",
"shardKey" : [ "id" ],
"primaryKey" : [ "id" ],
"fields" : [ {
"name" : "id",
"type" : "INTEGER",
"nullable" : false,
"default" : null
}, {
"name" : "name",
"type" : "STRING",
"nullable" : true,
"default" : null
}, {
"name" : "team",
"type" : "STRING",
"nullable" : true,
"default" : null
} ],
"regions" : {
"2" : "LND",
"1" : "FRA"
}
}
Verifying that the DUB region is dropped from the Users
table in the London (LND) region:
kv-> show table -name Users
{
"json_version" : 1,
"type" : "table",
"name" : "Users",
"shardKey" : [ "id" ],
"primaryKey" : [ "id" ],
"fields" : [ {
"name" : "id",
"type" : "INTEGER",
"nullable" : false,
"default" : null
}, {
"name" : "name",
"type" : "STRING",
"nullable" : true,
"default" : null
}, {
"name" : "team",
"type" : "STRING",
"nullable" : true,
"default" : null
} ],
"regions" : {
"2" : "FRA",
"1" : "LND"
}
}
Verifying that the FRA and LND regions
are dropped from the Users table in the Dublin
(DUB) region:
kv-> show table -name Users
{
"json_version" : 1,
"type" : "table",
"name" : "Users",
"shardKey" : [ "id" ],
"primaryKey" : [ "id" ],
"fields" : [ {
"name" : "id",
"type" : "INTEGER",
"nullable" : false,
"default" : null
}, {
"name" : "name",
"type" : "STRING",
"nullable" : true,
"default" : null
}, {
"name" : "team",
"type" : "STRING",
"nullable" : true,
"default" : null
} ],
"regions" : {
"1" : "DUB"
}
}
Drop MR Tables in the Isolated Region
After you ensure that the region to be dropped is isolated, you can drop all the MR Tables created in that region safely. Dropping an MR Table is exactly similar to dropping a local table.
- To drop the
UsersMR Table from theDUBregion, execute the following command from thekvprompt.kv-> execute 'drop table Users' - Optionally, you can execute the following command to verify that the
Userstable is dropped successfully.kv-> show tables
Drop the Isolated Region
Note:
Dropping an isolated region is not mandatory. You can retain the isolated region without dropping from other regions, for any future use.Verifying that the DUB region is dropped from the
Frankfurt (FRA) region:
kv-> execute 'show regions'
regions
FRA (local, active)
LND (remote, active)
Verifying that the DUB region is dropped from the
London (LND) region:
kv-> execute 'show regions'
regions
LND (local, active)
FRA (remote, active)