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

[WIP] Delete DatabaseBackup/FileDepot/LogFile #21360

Closed
wants to merge 2 commits into from

Conversation

NickLaMuro
Copy link
Member

@NickLaMuro NickLaMuro commented Aug 2, 2021

Part of the #21100 effort.

This will most likely be split up into more digestible commits, but just getting some test runs going to see what breaks.

Checklist

  • ManageIQ/manageiq-schema
    • Drop DatabaseBackup, FileDepot, LogFile tables
    • FileDepot - Remove associated has_many schedules, auths
    • MiqServer - Remove associated log_files, log_file_depot_id columns
    • MiqSchedule - file_depot_id column
    • Zone - log_file_depot_id column
    • Remove auths attached to classes with FileDepotMixin (e.g. PxeServer)
  • log management
    • Drop Settings.log.collection from settings.yml
    • Data migration to drop /log/collection settings_changes
    • Can Settings.task.active_task_time be dropped?
  • import/export
    • what if an old import has a FileDepotContent section?
    • Data migration to drop import/export schedules? (are those even in the database?)
  • Does this also end up dropping the mount sessions?
  • Drop Vmdb::Util.get_evm_log_for_date, get_log_start_end_times, zip_logs, and compressed_log_patterns
  • Drop MiqException::MiqDatabaseBackupInsufficientSpace
  • Drop the miq_event for evm_server_db_backup_low_space from the yaml
    • Data migration to drop record and possibly detach from any policies (or drop the policy entirely if it's the only one left)

Links

@Fryguy
Copy link
Member

Fryguy commented Aug 9, 2021

cc @jrafanie ✂️ 🔥 🗑️

Well... mostly.

A single file is needed as the appliance_console uses this method to
check the current database connection.

This code could be moved into the console itself, but since it was
released recently, this allows that code to still function until a new
version not requiring it can be released.
@miq-bot
Copy link
Member

miq-bot commented Aug 10, 2021

Checked commits NickLaMuro/manageiq@b493938~...8535e53 with ruby 2.6.3, rubocop 1.13.0, haml-lint 0.35.0, and yamllint
15 files checked, 3 offenses detected

app/models/miq_schedule.rb

lib/tasks/evm_dba.rake

@kbrock
Copy link
Member

kbrock commented Aug 12, 2021

um +30 / −3,214 ✂️ ✂️ ✂️ 🔥
and it passes tests 🍏

Anything in particular for us to do to help you un-WIP this?

@NickLaMuro
Copy link
Member Author

I probably should double check that the stuff in lib/tasks/evm_dba.rake still works as I ripped it out of PostgresAdmin:

https://github.com/ManageIQ/manageiq-gems-pending/blob/11c6c05cbb83077f8d325ae0a4f584c19546f81e/lib/gems/pending/util/postgres_admin.rb#L226-L263

And I doubt it will #justWork™ since I did have to combine it a bit.

Aside from that, though, I don't know that I left in much that needed to be converted.

Copy link
Member

@kbrock kbrock left a comment

Choose a reason for hiding this comment

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

It could be argued that gc is a user script or is out of scope for our project all together.
So even if you introduced bugs with gc, I think we can live with it.

This looks nice. Very big delete.

LGTM

EvmDatabaseOps.gc(opts)
args = {}
opts = opts.delete_if { |_, v| v == false }
options = (options[:aggressive] ? GC_AGGRESSIVE_DEFAULTS : GC_DEFAULTS).merge(opts)
Copy link
Member

Choose a reason for hiding this comment

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

Are these constants present or from a require? I can't see them but maybe I just haven't looked hard enough

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope! Probably forgot them, good catch!

@Fryguy
Copy link
Member

Fryguy commented Aug 13, 2021

This is awesome!

I do realize this is WIP, but wanted to get a checklist started on the stuff left to do from what I can see (you might have more)

One question - has log management been removed from the UI as well? This PR drops log management backend, so I wasn't sure.


  • schema
    • Drop DatabaseBackup, FileDepot, LogFile tables
    • FileDepot - Remove associated has_many schedules, auths
    • MiqServer - Remove associated log_files, log_file_depot_id column
    • MiqSchedule - file_depot_id column
    • Zone - log_file_depot_id column
    • Remove auths attached to classes with FileDepotMixin (e.g. PxeServer)
  • log management
    • Drop Settings.log.collection from settings.yml
    • Data migration to drop /log/collection settings_changes
    • Can Settings.task.active_task_time be dropped?
  • import/export
    • what if an old import has a FileDepotContent section?
    • Data migration to drop import/export schedules? (are those even in the database?)
  • Can we drop the net/ftp gem?
  • Does this also end up dropping the mount sessions?
  • Drop Vmdb::Util.get_evm_log_for_date, get_log_start_end_times, zip_logs, and compressed_log_patterns
  • Drop MiqException::MiqDatabaseBackupInsufficientSpace
  • Drop the miq_event for evm_server_db_backup_low_space from the yaml
    • Data migration to drop record and possibly detach from any policies (or drop the policy entirely if it's the only one left)

@NickLaMuro
Copy link
Member Author

@Fryguy A few of these are things I might have considered at one point, but definitely forgot most of them, and the rest I didn't even consider. Nice list!

Does this also end up dropping the mount sessions?

I have a PR for this over in manageiq-gems-pending if that is what you are asking:

ManageIQ/manageiq-gems-pending#523

Can we drop the net/ftp gem?

I would have to look, but that is a good point! Most likely we can.


Will look at the other questions and answer as well, but figured I would ones out of the way that I knew off the top of my head.

@NickLaMuro
Copy link
Member Author

  • Can we drop the net/ftp gem?

Uh... just kidding... this isn't a gem... it is stdlib... 😆

@NickLaMuro NickLaMuro changed the title [WIP] Delete FileDepot/LogFile [WIP] Delete DatabaseBackup/FileDepot/LogFile Aug 16, 2021
@Fryguy
Copy link
Member

Fryguy commented Aug 17, 2021

Can we just drop stdlib? 😂

@jrafanie
Copy link
Member

image

😍

I know file depot was one of them that we needed the descendant loader / sti loader for. I wonder what 3+ deep STI ancestry trees we'd have left if this is gone. ❤️

As much as I'd love this, didn't we use file depots for pxe and possibly fleecing?

@NickLaMuro
Copy link
Member Author

As much as I'd love this, didn't we use file depots for pxe...

DANG IT LJ! Why do you have to be right about this!

...and possibly fleecing?

Hmm.... don't seem to see this being the case however. Maybe you were just thinking about the mounting libraries in general?

@NickLaMuro
Copy link
Member Author

Welp, closing this in favor of #21384 as that at least gets us some progress...

We can always re-open this with the EvmDatabaseOps commit already merged when we are more ready to removing everything else.

@NickLaMuro NickLaMuro closed this Aug 17, 2021
@jrafanie
Copy link
Member

As much as I'd love this, didn't we use file depots for pxe...

DANG IT LJ! Why do you have to be right about this!

😭

...and possibly fleecing?

Hmm.... don't seem to see this being the case however. Maybe you were just thinking about the mounting libraries in general?

Yeah, that's it.

@NickLaMuro
Copy link
Member Author

Hmm.... don't seem to see this being the case however. Maybe you were just thinking about the mounting libraries in general?

I should flesh this out for those potentially looking back at this in the future (or if we re-open this PR in the future):

manageiq-smartstate ("fleecing") used the mounting libraries, but just in one spot, and I already had a PR to import the relevant ones into that library:

ManageIQ/manageiq-smartstate#160

So that was actually taken care of. This would still have allowed this entire PR to move forward, since the FileDepot code was assumed to have most of the usage of the mounting code.

However, as LJ mentioned, the PXE functionality needs the entirety of the FileDepot code to function, which in turn is all of the mounting code which makes the aforementioned PR, as well as this and a few other related ones invalid. So closing them is the option chosen.

@kbrock
Copy link
Member

kbrock commented Aug 18, 2021

of note, #21377 lists that we may have some big changes in PXE.
Wonder if this would give you the option to 🔥 this code.

@Fryguy
Copy link
Member

Fryguy commented Aug 19, 2021

That's an interesting point on PXE. If it's the IPMI portion of PXE, that's on the chopping block. @NickLaMuro do you have more details about what in PXE is using FileDepot?

@NickLaMuro
Copy link
Member Author

NickLaMuro commented Aug 19, 2021

@Fryguy Pretty much all of PxeServer:

https://github.com/ManageIQ/manageiq/blob/d6294e54dc46c8e364de96d6de6357411e2487eb/app/models/pxe_server.rb

And then things like PxeImage call some of the read_file/write_file/delete_file methods via the pxe_server relationship.

So unless you are axing a large part of the PxeServer , I don't think it will go away anytime soon.

@jrafanie
Copy link
Member

So unless you are axing a large part of the PxeServer , I don't think it will go away anytime soon.

😢

One day.

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

Successfully merging this pull request may close these issues.

5 participants