Skip to content
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

[BackupAndRestore] Support backup and restore view and external odbc table #5299

Merged
merged 4 commits into from
Jan 28, 2021

Conversation

EmmyMiao87
Copy link
Contributor

Proposed changes

  1. Support backup and restore view and odbc table. The syntax is the same as the backup and restore table.
  2. If the table associated with the view does not exist in the snapshot,
    the view can still be backed up successfully, but the TableNotFound exception will be thrown when querying the view.
  3. If the odbc table associated with the odbc resource, the odbc resource will be backuped and restored together.
  4. If the same view, odbc table and resource already exists in the database, it will compare whether the metadata of snapshot is consistent.
    If it is inconsistent, the restoration will fail.
  5. This pr also modified the json format of the backup information.
    A new_backup_objects object is added to the root node to store backup meta-information other than olap table,
    such as views and external tables.
    {
        "backup_objects": {},
        "new_backup_objects": {
            "view": [
                {"name": "view1", "id": "10001"}
            ],
            "odbc_table": [
                {"name":"xxx", xxx}
            ]
            "odbc_resources": [
                {"name": "bj_oracle"}
            ]
        }
    }
    
  6. This pr changes the serialization and deserialization method of backup information
    from manual construction to automatic analysis by Gson tools.

Change-Id: I216469bf2a6484177185d8354dcca2dc19f653f3

Types of changes

What types of changes does your code introduce to Doris?
Put an x in the boxes that apply

  • [] Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [] Documentation Update (if none of the other choices apply)
  • [] Code refactor (Modify the code structure, format the code, etc...)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • [] I have created an issue on (Fix Backup and Restore support view and external table #5298) and described the bug/feature there in detail
  • Compiling and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • [] If these changes need document changes, I have updated the document
  • [] Any dependent changes have been merged

…rnal odbc table

1. Support backup and restore view and odbc table. The syntax is the same as that of the backup and restore table.
2. If the table associated with the view does not exist in the snapshot,
   the view can still be backed up successfully, but the TableNotFound exception will be thrown when querying the view.
3. If the odbc table associated with the odbc resource, the odbc resource will be backuped and restored together.
4. If the same view, odbc table and resource already exists in the database, it will compare whether the metadata of snapshot is consistent.
   If it is inconsistent, the restoration will fail.
4. This pr also modified the json format of the backup information.
   A `new_backup_objects` object is added to the root node to store backup meta-information other than olap table,
   such as views and external tables.
   ```
   {
       "backup_objects": {},
       "new_backup_objects": {
           "view": [
               {"name": "view1", "id": "10001"}
           ],
           "odbc_table": [
               {"name":"xxx", xxx}
           ]
           "odbc_resources": [
               {"name": "bj_oracle"}
           ]
       }
   }
   ```
5. This pr changes the serialization and deserialization method of backup information
   from manual construction to automatic analysis by Gson tools.

Change-Id: I216469bf2a6484177185d8354dcca2dc19f653f3
@EmmyMiao87 EmmyMiao87 added kind/feature Categorizes issue or PR as related to a new feature. area/backup Issues of PRS related to backup and restore labels Jan 26, 2021
@morningman morningman added the kind/meta-version-change Categorizes issue or PR as related to changing meta version label Jan 26, 2021
@morningman morningman self-assigned this Jan 26, 2021
// read properties
size = in.readInt();
for (int i = 0; i < size; i++) {
properties.put(Text.readString(in), Text.readString(in));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better deser key and value line by line.

Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@morningman morningman added the approved Indicates a PR has been approved by one committer. label Jan 27, 2021
@EmmyMiao87 EmmyMiao87 merged commit 6bd22bc into apache:master Jan 28, 2021
EmmyMiao87 added a commit to EmmyMiao87/incubator-doris that referenced this pull request Apr 21, 2021
…table (apache#5299)

[BackupAndRestore] Support backup and restore view and external odbc table

1. Support backup and restore view and odbc table. The syntax is the same as that of the backup and restore table.
2. If the table associated with the view does not exist in the snapshot,
   the view can still be backed up successfully, but the TableNotFound exception will be thrown when querying the view.
3. If the odbc table associated with the odbc resource, the odbc resource will be backuped and restored together.
4. If the same view, odbc table and resource already exists in the database, it will compare whether the metadata of snapshot is consistent.
   If it is inconsistent, the restoration will fail.
4. This pr also modified the json format of the backup information.
   A `new_backup_objects` object is added to the root node to store backup meta-information other than olap table,
   such as views and external tables.
   ```
   {
       "backup_objects": {},
       "new_backup_objects": {
           "view": [
               {"name": "view1", "id": "10001"}
           ],
           "odbc_table": [
               {"name":"xxx", xxx}
           ]
           "odbc_resources": [
               {"name": "bj_oracle"}
           ]
       }
   }
   ```
5. This pr changes the serialization and deserialization method of backup information
   from manual construction to automatic analysis by Gson tools.

Change-Id: I216469bf2a6484177185d8354dcca2dc19f653f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. area/backup Issues of PRS related to backup and restore kind/feature Categorizes issue or PR as related to a new feature. kind/meta-version-change Categorizes issue or PR as related to changing meta version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backup and Restore support view and external table
2 participants