Removing a Storage Group from an Archive

To remove a storage group from an archive, use the remove storage-group command. This command takes the following arguments:

  • The name of the database.

  • The name of the storage group.

  • The archive ID.

Before removing a storage group from an archive, you can review storage groups in place using the get storage-groups command.

nuocmd get storage-groups --db-name companydata
StorageGroup(archive_states={}, db_name=companydata, id=1, leader_candidates=[], name=ALL, process_states={}, state=Available)
StorageGroup(archive_states={0: ADDED}, db_name=companydata, id=10, leader_candidates=[0], name=SGEAST, process_states={0: RUNNING}, state=Available)
StorageGroup(archive_states={1: ADDED}, db_name=companydata, id=11, leader_candidates=[5], name=SGWEST, process_states={5: RUNNING}, state=Available)
StorageGroup(archive_states={}, db_name=companydata, id=2, leader_candidates=[0, 5], name=UNPARTITIONED, process_states={0: RUNNING, 5: RUNNING}, state=Available)

The following example removes the sgwest storage group from archive 1 of the companydata database:

nuocmd remove storage-group --db-name companydata --sg-name sgwest --archive-ids 1
get storage-groups and remove storage-group are issued using NuoDB Command (nuocmd). For more information on NuoDB Command and other command line tools, see Command Line Tools.

Removing the association between a storage group and an archive when the archive is the last one servicing the storage group is possible only if the storage group is empty. If the storage group is not empty, the state of the storage group will transition to PENDING_REMOVAL. After running remove storage-group, you may review storage groups in place using the get storage-groups command.

nuocmd get storage-groups --db-name companydata
StorageGroup(archive_states={}, db_name=companydata, id=1, leader_candidates=[], name=ALL, process_states={}, state=Available)
StorageGroup(archive_states={0: ADDED}, db_name=companydata, id=10, leader_candidates=[0], name=SGEAST, process_states={0: RUNNING}, state=Available)
StorageGroup(archive_states={1: PENDING_REMOVAL}, db_name=companydata, id=11, leader_candidates=[5], name=SGWEST, process_states={5: RUNNING}, state=Available)
StorageGroup(archive_states={}, db_name=companydata, id=2, leader_candidates=[0, 5], name=UNPARTITIONED, process_states={0: RUNNING, 5: RUNNING}, state=Available)

Limitations

The following limitations apply when removing a storage group:

  • A storage group cannot be removed if it is not empty unless another archive is serving it.

  • A storage group cannot be removed if there are other archives serving it but none of them are in a RUNNING state.

A storage group can only be removed if it is not being used by any tables. Tables can only be garbage collected if they can not be seen by any transaction in the system. Given this requirement, there can be a long delay between dropping a table and the storage group becoming unused. For information on dropping tables, see DROP TABLE.