-
Notifications
You must be signed in to change notification settings - Fork 3
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
[#22] Initial pgmoneta_ext_full_backup() #24
base: main
Are you sure you want to change the base?
Conversation
Yes, and like you have written you need to do the full backup, and figure out how to send it back to the client. If, we have our own socket, then we need to do authentication and so on, so ideally client will connect to :5432, perform authentication, and then the extension takes over since its API is being called |
I've noticed the following lines in our core project: pgmoneta_create_start_replication_message(cmd, timeline, config->servers[srv].wal_slot, &start_replication_msg);
ret = pgmoneta_write_message(ssl, socket, start_replication_msg); Is it possible for me to create a new function, similar to Since our project already has many functions related to the protocol, I need to familiarize myself with them and learn more about them. Managing this communication may not be easy, as I'm currently unsure how our project handles the protocol and performs authentication. |
Why would you need logical replication ? You need to follow The core protocol does the authentication - you can sort of follow the authentication since our CLI does that too when connecting remotely. So, security.c with the various security methods should provide hints as well |
The |
auth = pgmoneta_server_authenticate(server, database, username, password, replication, ssl, fd);
if (auth == AUTH_SUCCESS)
{
// Proceed to establish a protocol
pgmoneta_send_file_slot_message(slot_name, message, version);
if (pgmoneta_write_message(ssl, socket, slot_request_msg) == MESSAGE_STATUS_OK)
{
// send the file
}
else
{
pgmoneta_log_error();
}
}
else
{
pgmoneta_log_error();
}
pgmoneta_close_ssl(ssl);
pgmoneta_disconnect(socket); The pseudocode above outlines my plan to use our existing authentication mechanism for the authentication part. Once authenticated, we can find a suitable protocol to handle the file transfer. |
The idea is to use the libpq API once we are inside the extension to perform the backup . You should look how pgbackrest does incremental backup for PostgreSQL < 17 and get ideas from that |
And, full backups as well of course |
I've tried several methods to send a file from the client to the server, but none have succeeded, even when using |
What exactly have you tried and how are they not working out? Maybe we need to consider do comparison on main side. We may then need to get files one by one instead of in one tar. But I wouldn't worry too much about it since we now have start LSN thanks to #23. There is no rush in this so don't worry too much, we can get support for v17 incr backup out first. If you need new ideas, checkout out pgbackrest about how they do it, especially how they manage to transfer the backups to client side. Postgres is doing the comparison based on WAL summaries, it is a quite interesting new feature, feel free to check it out as well. |
Initially, I use the
pgmoneta_ext_full_backup()
function to test and ensure that bothstart_backup()
andstop_backup()
functions work correctly.Once these two functions are refined, the next step will be to create a new pull request to allow the core to send the manifest to the extension.