-
-
Notifications
You must be signed in to change notification settings - Fork 516
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
tmpDir doesn't seem to be configurable #8498
Comments
Thanks for the issue. I'm not too familiar with how we allocate We've shied away from OS specific implementations of temporary storage because they are fragile. But making it configurable may be an option. |
I might be wrong but the directory appears to be created by
The logic looks for As for implementing OS specific temp storage logic - this is part of the |
We've had lots of |
The reason we use our own tmp directories is that Go's file system operations are very OS-specific, and certain operations break across partition boundaries on some OSes. To mitigate this problem, we drop tmp directories in locations we control, next to where the data files are stored. An advanced user should be able to control this, though. We can give you a config setting to override it. |
Can you clarify what steps you are taking to get ".tmp" in /usr/local/bin? I'm not seeing that happen. What OS are you on? Are you running as a privileged user? Otherwise, I don't know how we'd have permission to even create that .tmp dir. I'll add an option for you to specify the tmp dir of your choosing. Just want to be sure I understand how you are getting the behavior you are seeing. Also, some operations will always use the ".dolt" directory for the purposes of building our data files. These operations are always the precursor to a storage update which needs to have everything in the same OS partition. |
The seed for the temp directory is taken from the OS, and that will use the "TMPDIR" environment variable. If you set TMPDIR, and does it help? Are there specific dolt operations which are causing problems? Again, since I'm not seeing the behavior your are, I want to make I have as many repro steps as possible. |
For more clarity, the only circumstance where we create the ".tmp" directory at all is when the OS prevents us from renaming a file in the OS's standard temp directory. So knowing the OS, and if you have a novel file system would be helpful. |
Thanks for getting involved in this, Neil!
When Dolt is installed system-wide (placed in /usr/local/bin/) and a standard OpenRC script is created for it so (it can run as a service), OpenRC changes its directory to the location of the binary (/usr/local/bin) and starts it from there. Since I am passing For instance:
(*I have manually added the empty lines so it is easier to read) The OpenRC script is just a boilerplate, only with the
Interestingly enough, the env var
Could it be the Go env var for temp (GOTMPDIR) rather than the OS one? For clarity, I am using
Since you can't reproduce this behaviour, and there doesn't seem to have been other reports of this in the past, this is likely a more isolated incident to how Alpine operates, in combination with the user trying to utilise the Dolt given settings to move things out of current working directory. Thus, a configuration setting for the temp data would quite likely fit best rather than considering changes on how the temp dir is appointed. |
Ok, I'm getting closer. running as root on a linux machine helps. log below. You can see we attempt to create the Going to read through your steps and see if I missed anything, but by looking at the code it has to be that the rename which is failing: dolt/go/cmd/dolt/system_checks.go Line 43 in 746ebc6
I'm going to see if I can trigger this by adding another file system.
|
The only reproduction I can successfully perform where we create the ".tmp" directory is when we have multiple file systems in play. I don't see any mention of multiple mounted file systems in your description. Can you confirm one way or another? I suspect if you attempt to run My repro is a little contrived, but I used a ramfs and I tweaked the dolt binary to log the error produced during the rename:
Note, that I only was able to do this by setting TMPDIR env var, but the main call out is that our test of moving "./testfile" is effectively forcing you to start the binary on the same file system where you will store your data files. That is certainly a bug, and I'll get on fixing that. |
One more thing, I suspect your "/tmp" is on a different file system than /usr, which is what is causing all of this. This is why setting TMPDIR=/tmp has no effect. |
You are correct! Indeed, this does seem to relate, this test confirms your assumption:
This is a playground environment of a minimal Alpine linux. I haven't partitioned the system in anyway as it's a virtual environment - only the standard
I could be wrong but I consider For clarity, I have installed very few packages on this Alpine instance and I don't believe I have made any OS related modifications that could affect how the OS runs. If necessary, I can spin up another instance of the latest Alpine and test this on it - just let me know what/how you want me to test and I'll see what I can do to assist.
I played around a bit with the
The config file I am using (the aforementioned Albeit, I don't think the config file matters much since the
So you are definitely right on pinpointing this to the file system difference! I just hope something can be done about Dolt properly using Thank you for the time and effort, it is appreciated! |
Thanks for confirming. The use of CWD when you specify a data dir is definitely wrong. I agree that /tmp being on another partition is a good practice, and dolt should play nice with others. One thing that makes this a little trickier is that some Dolt temp files need to be renamed to place them into our storage system. These files must be on the same partition as the data dir. Other files should just go in /tmp or TMPDIR, as you would expect. I need to refactor a bit to make the two categories clear. Regardless, I think I have a good idea of what is causing your pain and I'll have a fix out in the next day or so to address it. |
Heads up that I'm still working on this. There are actually a couple bugs in play here, both of which need a little care. In the meantime, you can work around this by specifying the --data-dir option on the command line arguments instead of in the config file. Specifically, you'll want to do it before the
Having the argument duplicated in the config file will not cause harm, but will slow start up because we'll load the DB twice. The change I'm working on will discover and use the data dir option in the config file earlier in startup processing. It will also error out if there is ambiguous configuration. Until I have that out for you, I suggest you use the |
I've been playing around with Dolt and I am annoyed at the constant creation of a ".tmp" directory in the same location as the binary file. I checked GitHub issues, I searched through the docs - didn't see anything related to a setting altering this. Furthermore I looked over the code (directly searching for ".tmp") and as far as I can see tmpDir doesn't seem to have any configurable ways - it is hardcoded to be always placed in the same directory as the binary.
If I am missing something, please let me know what I can add to my config file so I can place the tmpDir in appropriate place and not inside of
/usr/local/bin
, in which my dolt bin resides.If I am not missing anything and tmpDir is indeed not configurable - please make it configurable! At the very least, temp data belongs to
/tmp
on GNU systems.The text was updated successfully, but these errors were encountered: