Skip to content

walinfo: Advanced filtering #415

Closed

Description

@jesperpedersen
  • -RT The tablespace -- SELECT spcname FROM pg_tablespace WHERE oid = ? (zero to many)
  • -RD The database -- SELECT datname FROM pg_database WHERE oid = ? (zero to many)
  • -RR The relation -- SELECT relname FROM pg_class WHERE relfillnode = ? (zero to many)

Combination

  • -R RT/RD/RR

We would need maps of oid/relfillnode -> name such that users can use the real names instead. Otherwise only raw numbers are supported. Likely best long-term is to do a -c pgmoneta_walinfo.conf plus -u pgmoneta_walinfo_users.conf -- those should be optional.

If these maps are available we can replace them in the WAL record description - probably need a switch for that, like --translate

Activity

  1. Mohab96 commented on Feb 14, 2025

    @Mohab96
    Collaborator

    Can I work on this one? @jesperpedersen

  2. jesperpedersen commented on Feb 14, 2025

    @jesperpedersen
    MemberAuthor

    @Mohab96 #475 is likely better as a first contribution

  3. Mohab96 commented on Feb 14, 2025

    @Mohab96
    Collaborator

    Okay, no problem.

  4. Mohab96 commented on Mar 8, 2025

    @Mohab96
    Collaborator

    We would need maps of oid/relfillnode -> name such that users can use the real names instead. Otherwise only raw numbers are supported. Likely best long-term is to do a -c pgmoneta_walinfo.conf plus -u pgmoneta_walinfo_users.conf -- those should be optional.

    1. Why would I need pgmoneta_walinfo_users.conf? pgmoneta_walinfo.conf may be useful now, but it's easier to just make them CLI arguments. Also, pgmoneta_walinfo.conf may be useless as pgmoneta-walinfo is a tool that runs once on the wal file, not starting a server or something like that, so a conf file can be more than what the feature needs.

    If these maps are available we can replace them in the WAL record description - probably need a switch for that, like --translate

    1. I don't understand the difference between -R TDR and --translate; can you explain the difference between them?
  5. Mohab96 commented on Mar 8, 2025

    @Mohab96
    Collaborator

    Besides, when I took a look here, I didn't find anything related to databases/tablespaces/relations. Should I add them to the description of the WAL record, or did you mean something else in the issue description?

  6. jesperpedersen commented on Mar 8, 2025

    @jesperpedersen
    MemberAuthor

    You need access to the cluster in order to resolve the OIDs in the WAL records. However, this should be optional and then the filtering requiring that information wouldn't work.

    We could save the mappings in a file and then load that instead after the first run with a user/password

  7. jesperpedersen commented on Mar 8, 2025

    @jesperpedersen
    MemberAuthor

    --translate is a heavy operation as it replaces the OIDs in the WAL record's description with the actual names

  8. Mohab96 commented on Mar 8, 2025

    @Mohab96
    Collaborator

    Aha, I see. Then, what I need to do now is:

    1. Find a way to get mappings of OIDs.
    2. Parse the description section in all XLOG records in the specific file and replace them with their actual mapping.
      e.g. oid 12345; -> dbname mydb

    I will work on these and get back to you.

  9. Mohab96 commented on Mar 8, 2025

    @Mohab96
    Collaborator

    The part of accessing the cluster and getting the mappings directly from it seems a bit complicated to me, so I will go with the solution of the existence of a mappings YAML file or something that I load into memory and use it to update the WAL records. Although I don't consider it the best solution, it will give the core functionality, and maybe in the future, when I get exposed a little bit to the codebase, I will make it totally without making the user execute some queries manually and put them in the config file.

  10. jesperpedersen commented on Mar 8, 2025

    @jesperpedersen
    MemberAuthor

    You have the queries in the 1st post.

    You can use JSON or YAML - I would use JSON

  11. Mohab96 commented on Mar 8, 2025

    @Mohab96
    Collaborator

    Then, the -R option specifies which objects the user wants to map, while --translate specifies whether the user wants the mapping, right?

  12. jesperpedersen commented on Mar 8, 2025

    @jesperpedersen
    MemberAuthor

    mydb/public/mytable or something like that

  13. Mohab96 commented on Mar 8, 2025

    @Mohab96
    Collaborator

    mydb/public/mytable or something like that

    Can you please emphasize the difference between -R and --translate because I didn't understand what you've said here?

  14. 35 remaining items

  15. added 14 commits that reference this issue on Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions