The history/story behind transparent scm
I'd like to tell the story of how Plastic evolved towards "transparent scm". What you're seeing today in 4.0 is the result of quite an evolution since we first wanted to walk the transparent path.Inspiration
Believe it or not, our original inspiration towards transparent scm was good-ol ClearCase. CC implemented MVFS, a dynamic file system able to show you the full file tree of a given version, capture all IO calls and adjust them to SCM operations.
Sample: cat foo.c@main@4
Would be captured by the CC fs driver and instead of issuing a "file not found" it would be able to get the right version of the file to be dumped by "cat".
Likewise it was able to intercept "move" operations so you didn't need to run "cleartool mv" command. What does it mean? You don't need to tell the SCM that you modified a file or that you moved it: it is intercepting all your IO actions, and making the right ops at the FS level!
So, definitely, we always wanted to have some sort "move interception" to avoid having to "tell" plastic a file or dir was moved... it would simply know.
First attempts
We code-named "glass" the first version of what we called "plastic made transparent" (hence glass).
Glass was able to use some underlying FS layer (third party FS driver code to simplify FS creation) to intercept all ops and:
Well, writing your own FS is always a cool thing, but there were caveats:
So, while we used glass internally, we never moved it to production mode.
Xdiff
Ok, you might think: what does Xdiff have to do with transparent?? Well, Xdiff implements an algorithm to find moved fragments of text even when they've been modified afterwards. It is able to calculate "similarities".Xdiff opened up a new door to make Plastic transparent.
The current version
When we started the development of 4.0 we knew we wanted a new way to deal with local changes:And we applied the Xdiff technology. How?
This way the "pending changes view" is now able to figure out what you did on your workspace, including modified and moved files, and directories (remember dvcs like git or mercurial are not able to track directory renames or moves).
Meh... I use darcs, mercurial, bazaar, git, monotone (etc?) for that.
ReplyDeleteBasically, any SCM worth its salt can detect/track changes. Plastic will just be the only one that requires a filesystem driver to do it. Note that there is FileystemWatcher (.NET on Windows) and INotify (all others) if you wanted to improve on the performance (which in practice isn't an issue).
As the saying goes: "Now you've got two problems".
The implications aren't trivial.
DokanFS is not portable: it works on windows (though it is similar to what Fuse is on Mac/Linux/...).
Plastic will require the working tree to be on a special mountpoint, which is in actual fact not (just) a filesystem: it is more like an auto-journalling database. This will hurt performance. Expect real trouble with shared fileservers, Access Control Lists (add Active Directory). Visual Studio might not perform very well working on such an FS (due to lack of/suboptimal support for memory mapped files, execute permissions; anyone work in an environment where launching executables off a non-local drive is prohibited? Right, every big corporation has that, and the mechanics rely in part on the availability of NTFS alternative streams, which can mark/sign a file as 'safe for execution'). Now, I wouldn't trust that debugging/running on IIS over the DokanFS would be problem free (will it detect changes in Web.config? Will access control be ok, or do we need to run the ASP worker under an administrator account, just so we can make it access our worktree?). I'd expect real trouble with unicode filenames, filesharing, 64 bit Windows 7/Vista support...
Even if the filesystem is really only a proxy to an existing NTFS folder, we're not safe: that would allow concurrent edits directly to the backing filesystem. How would changes get detected when the Plastic 'transparent FS' driver wasn't properly loaded/functioning?
Oh, and if 'renaming'/'moving' _empty_ directories is so important, by all means make stuff explicit in deployment, or consider documenting things. (I spot a rather spicy paradox between the beloved and beraved 'XDiff' (able to detect functions mov across files!) and the apparent need for tracking 'empty folder identity'. Mind you, I concur that XDiff is something of a marvel (though not entirely new) but, if you care for content over location, how would you mourn the loss of directory renames?
I say, this looks like overkill and costs performance. The number one asset that a developer appreciates about his development workstation is swift operation. Only after that come full automation, user-friendliness and varnish.
Cheers,
Seth
Hi Seth,
ReplyDeleteThanks for the comments!
A few remarks:
1- The "fs stuff" is not there now. It is just a prototype. We're able to "track moves" without the help of a FS driver, of course!!!!
2- Well, the "glassfs" will be some sort of "dynamic view", and believe me when I tell you there are huge teams out there under really high demanding environments... demanding it.
Regarding your comments:
> Basically, any SCM worth its
> salt can detect/track changes.
You now that Git and Hg can't detect directory moves, don't you? As easy as it sounds, you move a directory with 1000 files and the poor boys detect 1000 file moves... Sad, but true. Try it with Plastic :)
> Plastic will just be the only
> one that requires a filesystem
> driver to do it.
As I said, you're missing part of the picture there. We don't need it to detect changes, I'm just talking about a new potential feature.
> Note that there is FileystemWatcher (.NET on Windows)
I wonder why you think I didn't go through it :). FSWatcher can't detect file "moves". INotify can, but Windows CAN'T (not even the C native interface, it simply doesn't do it). File moves is the missing piece.
Also the "watcher" is not meant for precise monitoring, you can loose changes under heavy IO load, which is basically what happens during SCM operation...
Thanks for the remarks,
pablo
Thanks for this response. Sadly I noticed really late (because I think it took /forever/ for the comment to be moderated?)
ReplyDeleteAnyways. Solid arguments. Yeah, I had been misreading things a bit.