8000 Adding filtering flag to pgcopydb dump schema by arajkumar · Pull Request #836 · dimitri/pgcopydb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Adding filtering flag to pgcopydb dump schema #836

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

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

arajkumar
Copy link
Contributor

Following error will be seen without this fix,

10:46:09.943 284145 INFO   Running pgcopydb version 0.0.21.184.g8c85cce from "/home/ubuntu/dimitri/pgcopydb/src/bin/pgcopydb/pgcopydb"
10:46:09.981 284145 INFO   Using work dir "/tmp/pgcopydb"
10:46:09.981 284145 INFO   Restoring database from existing files at "/tmp/pgcopydb"
10:46:09.984 284145 INFO   Current filtering setup is: {"type":"SOURCE_FILTER_TYPE_EXCL","exclude-table-data":[{"schema":"public","name":"metrics_New"}]}
10:46:09.984 284145 INFO   Catalog filtering setup is: {"type":"SOURCE_FILTER_TYPE_NONE"}
10:46:09.984 284145 ERROR  Catalogs at "/tmp/pgcopydb/schema/source.db" have been setup for a different filtering than the current command, see above for details
10:46:09.984 284145 ERROR  Failed to initialize pgcopydb internal catalogs

The problem is, pgcopydb dump schema without filtering creates catalog with filtering type as NONE, when we supply filter for restore, it fails with filter type mismatch.

dimitri
dimitri previously approved these changes Jul 5, 2024
@dimitri
Copy link
Owner
dimitri commented Jul 5, 2024

The style checker test is failing but I'm not sure why, it seems to be a problem in GitHub Actions itself?

The docs test reports that you missed updated the docs command line options:

Docs are not up to date, please run 'make update-docs'

@arajkumar arajkumar force-pushed the arajkumar/filtering-for-dump branch 2 times, most recently from 7c39556 to 39bb925 Compare July 5, 2024 11:21
@arajkumar arajkumar requested a review from dimitri July 5, 2024 11:22
@arajkumar
Copy link
Contributor Author

@dimitri Fixed it. I didn't aware there is an automated way to update CLI flag changes to the docs. Neat!

@arajkumar arajkumar force-pushed the arajkumar/filtering-for-dump branch from 39bb925 to b9013de Compare July 5, 2024 11:23
@arajkumar
Copy link
Contributor Author

@dimitri I don't understand why the style checker fails now. I tried on my dev machine using the same docker image used on the Github Actions, it worked.

Comment on lines 6 to 11
--source Postgres URI to the source database
--target Directory where to save the dump files
--dir Work directory to use
--skip-extensions Skip restoring extensions
--filters <filename> Use the filters defined in <filename>
--snapshot Use snapshot obtained with pg_export_snapshot
Copy link
Owner

Choose a reason for hiding this comment

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

Alignment issues. I suppose you have a mix of TAB and SPC characters in the source code strings, can you fix that and use only spaces?

Comment on lines 36 to 41
" --source Postgres URI to the source database\n"
" --target Directory where to save the dump files\n"
" --dir Work directory to use\n"
" --skip-extensions Skip restoring extensions\n" \
" --snapshot Use snapshot obtained with pg_export_snapshot\n",
" --source Postgres URI to the source database\n"
" --target Directory where to save the dump files\n"
" --dir Work directory to use\n"
" --skip-extensions Skip restoring extensions\n" \
" --filters <filename> Use the filters defined in <filename>\n"
" --snapshot Use snapshot obtained with pg_export_snapshot\n",
Copy link
Owner

Choose a reason for hiding this comment

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

That's here: use only spaces please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dimitri I had used make update-docs to update the docs.

Copy link
Owner

Choose a reason for hiding this comment

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

The alignment issue is with using TABs in the code instead of using only spaces.

@dimitri
Copy link
Owner
dimitri commented Jul 5, 2024

@dimitri I don't understand why the style checker fails now. I tried on my dev machine using the same docker image used on the Github Actions, it worked.

Same conclusions here. I will be able to merge this one and we'll fix the GitHub actions later.

@arajkumar
Copy link
Contributor Author

The style checker GH action is broken.

@arajkumar arajkumar requested a review from dimitri July 10, 2024 11:47
Comment on lines 36 to 41
" --source Postgres URI to the source database\n"
" --target Directory where to save the dump files\n"
" --dir Work directory to use\n"
" --skip-extensions Skip restoring extensions\n" \
" --snapshot Use snapshot obtained with pg_export_snapshot\n",
" --source Postgres URI to the source database\n"
" --target Directory where to save the dump files\n"
" --dir Work directory to use\n"
" --skip-extensions Skip restoring extensions\n" \
" --filters <filename> Use the filters defined in <filename>\n"
" --snapshot Use snapshot obtained with pg_export_snapshot\n",
Copy link
Owner

Choose a reason for hiding this comment

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

The alignment issue is with using TABs in the code instead of using only spaces.

@dimitri
Copy link
Owner
dimitri commented Jul 10, 2024

The style checker GH action is broken.

@hanefi fixed it meanwhile!

@dimitri dimitri added the bug Something isn't working label Jul 10, 2024
@dimitri dimitri added this to the v0.17 milestone Jul 10, 2024
Following error will be seen without this fix,
```
10:46:09.943 284145 INFO   Running pgcopydb version 0.0.21.184.g8c85cce from "/home/ubuntu/dimitri/pgcopydb/src/bin/pgcopydb/pgcopydb"
10:46:09.981 284145 INFO   Using work dir "/tmp/pgcopydb"
10:46:09.981 284145 INFO   Restoring database from existing files at "/tmp/pgcopydb"
10:46:09.984 284145 INFO   Current filtering setup is: {"type":"SOURCE_FILTER_TYPE_EXCL","exclude-table-data":[{"schema":"public","name":"metrics_New"}]}
10:46:09.984 284145 INFO   Catalog filtering setup is: {"type":"SOURCE_FILTER_TYPE_NONE"}
10:46:09.984 284145 ERROR  Catalogs at "/tmp/pgcopydb/schema/source.db" have been setup for a different filtering than the current command, see above for details
10:46:09.984 284145 ERROR  Failed to initialize pgcopydb internal catalogs
```

The problem is, `pgcopydb dump schema` without filtering creates catalog
with filtering type as NONE, when we supply filter for restore, it fails
with filter type mismatch.

Signed-off-by: Arunprasad Rajkumar <ar.arunprasad@gmail.com>
@arajkumar arajkumar force-pushed the arajkumar/filtering-for-dump branch from 4b902ad to 397b40a Compare July 10, 2024 13:57
@arajkumar arajkumar requested a review from dimitri July 10, 2024 13:58
@dimitri dimitri merged commit bbbb4b9 into dimitri:main Jul 10, 2024
19 checks passed
rimbi pushed a commit to rimbi/pgcopydb that referenced this pull request Jul 22, 2024
Following error will be seen without this fix,
```
10:46:09.943 284145 INFO   Running pgcopydb version 0.0.21.184.g8c85cce from "/home/ubuntu/dimitri/pgcopydb/src/bin/pgcopydb/pgcopydb"
10:46:09.981 284145 INFO   Using work dir "/tmp/pgcopydb"
10:46:09.981 284145 INFO   Restoring database from existing files at "/tmp/pgcopydb"
10:46:09.984 284145 INFO   Current filtering setup is: {"type":"SOURCE_FILTER_TYPE_EXCL","exclude-table-data":[{"schema":"public","name":"metrics_New"}]}
10:46:09.984 284145 INFO   Catalog filtering setup is: {"type":"SOURCE_FILTER_TYPE_NONE"}
10:46:09.984 284145 ERROR  Catalogs at "/tmp/pgcopydb/schema/source.db" have been setup for a different filtering than the current command, see above for details
10:46:09.984 284145 ERROR  Failed to initialize pgcopydb internal catalogs
```

The problem is, `pgcopydb dump schema` without filtering creates catalog
with filtering type as NONE, when we supply filter for restore, it fails
with filter type mismatch.

Signed-off-by: Arunprasad Rajkumar <ar.arunprasad@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0