Skip to main content

Class RestoreBackupRequest

java.lang.Object
com.gpudb.protocol.RestoreBackupRequest
All Implemented Interfaces:
org.apache.avro.generic.GenericContainer, org.apache.avro.generic.IndexedRecord

public class RestoreBackupRequest extends Object implements org.apache.avro.generic.IndexedRecord
A set of parameters for GPUdb.restoreBackup.

Restores database objects from a backup accessible via the data source specified by datasourceName.

  • Constructor Details

    • RestoreBackupRequest

      public RestoreBackupRequest()
      Constructs a RestoreBackupRequest object with default parameters.
    • RestoreBackupRequest

      public RestoreBackupRequest(String backupName, Map<String,String> restoreObjectsMap, String datasourceName, Map<String,String> options)
      Constructs a RestoreBackupRequest object with the specified parameters.
      Parameters:
      backupName - Name of the backup to restore from, which must refer to an existing backup. The default value is ”.
      restoreObjectsMap - Map of database objects to be restored from the backup.
      datasourceName - Data source through which the backup will be restored.
      options - Optional parameters.
      • BACKUP_ID: ID of the snapshot to restore. Leave empty to restore the most recent snapshot in the backup. The default value is ”.
      • CHECKSUM: Whether or not to verify checksums for backup files when restoring. Supported values:The default value is FALSE.
      • CASCADE_FOREIGN_KEYS: Whether to drop live foreign-key-referencing tables that are not themselves part of the backup, when the table they reference is being replaced. Only applies when RESTORE_POLICY is REPLACE. Supported values:
        • TRUE: Drop any live table whose foreign key references a table being replaced, even when that table is not in the backup and therefore will not be restored.
        • FALSE: Fail the restore of a table that is referenced by a live foreign-key table which is not part of the backup, rather than destroying data the backup cannot restore.
        The default value is FALSE.
      • CREATE_SCHEMA_IF_NOT_EXIST: Behavior to apply when the schema containing any database object to restore does not already exist. Supported values:
        • TRUE: If the schema containing any restored object does not exist, create it automatically.
        • FALSE: If the schema containing any restored object does not exist, return an error.
        The default value is TRUE.
      • DDL_ONLY: Behavior to apply when restoring tables. Supported values:
        • TRUE: Restore table DDL, but do not restore data.
        • FALSE: Restore tables and their data.
        The default value is FALSE.
      • DRY_RUN: Whether or not to perform a dry run of the restoration operation. With a RESTORE_POLICY of CLEAN or CLEAN_ALL, a dry run lists the objects the clean would drop in the CLEAN_DROPPED_OBJECTS entry of the response info map and drops nothing, and fails as the restore would if the clean is refused. Supported values:The default value is FALSE.
      • RESTORE_SUBSCRIPTIONS: Behavior to apply when restoring datasource subscriptions on tables. Supported values:
        • RESUME: Resume subscriptions that were active when the backup was made.
        • PAUSE: Pause subscriptions that were active when the backup was made.
        • CANCEL: Cancel active subscriptions.
        The default value is RESUME.
      • REINGEST: Behavior to apply when restoring table data. Supported values:
        • TRUE: Restore table data by re-ingesting it. This is the default behavior if the cluster topology differs from that of the contained backup.
        • FALSE: Restore the persisted data files directly.
        The default value is FALSE.
      • RENAMED_OBJECTS_SCHEMA: If the RESTORE_POLICY is RENAME, use this schema for relocated existing objects instead of the default generated one. The default value is ”.
      • RESTORE_ALL_PERMISSIONS: Whether or not all permissions of restored principals should be restored or scoped to the restored objects. When RESTORE_POLICY is CLEAN or CLEAN_ALL, the default is TRUE: the clean drops each principal in scope along with all of its permissions, including those on objects it does not drop. Supported values:
        • TRUE: Restore all permissions.
        • FALSE: Restore only permissions on restored objects.
        The default value is FALSE.
      • RESTORE_POLICY: Behavior to apply when any database object to restore already exists. Supported values:
        • NONE: If an object to be restored already exists with the same name, abort and return error.
        • REPLACE: If an object to be restored already exists with the same name, replace it with the backup version. Only objects in the backup are dropped; existing objects that are not in the backup are kept, so the result is a merge of the backup into the database. To drop those as well, use CLEAN.
        • RENAME: If an object to be restored already exists with the same name, move that existing one to the schema specified by RENAMED_OBJECTS_SCHEMA. This policy does not apply to non-schema objects.
        • CLEAN: Before restoring, drop every existing object of each object type being restored, whether or not that object is in the backup, including objects that are not persisted; object types not being restored are left untouched, and schemas are not dropped. Unlike REPLACE, the clean is scoped by object type, not by name: restoring a single table drops every table in the database first, and the response warns when the objects to restore name specific objects of a type rather than all of them. Use DRY_RUN to list the objects that would be dropped. The restore is refused, before anything is dropped, if an object that would be dropped is still used by an object of a type that is not being restored, or cannot be dropped, such as a table locked by a backup in progress. As graphs, contexts, table monitors and stored procedures all depend on tables, restoring tables requires restoring each of those types of which any objects exist. A data sink generated for a monitor is dropped along with the monitor, and a home directory only along with its user. Objects created by other sessions while the restore runs are not dropped. If the restore fails after the clean, the dropped objects are not put back. System objects, the data source being restored from and its credential, the calling user and admin, with their default schemas, home directories and resource groups, and the calling user’s roles are never dropped, nor are the schemas holding any of these. Requires system administrator permission.
        • CLEAN_ALL: Before restoring, drop every existing object in the database, regardless of which objects are being restored, including users, roles, non-system schemas and objects that are not persisted. The restore is refused, before anything is dropped, if an object cannot be dropped, such as a table locked by a backup in progress, or is still used by an object the clean keeps, such as a resource group a system user is in; it also requires CREATE_SCHEMA_IF_NOT_EXIST to be TRUE. If the restore fails after the clean, the dropped objects are not put back. System objects, the data source being restored from and its credential, the calling user and admin, with their default schemas, home directories and resource groups, and the calling user’s roles are never dropped, nor are the schemas holding any of these. Requires system administrator permission.
        The default value is NONE.
      • TARGET_SCHEMA_MAP: Restore schema-based objects to alternate schema. Value is a comma delimitted list of key:value pairs mapping the original (source) schema name as it exists in the backup to a target (destination) schema namespace: “src: dst [, src: dst [, …]]”. Note that schema names are case sensitive and must adhere to the database schema naming criteria. The default value is ”.
      The default value is an empty Map.
  • Method Details

    • getClassSchema

      public static org.apache.avro.Schema getClassSchema()
      This method supports the Avro framework and is not intended to be called directly by the user.
      Returns:
      The schema for the class.
    • getBackupName

      public String getBackupName()
      Name of the backup to restore from, which must refer to an existing backup. The default value is ”.
      Returns:
      The current value of backupName.
    • setBackupName

      public RestoreBackupRequest setBackupName(String backupName)
      Name of the backup to restore from, which must refer to an existing backup. The default value is ”.
      Parameters:
      backupName - The new value for backupName.
      Returns:
      this to mimic the builder pattern.
    • getRestoreObjectsMap

      public Map<String,String> getRestoreObjectsMap()
      Map of database objects to be restored from the backup.
      Returns:
      The current value of restoreObjectsMap.
    • setRestoreObjectsMap

      public RestoreBackupRequest setRestoreObjectsMap(Map<String,String> restoreObjectsMap)
      Map of database objects to be restored from the backup.
      Parameters:
      restoreObjectsMap - The new value for restoreObjectsMap.
      Returns:
      this to mimic the builder pattern.
    • getDatasourceName

      public String getDatasourceName()
      Data source through which the backup will be restored.
      Returns:
      The current value of datasourceName.
    • setDatasourceName

      public RestoreBackupRequest setDatasourceName(String datasourceName)
      Data source through which the backup will be restored.
      Parameters:
      datasourceName - The new value for datasourceName.
      Returns:
      this to mimic the builder pattern.
    • getOptions

      public Map<String,String> getOptions()
      Optional parameters.
      • BACKUP_ID: ID of the snapshot to restore. Leave empty to restore the most recent snapshot in the backup. The default value is ”.
      • CHECKSUM: Whether or not to verify checksums for backup files when restoring. Supported values:The default value is FALSE.
      • CASCADE_FOREIGN_KEYS: Whether to drop live foreign-key-referencing tables that are not themselves part of the backup, when the table they reference is being replaced. Only applies when RESTORE_POLICY is REPLACE. Supported values:
        • TRUE: Drop any live table whose foreign key references a table being replaced, even when that table is not in the backup and therefore will not be restored.
        • FALSE: Fail the restore of a table that is referenced by a live foreign-key table which is not part of the backup, rather than destroying data the backup cannot restore.
        The default value is FALSE.
      • CREATE_SCHEMA_IF_NOT_EXIST: Behavior to apply when the schema containing any database object to restore does not already exist. Supported values:
        • TRUE: If the schema containing any restored object does not exist, create it automatically.
        • FALSE: If the schema containing any restored object does not exist, return an error.
        The default value is TRUE.
      • DDL_ONLY: Behavior to apply when restoring tables. Supported values:
        • TRUE: Restore table DDL, but do not restore data.
        • FALSE: Restore tables and their data.
        The default value is FALSE.
      • DRY_RUN: Whether or not to perform a dry run of the restoration operation. With a RESTORE_POLICY of CLEAN or CLEAN_ALL, a dry run lists the objects the clean would drop in the CLEAN_DROPPED_OBJECTS entry of the response info map and drops nothing, and fails as the restore would if the clean is refused. Supported values:The default value is FALSE.
      • RESTORE_SUBSCRIPTIONS: Behavior to apply when restoring datasource subscriptions on tables. Supported values:
        • RESUME: Resume subscriptions that were active when the backup was made.
        • PAUSE: Pause subscriptions that were active when the backup was made.
        • CANCEL: Cancel active subscriptions.
        The default value is RESUME.
      • REINGEST: Behavior to apply when restoring table data. Supported values:
        • TRUE: Restore table data by re-ingesting it. This is the default behavior if the cluster topology differs from that of the contained backup.
        • FALSE: Restore the persisted data files directly.
        The default value is FALSE.
      • RENAMED_OBJECTS_SCHEMA: If the RESTORE_POLICY is RENAME, use this schema for relocated existing objects instead of the default generated one. The default value is ”.
      • RESTORE_ALL_PERMISSIONS: Whether or not all permissions of restored principals should be restored or scoped to the restored objects. When RESTORE_POLICY is CLEAN or CLEAN_ALL, the default is TRUE: the clean drops each principal in scope along with all of its permissions, including those on objects it does not drop. Supported values:
        • TRUE: Restore all permissions.
        • FALSE: Restore only permissions on restored objects.
        The default value is FALSE.
      • RESTORE_POLICY: Behavior to apply when any database object to restore already exists. Supported values:
        • NONE: If an object to be restored already exists with the same name, abort and return error.
        • REPLACE: If an object to be restored already exists with the same name, replace it with the backup version. Only objects in the backup are dropped; existing objects that are not in the backup are kept, so the result is a merge of the backup into the database. To drop those as well, use CLEAN.
        • RENAME: If an object to be restored already exists with the same name, move that existing one to the schema specified by RENAMED_OBJECTS_SCHEMA. This policy does not apply to non-schema objects.
        • CLEAN: Before restoring, drop every existing object of each object type being restored, whether or not that object is in the backup, including objects that are not persisted; object types not being restored are left untouched, and schemas are not dropped. Unlike REPLACE, the clean is scoped by object type, not by name: restoring a single table drops every table in the database first, and the response warns when the objects to restore name specific objects of a type rather than all of them. Use DRY_RUN to list the objects that would be dropped. The restore is refused, before anything is dropped, if an object that would be dropped is still used by an object of a type that is not being restored, or cannot be dropped, such as a table locked by a backup in progress. As graphs, contexts, table monitors and stored procedures all depend on tables, restoring tables requires restoring each of those types of which any objects exist. A data sink generated for a monitor is dropped along with the monitor, and a home directory only along with its user. Objects created by other sessions while the restore runs are not dropped. If the restore fails after the clean, the dropped objects are not put back. System objects, the data source being restored from and its credential, the calling user and admin, with their default schemas, home directories and resource groups, and the calling user’s roles are never dropped, nor are the schemas holding any of these. Requires system administrator permission.
        • CLEAN_ALL: Before restoring, drop every existing object in the database, regardless of which objects are being restored, including users, roles, non-system schemas and objects that are not persisted. The restore is refused, before anything is dropped, if an object cannot be dropped, such as a table locked by a backup in progress, or is still used by an object the clean keeps, such as a resource group a system user is in; it also requires CREATE_SCHEMA_IF_NOT_EXIST to be TRUE. If the restore fails after the clean, the dropped objects are not put back. System objects, the data source being restored from and its credential, the calling user and admin, with their default schemas, home directories and resource groups, and the calling user’s roles are never dropped, nor are the schemas holding any of these. Requires system administrator permission.
        The default value is NONE.
      • TARGET_SCHEMA_MAP: Restore schema-based objects to alternate schema. Value is a comma delimitted list of key:value pairs mapping the original (source) schema name as it exists in the backup to a target (destination) schema namespace: “src: dst [, src: dst [, …]]”. Note that schema names are case sensitive and must adhere to the database schema naming criteria. The default value is ”.
      The default value is an empty Map.
      Returns:
      The current value of options.
    • setOptions

      public RestoreBackupRequest setOptions(Map<String,String> options)
      Optional parameters.
      • BACKUP_ID: ID of the snapshot to restore. Leave empty to restore the most recent snapshot in the backup. The default value is ”.
      • CHECKSUM: Whether or not to verify checksums for backup files when restoring. Supported values:The default value is FALSE.
      • CASCADE_FOREIGN_KEYS: Whether to drop live foreign-key-referencing tables that are not themselves part of the backup, when the table they reference is being replaced. Only applies when RESTORE_POLICY is REPLACE. Supported values:
        • TRUE: Drop any live table whose foreign key references a table being replaced, even when that table is not in the backup and therefore will not be restored.
        • FALSE: Fail the restore of a table that is referenced by a live foreign-key table which is not part of the backup, rather than destroying data the backup cannot restore.
        The default value is FALSE.
      • CREATE_SCHEMA_IF_NOT_EXIST: Behavior to apply when the schema containing any database object to restore does not already exist. Supported values:
        • TRUE: If the schema containing any restored object does not exist, create it automatically.
        • FALSE: If the schema containing any restored object does not exist, return an error.
        The default value is TRUE.
      • DDL_ONLY: Behavior to apply when restoring tables. Supported values:
        • TRUE: Restore table DDL, but do not restore data.
        • FALSE: Restore tables and their data.
        The default value is FALSE.
      • DRY_RUN: Whether or not to perform a dry run of the restoration operation. With a RESTORE_POLICY of CLEAN or CLEAN_ALL, a dry run lists the objects the clean would drop in the CLEAN_DROPPED_OBJECTS entry of the response info map and drops nothing, and fails as the restore would if the clean is refused. Supported values:The default value is FALSE.
      • RESTORE_SUBSCRIPTIONS: Behavior to apply when restoring datasource subscriptions on tables. Supported values:
        • RESUME: Resume subscriptions that were active when the backup was made.
        • PAUSE: Pause subscriptions that were active when the backup was made.
        • CANCEL: Cancel active subscriptions.
        The default value is RESUME.
      • REINGEST: Behavior to apply when restoring table data. Supported values:
        • TRUE: Restore table data by re-ingesting it. This is the default behavior if the cluster topology differs from that of the contained backup.
        • FALSE: Restore the persisted data files directly.
        The default value is FALSE.
      • RENAMED_OBJECTS_SCHEMA: If the RESTORE_POLICY is RENAME, use this schema for relocated existing objects instead of the default generated one. The default value is ”.
      • RESTORE_ALL_PERMISSIONS: Whether or not all permissions of restored principals should be restored or scoped to the restored objects. When RESTORE_POLICY is CLEAN or CLEAN_ALL, the default is TRUE: the clean drops each principal in scope along with all of its permissions, including those on objects it does not drop. Supported values:
        • TRUE: Restore all permissions.
        • FALSE: Restore only permissions on restored objects.
        The default value is FALSE.
      • RESTORE_POLICY: Behavior to apply when any database object to restore already exists. Supported values:
        • NONE: If an object to be restored already exists with the same name, abort and return error.
        • REPLACE: If an object to be restored already exists with the same name, replace it with the backup version. Only objects in the backup are dropped; existing objects that are not in the backup are kept, so the result is a merge of the backup into the database. To drop those as well, use CLEAN.
        • RENAME: If an object to be restored already exists with the same name, move that existing one to the schema specified by RENAMED_OBJECTS_SCHEMA. This policy does not apply to non-schema objects.
        • CLEAN: Before restoring, drop every existing object of each object type being restored, whether or not that object is in the backup, including objects that are not persisted; object types not being restored are left untouched, and schemas are not dropped. Unlike REPLACE, the clean is scoped by object type, not by name: restoring a single table drops every table in the database first, and the response warns when the objects to restore name specific objects of a type rather than all of them. Use DRY_RUN to list the objects that would be dropped. The restore is refused, before anything is dropped, if an object that would be dropped is still used by an object of a type that is not being restored, or cannot be dropped, such as a table locked by a backup in progress. As graphs, contexts, table monitors and stored procedures all depend on tables, restoring tables requires restoring each of those types of which any objects exist. A data sink generated for a monitor is dropped along with the monitor, and a home directory only along with its user. Objects created by other sessions while the restore runs are not dropped. If the restore fails after the clean, the dropped objects are not put back. System objects, the data source being restored from and its credential, the calling user and admin, with their default schemas, home directories and resource groups, and the calling user’s roles are never dropped, nor are the schemas holding any of these. Requires system administrator permission.
        • CLEAN_ALL: Before restoring, drop every existing object in the database, regardless of which objects are being restored, including users, roles, non-system schemas and objects that are not persisted. The restore is refused, before anything is dropped, if an object cannot be dropped, such as a table locked by a backup in progress, or is still used by an object the clean keeps, such as a resource group a system user is in; it also requires CREATE_SCHEMA_IF_NOT_EXIST to be TRUE. If the restore fails after the clean, the dropped objects are not put back. System objects, the data source being restored from and its credential, the calling user and admin, with their default schemas, home directories and resource groups, and the calling user’s roles are never dropped, nor are the schemas holding any of these. Requires system administrator permission.
        The default value is NONE.
      • TARGET_SCHEMA_MAP: Restore schema-based objects to alternate schema. Value is a comma delimitted list of key:value pairs mapping the original (source) schema name as it exists in the backup to a target (destination) schema namespace: “src: dst [, src: dst [, …]]”. Note that schema names are case sensitive and must adhere to the database schema naming criteria. The default value is ”.
      The default value is an empty Map.
      Parameters:
      options - The new value for options.
      Returns:
      this to mimic the builder pattern.
    • getSchema

      public org.apache.avro.Schema getSchema()
      This method supports the Avro framework and is not intended to be called directly by the user.
      Specified by:
      getSchema in interface org.apache.avro.generic.GenericContainer
      Returns:
      The schema object describing this class.
    • get

      public Object get(int index)
      This method supports the Avro framework and is not intended to be called directly by the user.
      Specified by:
      get in interface org.apache.avro.generic.IndexedRecord
      Parameters:
      index - the position of the field to get
      Returns:
      value of the field with the given index.
      Throws:
    • put

      public void put(int index, Object value)
      This method supports the Avro framework and is not intended to be called directly by the user.
      Specified by:
      put in interface org.apache.avro.generic.IndexedRecord
      Parameters:
      index - the position of the field to set
      value - the value to set
      Throws:
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object