Skip to content

Implement #6413 : Data pages of newly gbak restored databases should marked as "swept" [CORE6164] #8549

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hvlad
Copy link
Member

@hvlad hvlad commented May 3, 2025

No description provided.

@hvlad hvlad self-assigned this May 3, 2025
@hvlad hvlad requested a review from dyemanov May 3, 2025 18:09
@aafemt
Copy link
Contributor

aafemt commented May 3, 2025

Why exception for system relations?

@hvlad
Copy link
Member Author

hvlad commented May 4, 2025

Why exception for system relations?

There is no promise that system tables contains no backversions after restore.

@omachtandras
Copy link

Vlad, thank you!!!

@aafemt
Copy link
Contributor

aafemt commented May 4, 2025

There is no promise that system tables contains no backversions after restore.

Does this flag prevent garbage collection as well? System tables are read extremely intensively so hardly any garbage in them can left uncollected.

@hvlad
Copy link
Member Author

hvlad commented May 5, 2025

There is no promise that system tables contains no backversions after restore.

Does this flag prevent garbage collection as well?

Read the code.

System tables are read extremely intensively so hardly any garbage in them can left uncollected.

Do you give guarantee ? Run gbak -r and gstat -r -s after it.

@dyemanov dyemanov requested a review from ilya071294 May 7, 2025 13:52
if (type == DPM_primary)
{
// When restoring, mark slot as swept, data page will be marked by our caller
if (tdbb->getAttachment()->isGbak() && !relation->isSystem())
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. I would put this check in a separate inline function like inline bool sweptOnRestore(thread_db* tdbb, jrd_rel* rel).
  2. isGbak() is not 100% safe to use. I remember I tested a case where I created some DB trigger which inserts/updates data. And when I started gbak -b, the normal swept flag logic wasn't working during execution of the trigger. So we need to distinguish between backup and restore. isRWGbak() is more suitable here but it's not going to work right away. ATT_creator is also should be passed to parallel worker attachments. To do that, I created isc_dpb_gbak_restore_rel_attach so JProvider::internalAttach can check it along with isc_dpb_gbak_attach and set ATT_creator.

If it's needed, I can provide a patch with these corrections.

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

Successfully merging this pull request may close these issues.

Data pages of newly gbak restored databases should marked as "swept" [CORE6164]
4 participants