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
python plugins: enable direct I/O in core instead of calling python for read and write #1297
Conversation
5f4651c
to
99c4c04
Compare
3f3fe3a
to
43b89d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should try to get rid of do_io_in_core and handle that with magic values for filedes.
d23856d
to
6910cdc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks a lot simpler already. Still some caveats, but steadily improving.
core/src/filed/fd_plugins.cc
Outdated
// - Set the io.filedes to the filedescriptor of the file that was | ||
// opened in the plugin. In this case the core code will read from | ||
// write to that filedescriptor during backup and restore. | ||
// 2.: - Set io.status to IoStatus::success, and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this truncated? At least it doesn't make sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this was updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, still truncated :(
core/src/plugins/filed/python/pyfiles/BareosFdPluginLocalFileset.py
Outdated
Show resolved
Hide resolved
82b0b0a
to
847d7cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor scoping and re-initialization issues left.
Also, we should probably change the struct io_pkt
everywhere throughout the codebase.
core/src/filed/fd_plugins.cc
Outdated
// - Set the io.filedes to the filedescriptor of the file that was | ||
// opened in the plugin. In this case the core code will read from | ||
// write to that filedescriptor during backup and restore. | ||
// 2.: - Set io.status to IoStatus::success, and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, still truncated :(
84c66e1
to
aa4534d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some really minor things left. Sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bareos-check-source brought up some issues and the test configuration probably doesn't work as intended.
systemtests/tests/py2plug-fd-local-fileset-basic/CMakeLists.txt
Outdated
Show resolved
Hide resolved
systemtests/tests/py2plug-fd-local-fileset-basic/CMakeLists.txt
Outdated
Show resolved
Hide resolved
1e2fb47
to
9952746
Compare
6cec9e2
to
74eb304
Compare
2800b28
to
3bb485a
Compare
Implement `plugin_io_open()` so that we can configure direct I/O and pass the filedescriptor.
Sentinels for PyRestorePacket_members and PyIoPacket_members were incomplete and are now corrected.
Change every wrong use of "#" to comment out a bconsole command to the correct "@#" that will actually comment out the command and will not produce the error message "#: is an invalid command."
As do_io_in_core was removed from IoPacket again, the test should not check for it.
In bareosJobMsg() and bareosDebugMsg()
Change python-local-fileset-test to also use io_in_core.
The basic and io_in_core tests in py{2,3}plug-fd-local-fileset-basic will run into UTF-8 conversion errors when running under the python3 plugin. Until this problem is fixed, these tests are now marked as broken.
enum IoStatus: wrap into namespace
Replaces exec_program() with the newer execute_process().
The tests in pyplug-fd-local-fileset-basic are now enabled and disabled as originally intended.
Change status messages to use unicode "check mark" and "ballot x" when showing if a test was enabled/disabled. Also prints the directory containing the test now.
Changes the implementation of BareosFdPluginLocalFilesBaseclass to handle non-utf8 encodable file-names gracefully. Instead of crashing we will now emit an M_ERROR that the file's name cannot be represented and go on with the next file.
da73322
to
9ffa0bf
Compare
due to issues with multibyte files in the baseclass when using python3, we mark this test as broken for python3, as it will fail when python thinks the filesystem is in ascii-mode.
9ffa0bf
to
b39cdeb
Compare
The filedaemon api calls the plugin for doing the actual file I/O (i.e. reading during backup and writing during restore).
This is by far the most frequently called function in the plugin api and thus can have big impact on the overall performance.
This PR enables python plugins to pass the filedescriptor that is intended to do the I/O in the
open
call of the file inplugin_io_open()
,IOP.filedes
needs to be set to the filedescriptor for the file, andIOP.status
needs to be set tobareosfd.iostat_do_in_core
. Otherwise theIOP.status
should be set tobareosfd.iostat_do_in_plugin
Example:
In our test environment, the backup speed could be more than doubled so that the backup via python plugin was as fast as a backup directly via the filedaemon.
Please check
If you have any questions or problems, please give a comment in the PR.
Helpful documentation and best practices
Checklist for the reviewer of the PR (will be processed by the Bareos team)
General
Source code quality
bareos-check-sources --since-merge
does not report any problemsTests