-
Notifications
You must be signed in to change notification settings - Fork 49
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
Write tar files to a stream instead of to the filesystem first #22
base: 1.6
Are you sure you want to change the base?
Conversation
This improves performance when writing to a stream (i.e. there is no need to wait for the contents to be written to disk first), and can help solve EMFILE errors. This is achieved by using tar-stream instead of regular tar. This commit introduces a small shim in front of the file system and tar-stream to allow both direct disk writes and tar file stream writes. It then uses the appropriate shim (file system or tar-stream) throughout the codebase to create directories and store files.
Hi spmiller, can you change only index.js? |
1 similar comment
@hex7c0 done. Edit: coverage decreased because the tests can't run on a PR since the URI is defined with a secure variable. |
I realised the way I was injecting the document store made it difficult to see what was actually changing in the diff. I have now changed it to be stored as a global variable rather than injecting it into functions, which has made the diff much easier to digest. |
Hi @hex7c0, is there anything I can do to help get this merged? |
I'll work on it soon |
Any update on this? I'm getting the same issue with streams and fs. This would be much less of an issue if the plugin gzipped as that's tiny. My tar is coming out about 10 times bigger than the data. Unfortunately for me it renders the module useless, as databases grow and grow and Otherwise, it's a great module, I'm using it for hourly backups. |
Hey @hex7c0, is there anything more you need me to do before merging this? Our project is starting to have issues backing up large-ish databases, so I may need to start using my fork :( I am also planning a similar patch to the mongodb-restore library to support reading directly from the .tar.gz stream, but I wanted to get this one in first. |
hey @spmiller I'll try to allocate some time to do it |
Patched it to work with Mongo 4.x |
Whats the holdup on this? @hex7c0 |
Note that this seems to have a problem when the root directory does not exist (as it tries to create the tar file first): mongoBackup({
uri: Meteor.settings['mongoUri'],
parser: 'json',
root: 'dump/',
logger: 'mongo.log',
tar: 'dump.tar',
});
|
This improves performance when writing to a stream (i.e. there is no need to wait for the contents to be written to disk first), and can help solve EMFILE errors. This is achieved by using tar-stream instead of regular tar.
This commit introduces a small shim in front of the file system and tar-stream to allow both direct disk writes and tar file stream writes. It then uses the appropriate shim (file system or tar-stream) throughout the codebase to create directories and store files.
Potentially fixes #20.