Restoring Retired Storage Locations

You can restore a previously retired storage location that continues to be used in queries. After the location is restored, Vertica re-ranks the storage location and uses the restored location to process queries as determined by its rank.

Use the meta-function RESTORE_LOCATION function to restore a retired storage location.

The following example shows how to restore a retired storage location on v_vmartdb_node0004:

=> SELECT RESTORE_LOCATION('/secondVerticaStorageLocation/' , 'v_vmartdb_node0004');

To restore a storage location on all nodes, use an empty string ('') for the second parameter. The following example demonstrates creating, retiring, and restoring a location on all nodes:

=> CREATE LOCATION '/tmp/ab1' all nodes usage 'TEMP';
CREATE LOCATION
		
=> select retire_location('/tmp/ab1', '');
retire_location     
------------------------
/tmp/ab1 retired.
	(1 row)		
				
=> SELECT location_id, node_name, location_path, location_usage, is_retired 
          FROM STORAGE_LOCATIONS WHERE location_path ILIKE '/tmp/ab1';
location_id       | node_name           | location_path | location_usage | is_retired   
------------------+---------------------+---------------+----------------+------------
45035996273736724 | v_vmart_node0001    | /tmp/ab1      | TEMP           | t          
45035996273736726 | v_vmart_node0002    | /tmp/ab1      | TEMP           | t          
45035996273736728 | v_vmart_node0003    | /tmp/ab1      | TEMP           | t          
45035996273736730 | v_vmart_node0004    | /tmp/ab1      | TEMP           | t          
	(4 rows)

=> select restore_location('/tmp/ab1', '');
restore_location     
-------------------------
/tmp/ab1 restored.
	(1 row)

=> SELECT location_id, node_name, location_path, location_usage, is_retired 
          FROM STORAGE_LOCATIONS WHERE location_path ILIKE '/tmp/ab1';
location_id       | node_name           | location_path | location_usage | is_retired  
------------------+---------------------+---------------+----------------+------------
45035996273736724 | v_vmart_node0001    | /tmp/ab1      | TEMP           | f          
45035996273736726 | v_vmart_node0002    | /tmp/ab1      | TEMP           | f          
45035996273736728 | v_vmart_node0003    | /tmp/ab1      | TEMP           | f          
45035996273736730 | v_vmart_node0004    | /tmp/ab1      | TEMP           | f          

(4 rows)	

RESTORE_LOCATION restores the location only on the nodes where the location exists and is retired. The meta-function does not propagate the storage location to nodes where that location did not previously exist.

Restoring on all nodes fails if the location has been dropped on any of them. If you have dropped the location on some nodes, you have two options:

  • If you no longer want to use the dropped node, restore the location individually on each of the other nodes.
  • Alternatively, you can re-create the location on the node where you dropped it. To do so, use CREATE LOCATION. After you re-create the location, you can then restore it on all nodes.

The following example demonstrates the failure if you try to restore on nodes where you have dropped the location:

=> SELECT retire_location('/tmp/ab1', '');
retire_location     
------------------------
/tmp/ab1 retired.
	(1 row)
				
=> SELECT drop_location('/tmp/ab1', 'v_vmart_node0002');
drop_location      
------------------------
/tmp/ab1 dropped.
	(1 row)

==> SELECT location_id, node_name, location_path, location_usage, is_retired 
          FROM STORAGE_LOCATIONS WHERE location_path ILIKE '/tmp/ab1';
location_id       | node_name           | location_path | location_usage | is_retired  
------------------+---------------------+---------------+----------------+------------
45035996273736724 | v_vmart_node0001    | /tmp/ab1      | TEMP           | t          
45035996273736728 | v_vmart_node0003    | /tmp/ab1      | TEMP           | t          
45035996273736730 | v_vmart_node0004    | /tmp/ab1      | TEMP           | t          
	(3 rows)

=> SELECT restore_location('/tmp/ab1', '');
ERROR 2081:  [/tmp/ab1] is not a valid storage location on node v_vmart_node0002