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

dbcheck.c, update for dver 2171, remove eliminate_duplicate_filenames… #63

Closed
wants to merge 1 commit into from
Closed

dbcheck.c, update for dver 2171, remove eliminate_duplicate_filenames… #63

wants to merge 1 commit into from

Conversation

unki
Copy link
Contributor

@unki unki commented Sep 24, 2017

…(), update all queries referencing the old Filename table

The schema upgrade from 2004 to >=2170 seems to have rendered bareos-dbcheck unusable, because it still tries to work on the Filename table, which got merged into File by the schema upgrade.

I'm not sure if I've done that correct, but this PR updates the SQL queries to use the File table instead.

Furthermore it removes the eliminate_duplicate_filenames() function, which now seems to be obsolete, as it only tried to find duplicate filename-entries in the Filename table.
As these duplicates might now always be the case in the File table, as there the files are associated with Paths or Jobs, and by this might occur multiple times, I think there is no more use for eliminate_duplicate_filenames().

…(), update all queries referencing the old Filename table
@joergsteffens
Copy link
Member

Thank you very much for this patch and sorry for the delay. We're going to merge this to bareos-17.2 branch soon.

@joergsteffens
Copy link
Member

I noticed, that you have modified the function eliminate_orphaned_filename_records(), to be based on PathIds instead of FilenameIds. However, I think this function must be removed, as the Filename table no longer exists. PathIds are covered by eliminate_orphaned_path_records().
Am I missing something?

@unki
Copy link
Contributor Author

unki commented Oct 12, 2017

Hello!

Imho eliminate_orphaned_file_records() is the one that removes orphaned file entries that are no longer bound to a job (join on the Job table).

And the eliminate_orphaned_path_records() is the one that removed orphaned path entries where no more files are associated with them (join on the File table).

I'm not 100% sure, but I think those two are still doing a different job. It was only eliminate_duplicate_filenames() that has become obsolete.

@joergsteffens
Copy link
Member

I fully agree. However I asked about eliminate_orphaned_filename_records(), not eliminate_orphaned_file_records(). And after checking this again, I quite certain that this function should be removed.

@unki
Copy link
Contributor Author

unki commented Oct 15, 2017

Argl, sorry. Those function names are easily for me to be mixed up ;-)

  • eliminate_orphaned_file_records() -> remove files that are no longer bound to any job (join on Job table)
  • eliminate_orphaned_path_records() -> remove paths that are no longer referenced by any file (join on File table)
  • eliminate_orphaned_filename_records() -> remove files that are no longer bound to any path (join on Path)

AFAIK there is no other function right now, that performs the same task as eliminate_orphaned_filename_records(), to cleanup file residues in the File table, where no more path exists in the Path table (why ever this situation has occurred).

So perhaps eliminate_orphaned_filename_records() has still a right to exist, but might need to be renamed to eliminate_stale_file_records() or so?

Or extending the functionality of eliminate_orphaned_file_records() be modifying the SQL query there, to not only join on the Job table, but also on the Path table (so doing the same job as eliminate_orphaned_filename_records() right now).

@joergsteffens
Copy link
Member

Unfortunately, I've been distracted and forget to integrate this into bareos-17.2 and then wondered, why this pull request is still open. Sorry for this. It is now merged to bareos-17.2 and master will follow. As I decided to merge it to bareos-17.2 (and not master as in the original pull request), this pull request will not be closed automatically. I will close it manually. Please reopen if you still see problems.

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.

None yet

2 participants