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
kvs: add optional namespace key prefix #1341
Comments
thinking about this today about a plan of action to get this working
|
Multiple? I think we decided that a txn that references more than one namespace is an error, since the transaction could not be atomic. |
@garlick oh dang, you're right. And it's written as such in the first comments above. I had just forgotten :-) |
So something I was thinking about while working on this issue. Currently, a lookup RPC returns the With the potential to leap namespaces via symlink, the returned Unsure of the need, but it is definitely more of a long term thing. Then it got me thinking. Longer out, maybe we would want to support "hard" and "soft" symlinks? The "hard" version could reference a specific
|
Looking at the libkvs code, I can't see that the rootdir in the lookup response is ever actually used. (Sorry, when we spoke yesterday I thought it was used for the "snapshot walk" feature in I guess the issue you describe is still a bit problematic for "lookupat" in general, e.g. if you're expecting to walk a snapshot and you cross a symbolic link that takes you out of it, your expectations may be violated. However, I'm not sure that is fundamentally broken, since how you deal with a symlink in that situation is up to the user. So maybe for now just drop the As for "hard symlinks", is there any point in including the namespace and the content reference? The content reference is namespace-independent, so it seems like that's just a "hard link", which we already support, implicitly and explicitly. Implicitly when two keys happen to point to content with the same hash, and explicitly with |
Ok, lets drop For the record, I can't think of a scenario where the hardlink is actually necessary as there are other ways of doing what needs to be done. It's just an idea I thought of in case a user did the following: assume
The first get returns |
Yeah, I think that's probably the right outcome when accessing a symlink in a snapshot that crosses into another namespace. The immutability of the snapshot only holds for the symlink itself, not its target. |
Just discussing idly this morning with @garlick about the possibility of future inconvenience by co-opting the This would reduce the likelihood of users wanting to use a key with the namespace character embedded (since this would be allowed without the Just wanted to throw this idea out there. |
Good idea.. Any thoughts on this @chu11? |
In general, I think it's a good idea. I was bring this up later on, b/c the separator isn't that important. We can change the parsing out of the key/namespace later on. I originally was going to suggest |
So today I finished up namespace prefix support on lookups for the initial key passed in by the user. I then began to add support on the commit/fence side. As I was working on this, I realized, there's a lot of code to support this. A lot of At some point, I pondered, is this a good idea? We're introducing a lot of branches and parsing and stuff for a common path, which is possibly not going to be used that much. Do we care that much about namespace prefixes on the initial key/path input by the user? Perhaps namespace prefix only should be allowed for symlinks? |
Avoiding
I'm probably not going to be much help with the larger question here, sorry. Keep in mind the main use case for namespaces is so that the "job shell" and front end tools can "chroot" or otherwise have an easy handle to the job namespace. It would seem to be cleaner if this doesn't have to be done by bouncing through a symlink. |
Going with the |
The use case I had in mind for the symlink support was for the instance owner to be able to walk the various job namespaces to obtain status or whatever without needing to track the mapping of jobs to namespaces in some other way. (An obvious way would be to store the namespace name in a per-job key in the primary namespace) It wouldn't be a proper symlink if the target is special, i.e. you can't do a readllink on the target and manually look that up. I guess this was a "nice to have" feature, so if it turns out to make a mess of things, we can always fall back to something like the above... Maybe talk more on monday? |
Wasn't suggesting we don't support namespace prefix on symlink, just on the base keys that user inputs. So for example:
We'd still support:
But not support
Users would have to do
But we can talk more on Monday. |
Spoke to @garlick, went back and forth on thoughts. Jim had a good idea. On commit/fence transactions, the user can send in a list of operations (i.e. key=value pairs). We will only check the first operation's key to determine the namespace this set of operations belongs to, instead of checking every key to determine if they all belong to the same namespace. When we apply the operations to the kvs, if the user goes outside of the namespace, we issue an error. This simplifies things a lot. In addition, chains of namespaces (i.e. |
After talking to @garlick, what we've decided is that "namespace chaining" i.e. something like key = "A/B/C/val" is not going to be allowed. The user can specify at most one namespace prefix. If more than one is specified, it's an error. |
with #1432 merged in, I think this issue is complete. There are some nit-picky issues remaining, but they are listed in other issue tickets. |
In #1197, a suggested simpler alternative to the "mount points" discussed in RFC 16 is an optional namespace key prefix, specified like
primary/a.b.c
that could be the target of a symlink.Example, guest namespace created for job is named
00b5c36c-1296-11e8-b0c4-43d860a24705
. The primary namespace portion of the job schema could have a symlink like:Then the user can lookup
jobs.42.guestns.whatever
like it was all one namespace.The problem we discussed was that commit transactions might reference keys in multiple namespace, and that would break atomicity as well as complicate the commit handling code. We decided that case needed to be detected and failed, but then ran into a problem such a commit could be merged with a perfectly valid commit, and then the good commit would fail also.
A proposal to solve this latter problem is now in #1337. If we can get that fixed, then the proposed namespace prefix could presumably be implemented.
The text was updated successfully, but these errors were encountered: