Merge pull request #1121 from mpilman/features/fdbcli-include-r6

Fix bug in `include` command
This commit is contained in:
A.J. Beamon 2019-02-08 08:15:40 -08:00 committed by GitHub
commit a68dcdf9ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View File

@ -2,6 +2,16 @@
Release Notes
#############
6.0.19
======
Fixes
-----
* The ``include`` command in fdbcli would falsly include all machines with IP addresses that
have the included IP address as a prefix (for example ``include 1.0.0.1`` would also include
``1.0.0.10``) `(PR #1121) <https://github.com/apple/foundationdb/pull/1121>`_
6.0.18
======

View File

@ -1155,8 +1155,17 @@ ACTOR Future<Void> includeServers( Database cx, vector<AddressExclusion> servers
tr.clear( excludedServersKeys );
includeAll = true;
} else if (s.isWholeMachine()) {
// Eliminate both any ip-level exclusion (1.2.3.4) and any port-level exclusions (1.2.3.4:5)
tr.clear( KeyRangeRef( encodeExcludedServersKey(s), encodeExcludedServersKey(s) + char(':'+1) ) );
// Eliminate both any ip-level exclusion (1.2.3.4) and any
// port-level exclusions (1.2.3.4:5)
// The range ['IP', 'IP;'] was originally deleted. ';' is
// char(':' + 1). This does not work, as other for all
// x between 0 and 9, 'IPx' will also be in this range.
//
// This is why we now make two clears: first only of the ip
// address, the second will delete all ports.
auto addr = encodeExcludedServersKey(s);
tr.clear(singleKeyRange(addr));
tr.clear(KeyRangeRef(addr + ':', addr + char(':' + 1)));
} else {
tr.clear( encodeExcludedServersKey(s) );
}