Skip to content

Conversation

@atn34
Copy link
Collaborator

@atn34 atn34 commented Sep 5, 2019

@xumengpanda
Copy link
Contributor

[Out of curiosity] Can you please elaborate what problem this PR tries to solve?

@ajbeamon
Copy link
Contributor

ajbeamon commented Sep 5, 2019

I've been interested in something like this too, but I think I might prefer either just changing the function to only do full addresses or adding an extra argument to the function to enable it. This approach is certainly simpler than adding a new argument everywhere, but it also seems a little arbitrary to a user of the API.

@atn34
Copy link
Collaborator Author

atn34 commented Sep 5, 2019

[Out of curiosity] Can you please elaborate what problem this PR tries to solve?

We made this change unconditionally in fdb3, and our application now relies on the port number being present. The idea is to take advantage of the fact that \xff\xff keys never have a physical location to allow a caller to opt in to getting the port without breaking any existing callers

I think I might prefer either just changing the function to only do full addresses

I prefer this too, but I think we need to wait for an api version bump to change this behavior. This is intended as an undocumented backdoor that we can use until then.

@ajbeamon
Copy link
Contributor

ajbeamon commented Sep 5, 2019

This is intended as an undocumented backdoor that we can use until then.

The unfortunate thing about this is that I'm not sure we can ever really remove this once we add it. We'd have to at least continue supporting it for this API version, even if it we remove it in future ones.

@mpilman
Copy link
Contributor

mpilman commented Sep 5, 2019

To give some context on this: We introduced a change in our FDB 3 code to return ip:port instead of ip (as the IP alone is not very useful for this use-case) and forgot to port it to FDB 6. However, our throttling code relies heavily on that which means that we can't survive without it. Currently we're running with a patched version of the FDB-client but I would prefer having this in a next patch release (which is not difficult as it changes behavior).

I talked to Evan about this and he suggested to do this hack with the \xff\xff prefix. The main drawback of this hack, as @ajbeamon pointed out, is that we will have to support this in future versions. I am not sure whether this is a big problem. The plan would be to then return ip:port by default in FDB 7. We could deprecate the \xff\xff prefix potentially in FDB 7.1?

We also discussed adding a new API version for a patch version, but IMHO this is ugly as it breaks expectations that we are stable within releases. We could also add a new function, but this will be even more painful to maintain in the future.

So overall we are very sorry that we missed this :( But we will need some mechanism to support this.

@ajbeamon
Copy link
Contributor

ajbeamon commented Sep 5, 2019

I think my overall preference for this is to not use the \xff\xff approach, as it has the potential compatibility issues. Instead, using a database or transaction option (which could be deprecated in the future) or a knob (which I suppose could be made into a no-op in the future, at least for larger API versions) would not introduce any compatibility issues that I've thought of, and it also avoids having to change code to add the prefix and then remove it later.

EDIT: I just noticed your reply on the other comment chain after I submitted this.

@atn34
Copy link
Collaborator Author

atn34 commented Sep 5, 2019

It sounds like we're all (relatively) happy with using a database or transaction option, and then deprecating it in fdb 7? I'll get started on that.

@atn34 atn34 changed the title Treat \xff\xff prefix as 'includePort' for get_addresses_for_key Add database/transaction option to control includePort behavior in get_addresses_for_key Sep 5, 2019
Copy link
Contributor

@ajbeamon ajbeamon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few other places where we would normally document options (Python and Ruby bindings at least), but perhaps given the circumstances of this it may not be necessary. There is also some code in the binding testers for each language that tries setting this option to make sure that the binding can do so without some weird result. That again may or may not be necessary.

The last thing that is potentially relevant here is a release note.

@atn34
Copy link
Collaborator Author

atn34 commented Sep 5, 2019

Done. I figure I might as well add all documentation and testing properly, since other users may find the port useful and not want to wait for the next release. PTAL

Copy link
Contributor

@ajbeamon ajbeamon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good. I'll merge when the tests are done.

@ajbeamon ajbeamon merged commit f39363b into apple:release-6.2 Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants