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

Deleting maps #50

Open
davenquinn opened this issue May 3, 2024 · 3 comments
Open

Deleting maps #50

davenquinn opened this issue May 3, 2024 · 3 comments
Assignees

Comments

@davenquinn
Copy link
Member

We should be able to straight-up-delete bad/invalid maps. Hiding or "deprecating" is not enough for truly useless maps. I always dislike it when systems (git annex 😖 for instance) don't give a hard delete option, because being reminded of your past fat-finger errors is never helpful.

  • Seems like as a start, adding a CLI command that takes a set of map IDs would be a good way.
  • The main "scary" thing that we need to do is delete the tables in the sources schema. But the fact that we are pretty strict about them starting with the slug now makes that easy to get right
  • Table names are also the main thing that makes potentially changing slugs hard, so we will either have to track tables another way Changing slugs #49 or rename them on slug changes
@brianaydemir
Copy link
Collaborator

My initial take on a design:

macrostrat maps delete-map <slug> --yes-I-really-mean-it

Steps, in order:

  1. Use slug to look up the source_id in the maps.sources table.

    Exit with an error if none is found.

  2. Use source_id to locate the corresponding record in maps_metadata.ingest_process.

    If found, null out the source_id in that record and set the state to map-hard-deleted (this is a new state!).

    Note that not all maps will have a record in ingest_process. Anything that relies on ingest_process should be updated to recognize the map-hard-deleted state as indicating that the map is no longer in the system in any way, shape or form.

  3. Drop the following tables, if they exist:

    • sources.{slug}_polygons
    • sources.{slug}_lines
    • sources.{slug}_linestrings
    • sources.{slug}_points
  4. Delete the record in the maps.sources table.

@CannonLock @davenquinn Is this deleting too much? Too little? Am I forgetting any linkages to the maps.sources table?

We might want to consider cleaning up any objects in S3 related to the now map-hard-deleted ingest process, but I think that can be handled separately. (In the long run, it might be helpful to have CLI commands for comparing records in storage.objects to what's actually in S3.)

@davenquinn
Copy link
Member Author

I think this is essentially how I would design it.

Few small things:

  • I suggest using the macrostrat maps delete for a terser command.
  • For some other commands, I use a dependency injection technique so you can send either the slug or source_id, might be good to carry that design here.
  • Also suggest making it have an interactive prompt instead of/rather than a flag. That way the user is forced to look at the slug and which tables would be deleted before typing "I'm sure" or something.

@brianaydemir
Copy link
Collaborator

Cannon suggested that we go ahead and hard-delete the ingest_process record as well.

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

No branches or pull requests

3 participants