Skip to content

bpo-27645: Supporting native backup facility of SQLite #4238

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

Merged
merged 52 commits into from
Mar 10, 2018

Conversation

lelit
Copy link
Contributor

@lelit lelit commented Nov 2, 2017

This is a new version of PR #377, rebased on more recent master to solve the conflicts on the old NEWS file.

It implements a new requested feature since last review.

See https://bugs.python.org/issue27645

https://bugs.python.org/issue27645

lelit added 22 commits October 5, 2017 20:31
When sqlite3_backup_step() returns OK it means that it was able to do it's work but there are
further pages to be copied: in such case it's better to immediately start the next iteration,
without opening a window that allows other threads to go on and possibly locking the database.

Suggested by Aviv Palivoda.
…llback

Add new SQLITE_DONE integer constant to the module, that could be used by the callback to
determine whether the backup is terminated.
This should address Aviv's concerns about how the sqlite3_backup_step() errors are handled.
This is needed for SQLite < 3.8.7.
@brettcannon brettcannon changed the title Supporting native backup facility of SQLite bpo-27645: Supporting native backup facility of SQLite Nov 2, 2017
@lelit
Copy link
Contributor Author

lelit commented Nov 2, 2017

Compilation fails on Windows, due to misdeclaration of unlink(). I call that function to remove an incomplete backup when an error happens: I looked around in the sources and couldn't figure out a portable way to do that. Any hint?

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#else
extern int unlink(const char *);
Copy link
Member

Choose a reason for hiding this comment

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

This won't work under Windows. You have to use DeleteFileW, see posixmodule.c

@bedevere-bot
Copy link

Thanks for making the requested changes!

@berkerpeksag, @tiran: please review the changes made to this pull request.

@lelit
Copy link
Contributor Author

lelit commented Dec 22, 2017

Is there anything left to do on my part?

@lelit
Copy link
Contributor Author

lelit commented Jan 9, 2018

Will this be merged before 3.7b1?

@ned-deily
Copy link
Member

@tiran and @berkerpeksag, looks this PR is waiting on your reviews of changes. Is there anything else holding this up? It seems like a lot of work went into this PR over a long period and it is quite self-contained. If everyone agrees it is ready to be merged into master in the next few days and if the buildbots are happy with it, I might be persuaded to allow it into 3.7.0b3 as well.

@lelit
Copy link
Contributor Author

lelit commented Mar 10, 2018

👏

@berkerpeksag
Copy link
Member

Sorry, I've been busy with family stuff and I will take a look at this PR today or tomorrow.

@berkerpeksag
Copy link
Member

This looks pretty good to me. I've rebased @lelit's branch, made some cosmetic changes, and fixed a segfault (824d5f8)

About supporting a more recent SQLite version as minimum: Last time I've used a newer API (I documented the minimum SQLite version) we got several reports saying "we can't compile Python with SQLite X.Y.Z anymore." Perhaps we can use the death of Python 2.7 as an opportunity and get rid of most of the compatibility code in Python 3.8 or Python 3.9?

@berkerpeksag
Copy link
Member

@ned-deily

If everyone agrees it is ready to be merged into master in the next few days and if the buildbots are happy with it, I might be persuaded to allow it into 3.7.0b3 as well.

I'm planning to merge this in an hour or two. I've changed the versionadded marker to 3.8 but should I revert it back to 3.7?

@ned-deily
Copy link
Member

@berkerpeksag, Thanks for taking this on! Yeah, let's go crazy and change it to 3.7. We can always change it later if, for some reason, it doesn't make 3.7.

@berkerpeksag
Copy link
Member

@ned-deily changed versionadded to 3.7 and added an entry to Doc/whatsnew/3.7.rst. What's the current process for getting something in after b1? Do I need to open a PR against the 3.7 branch or some special branch?

@ned-deily
Copy link
Member

ned-deily commented Mar 10, 2018

@berkerpeksag, you can just set the "need backport to 3.7" label to start an auto backport to 3.7

@berkerpeksag berkerpeksag merged commit d7aed41 into python:master Mar 10, 2018
@miss-islington
Copy link
Contributor

Thanks @lelit for the PR, and @berkerpeksag for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 10, 2018
…-4238)

(cherry picked from commit d7aed41)

Co-authored-by: Emanuele Gaifas <lelegaifax@gmail.com>
@bedevere-bot
Copy link

GH-6064 is a backport of this pull request to the 3.7 branch.

@berkerpeksag
Copy link
Member

@lelit thank you for your patience! I know that this was a frustrating experience for you, but I hope you are going to continue contributing to Python :)

berkerpeksag pushed a commit that referenced this pull request Mar 10, 2018
(cherry picked from commit d7aed41)

Co-authored-by: Emanuele Gaifas <lelegaifax@gmail.com>
@lelit
Copy link
Contributor Author

lelit commented Mar 10, 2018

@berkerpeksag thank you and don't worry, I've been around for enough time to know how it goes and I will surely keep that for the remaining half of my life 😃

jo2y pushed a commit to jo2y/cpython that referenced this pull request Mar 23, 2018
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

Successfully merging this pull request may close these issues.

10 participants