Don't drop user related tables from Anitya's db dump #7298

Closed
opened 2018-10-09 09:18:18 +00:00 by zlopez · 12 comments
Contributor
  • Describe what you need us to do:
    I found out, that Anitya's dump is missing these tables:
    "users"
    "tokens"
    "social_auth_association"
    "social_auth_code"
    "social_auth_nonce"
    "social_auth_partial"
    "social_auth_usersocialauth"

It will be better if you can just leave these tables empty instead of dropping them entirely.

  • When do you need this? (YYYY/MM/DD)
    Asap

  • When is this no longer needed or useful? (YYYY/MM/DD)

  • If we cannot complete your request, what is the impact?
    Current development environment for Anitya is using production dump and without these tables you are getting error every time application works with user (login, check if admin etc.)

* Describe what you need us to do: I found out, that Anitya's dump is missing these tables: "users" "tokens" "social_auth_association" "social_auth_code" "social_auth_nonce" "social_auth_partial" "social_auth_usersocialauth" It will be better if you can just leave these tables empty instead of dropping them entirely. * When do you need this? (YYYY/MM/DD) Asap * When is this no longer needed or useful? (YYYY/MM/DD) * If we cannot complete your request, what is the impact? Current development environment for Anitya is using production dump and without these tables you are getting error every time application works with user (login, check if admin etc.)

Metadata Update from @bowlofeggs:

  • Issue priority set to: Waiting on Assignee (was: Needs Review)
  • Issue tagged with: database, release-monitoring
**Metadata Update from @bowlofeggs**: - Issue priority set to: Waiting on Assignee (was: Needs Review) - Issue tagged with: database, release-monitoring

@zlopez This is the commit that made the change:

https://infrastructure.fedoraproject.org/cgit/ansible.git/commit/?id=f0c596c427cc591148634d31cbe521579fc462ff

You may be able to adjust it to insert the empty tables you desire, or you may be able to adjust the development environment to do so.

@zlopez This is the commit that made the change: https://infrastructure.fedoraproject.org/cgit/ansible.git/commit/?id=f0c596c427cc591148634d31cbe521579fc462ff You may be able to adjust it to insert the empty tables you desire, or you may be able to adjust the development environment to do so.
Author
Contributor

@bowlofeggs
I got advice from @mizdebsk on IRC, that this could be done by running sed '/COPY table_name /,/\./d' on dump. Is this possible, when the tables were excluded from actual dump?

@bowlofeggs I got advice from @mizdebsk on IRC, that this could be done by running `sed '/COPY table_name /,/\./d'` on dump. Is this possible, when the tables were excluded from actual dump?

On Tue, 2018-10-09 at 14:24 +0000, Michal Kone=C4=8Dn=C3=BD wrote:

I got advice from @mizdebsk on IRC, that this could be done by
running sed '/COPY table_name /,/\./d' on dump. Is this possible,
when the tables were excluded from actual dump?

The database dump is a text file, so there are a variety of ways you
could edit it to add an empty version of the table to it.

On Tue, 2018-10-09 at 14:24 +0000, Michal Kone=C4=8Dn=C3=BD wrote: > I got advice from @mizdebsk on IRC, that this could be done by > running `sed '/COPY table_name /,/\./d'` on dump. Is this possible, > when the tables were excluded from actual dump? The database dump is a text file, so there are a variety of ways you could edit it to add an empty version of the table to it.
Author
Contributor

Ok, I will then just play with it.

Ok, I will then just play with it.

My idea was not to exclude these tables from pg_dump, but instead truncate them on-the-fly, eg with sed, i.e. replace pg_dump -T users $DB | ... with pg_dump $DB | sed '/COPY users /,/\./d' | ...

My idea was not to exclude these tables from pg_dump, but instead truncate them on-the-fly, eg with sed, i.e. replace `pg_dump -T users $DB | ...` with `pg_dump $DB | sed '/COPY users /,/\./d' | ...`

Note that these were dropped for security reasons, so make sure sensitive data isn't being published.

I think we can switch -T to --exclude-table-data for these tho and have the table exist, but have no data in it. Would that work?

Note that these were dropped for security reasons, so make sure sensitive data isn't being published. I think we can switch -T to --exclude-table-data for these tho and have the table exist, but have no data in it. Would that work?
Author
Contributor

@kevin This will be ideal

@kevin This will be ideal

I've proposed a freeze break to do this (since db01 is frozen).

I've proposed a freeze break to do this (since db01 is frozen).

This is in place and theres a new dump that should be correct.

Let me know if it's not. 🚟

This is in place and theres a new dump that should be correct. Let me know if it's not. :suspension_railway:

Metadata Update from @kevin:

  • Issue close_status updated to: Fixed
  • Issue status updated to: Closed (was: Open)
**Metadata Update from @kevin**: - Issue close_status updated to: Fixed - Issue status updated to: Closed (was: Open)
Author
Contributor

Everything is working as expected. Thanks for the patch.

Everything is working as expected. Thanks for the patch.
Sign in to join this conversation.
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Infrastructure/fedora-infrastructure#7298
No description provided.