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

Add ability to backup/restore only those (several) tables which are enumerated as command line argument (pattern) [CORE5538] #5806

Closed
firebird-issue-importer opened this issue May 15, 2017 · 24 comments

Comments

@firebird-issue-importer

Submitted by: @pavel-zotov

Assigned to: @aafemt

Votes: 1

gbak -? 2>&1 | findstr /i /c:"skip"

\-SKIP\_D\(ATA\) <pattern\> skip data for all tables which are specified in

the <pattern>

This command switch is useful when we want to skip SEVERAL but leave DOZEN of tables, but it does NOT allow to solve opposite task: when we need to b/r only several tables of their huge total number.
Please consider to implement command-line switch like this:

\-SKIP\_E\(CEPT\) <pattern\> skip data for all tables EXCEPT those which are specified in the <pattern\>

-- where <pattern> must follow SIMILAR_TO logic and rules.

Commits: 46102b6 8a8d778

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 15, 2017

Commented by: Sean Leyne (seanleyne)

It seems that you are trying to describe something more along the lines of "Backup_Only", correct?

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 15, 2017

Commented by: @pavel-zotov

> It seems that you are trying to describe something more along the lines of "Backup_Only", correct?

May be :-)
Sorry, my English knowledge is poor: what does it mean "along the lines" here ?

PS.
"backup_only" plus "restore_only" - two different keys; it seems to me that it will be better to use only one, with "unified" form.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 15, 2017

Commented by: Sean Leyne (seanleyne)

Your point about backup vs. restore is very valid, hadn't considered that.

While I think further about the correct label/name...

What would be the consequence of using both SKIP_DATA and SKIP_EXCEPT at the same time, and where a table name meets both criteria? Would the table be processed?

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 15, 2017

Commented by: Sean Leyne (seanleyne)

I think I have syntax/options which would allow for complete control:

- "Data_Exclude" -- Replacement for current "SKIP_DATA"
- "Data_Include" -- companion to the "Data_Exclude", to allow for exceptions to broad "Exclude" filter criteria to be overridden.

{Actually the Exclude/Include options could be used as required to best define the tables to be processed}

The precedence/processing order of the options would be as follows:

If tablename match found in "Data\_Include" then
  table is processed
else If tablename match NOT found in "Data\_Exclude" then
  table is processed
else
  table is skipped

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 15, 2017

Commented by: @asfernandes

As skip_data is a regexp, can't it already be used for both (skip, no-skip) purposes?

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 15, 2017

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 15, 2017

Commented by: @AlexPeshkoff

May be it can be used for both purposes - but special switch is simpler and cleaner for most users

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 15, 2017

Commented by: Sean Leyne (seanleyne)

Alexander is correct, the regexp required to handle exclude is anything but straight-forward (I thought so, but my research found it is not).

Separate switch would be the easiest to use.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 15, 2017

Commented by: @pavel-zotov

> As skip_data is a regexp, can't it already be used for both (skip, no-skip) purposes?

Unfortunately, this key can be used only for SKIP, but not for preserve. This is because we can not use in command line (i.e. gfix switch) somewhat like "NOT similar to <pattern>".

Consider following:

recreate table tnames(s varchar(31));
insert into tnames(s) values('anna');
insert into tnames(s) values('beta');
insert into tnames(s) values('ciao');
insert into tnames(s) values('cola');
insert into tnames(s) values('dina');
insert into tnames(s) values('doca');
insert into tnames(s) values('docb');
insert into tnames(s) values('docc');
insert into tnames(s) values('dora');
insert into tnames(s) values('dura');
insert into tnames(s) values('omen');
insert into tnames(s) values('opel');
insert into tnames(s) values('mail');
insert into tnames(s) values('rose');
commit;

How can we select all rows EXCEPT three: 'doca', 'docb' and 'docc' - and at the same time avoid using of logical negation ("NOT') ?

This:

select s
from tnames n
where n.s similar to '(doc)%'; -- includes all names that start with 'doc', this is expected.

But this:

select s
from tnames n
where n.s similar to '[^(doc)]%'; -- excludes all names which start with: 'd', 'o' or 'c'.

It's NOT the same as one may to expect: grouping of three characters: "(" and ")" -- seems to not work here.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 15, 2017

Commented by: @pavel-zotov

BTW: is it possible to back-port this feature to 2.5.x ?

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 15, 2017

Commented by: Sean Leyne (seanleyne)

Pavel,

Your comment is in the wrong context. The feature is about handling/processing of Tables, not rows!

The excluding of rows is a completely different subject. (it also would not get my vote!)

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 15, 2017

Commented by: @pavel-zotov

Sean,

consider table names as rows from rdb$relations, please. It is rdb$relations which is used by gbak when we apply '-skip' command switch (AFAIU).
So, why you said that this context is wrong ?

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 15, 2017

Commented by: Sean Leyne (seanleyne)

Pavel,

How was I to expect that I needed to "consider table names as rows from rdb$relations"?

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 15, 2017

Commented by: @pavel-zotov

me wrong :-)
I should provide more obvoius name instead of "table tnames(s varchar(31));"

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 22, 2019

Modified by: @aafemt

assignee: Alexander Peshkov [ alexpeshkoff ] => Dimitry Sibiryakov [ aafemt ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 22, 2019

Commented by: @aafemt

Mostly it should be a copy-paste of code handling -SKIP_DATA switch.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 22, 2019

Modified by: @aafemt

status: Open [ 1 ] => Open [ 1 ]

Target: 3.0.6 [ 10889 ]

Implementation: [Trivial]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 24, 2019

Modified by: @aafemt

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 24, 2019

Modified by: @aafemt

Target: 3.0.6 [ 10889 ] => 4.0 Beta 2 [ 10888 ]

status: In Progress [ 3 ] => In Progress [ 3 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 29, 2019

Modified by: @aafemt

status: In Progress [ 3 ] => Open [ 1 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 29, 2019

Commented by: @aafemt

Pull request to master branch created.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Nov 4, 2019

Modified by: @aafemt

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 Beta 2 [ 10888 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Nov 4, 2019

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Nov 4, 2019

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant