-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Clean up and support reuse of distribution capability bits #4972
Conversation
| DFLAG_BIT_BINARIES \ | ||
| DFLAG_MAP_TAG \ | ||
| DFLAG_BIG_CREATION) | ||
#define TERM_TO_BINARY_DFLAGS DFLAG_NEW_FLOATS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#define TERM_TO_BINARY_DFLAGS DFLAG_NEW_FLOATS | |
#define TERM_TO_BINARY_DFLAGS 0 |
Since DFLAG_NEW_FLOATS now are mandatory, or maybe I'm missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
binary_to_term(Bin, [{minor_version,0}])
is still supported (which will encode floats in a format that be decoded by releases before OTP R11B-4).
221dff2
to
e32bcbe
Compare
| DFLAG_BIT_BINARIES) | ||
|
||
/* Mandatory flags for distribution in OTP 25. */ | ||
#define DFLAG_DIST_MANDATORY_25 (DFLAG_EXTENDED_REFERENCES \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to nitpick naming, but when reading this I first mistook DFLAG_MANDATORY_25 and DFLAG_DIST_MANDATORY_25 for being the same thing.
Maybe call the single bit DFLAG_MANDATORY_25 something like
- DFLAG_MANDATORY_25_ROUNDUP
- DFLAG_MANDATORY_25_DIGEST
- DFLAG_MANDATORY_25_ABBREV
- DFLAG_MANDATORY_25_SHORTHAND
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to nitpick naming, but when reading this I first mistook DFLAG_MANDATORY_25 and DFLAG_DIST_MANDATORY_25 for being the same thing.
Good point. I will update the PR tomorrow to add some suitable suffix. Of your suggestions I like _DIGEST
best. I am also thinking of _COLLAPSED
.
The three applications that supports Erlang distribution (erts, erl_interface, and jinterface), do not agree which the mandatory distribution flags are. For example, DFLAG_NEW_FLOATS (support for the "new" external format for floats introduced in R11B-5) is considered mandatory in erl_interface, but not in the Erlang emulator. jinterface does not test the flag, but encodes all floats in the new external format. Update erts, erl_interface, and jinterface to all use the same set of mandatory distribution flags. Also make the following distribution flags mandatory: * DFLAG_EXPORT_PTR_TAG * DFLAG_BIT_BINARIES * DFLAG_MAP_TAG Support for them in erl_interface and jinterface was added in OTP 22 or earlier. Making them mandatory allows us to remove ugly fallback code.
During distribution connect setup between two nodes, the nodes exchange flags words encoding their capabilities. The connection setup is aborted if one of the node lacks a capability that the other node requires. In version 5 of the protocol (introduced in OTP R6), there are 32 possible capabilities (each encoded in a single bit). Since it seemed that we would soon run out of capabilitiy bits, protocol version 6 (introduced in OTP 23) expanded the number of possible capability bits to 64. To avoid having to extend the number of capabilites yet again from 64 to 128 in some future release, this commit introduces a scheme to allow reusing the bit numbers for capabilities that are now mandatory. The scheme is described in lib/kernel/include/dist.hrl. There are 10 mandatory capability bits as of OTP 25. This scheme will allow reusing 9 of those capability bits as early as in OTP 27.
e32bcbe
to
318ed46
Compare
@sverker I have renamed |
For further details, see the commit messages.