Create tserver.group, add group to location information#3482
Conversation
1. Adding TSERV_GROUP_NAME property to add resource groups to TabletServers like has been done for Compactors and ScanServers 2. Modified TServerInstance to include the group in the location information. 3. Modified TabletMetadata to remove the session from the location columns colq and put all of the location information in the column value. 4. Modified MetricsUtil to add the servers resource group as a tag to all emitted metrics 5. Modified CachedTablet to use the TServerInstance instead of interned strings for the server and session.
|
This ended up being a bigger change than I expected. Follow-on work includes: Rename compactor.queue |
| mutation.put(getLocationFamily(location.getType()), location.getSession(), | ||
| location.getHostPort()); | ||
| mutation.put(getLocationFamily(location.getType()), "", | ||
| location.getServerInstance().toString()); |
There was a problem hiding this comment.
This may be one of the biggest changes in this PR. It removes the sessionId from the ColQ of the location columns in the metadata and puts the <host:port>#<sessionId>#<resourceGroup> in the Value. I was wondering why the sessionId was in the colq to begin with, that seems like it would allow more than one entry for the location type in the metadata table.
There was a problem hiding this comment.
Associated with this change, I ended up removing a test for https://issues.apache.org/jira/browse/ACCUMULO-1248 as it no longer applied - the test would not work.
There was a problem hiding this comment.
Not sure if session id applies here, but my impression is that session id was used to detect client ZooKeeper re-connections. If a ZooKeeper session failed (did not respond with ZooKeeper tick time), but then established a "new" connection - the change in session id was detected to signal that there is a possibility that information in ZooKeeper could have changed while the session was "off-line". This may be a ZooCache centered view, but maybe it applied here?
There was a problem hiding this comment.
That's good information. I don't have the history to know why sessionId was in the column qualifier. It seemed like a bug to me as it would allow multiple current, future, or last entries.
There was a problem hiding this comment.
@EdColeman - do you happen to know where the code is that detects a change in sessionId?
Edit: I think it's TabletMetadata.getTabletState(Set<TServerInstance>). That code should still work.
There was a problem hiding this comment.
I was wondering why the sessionId was in the colq to begin with, that seems like it would allow more than one entry for the location type in the metadata table.
I do not know of a specific reason why it was structured that way. It did allow detection of certain bugs like if the manager set a location on a tablet that already had a location, but I don't think that is why it was structured that way. Using conditional mutations can help avoid these bugs instead of detecting them after the fact. We could take this a step further and push the current vs future designation into the value and have a single column for location.
keith-turner
left a comment
There was a problem hiding this comment.
Not finished looking at this. Plan to look at it some more tomorrow.
| this.session = session; | ||
| this.hostPort = hostAndPort.toString(); | ||
| this.hostPortSession = hostPort + "[" + session + "]"; | ||
| this.group = group; |
There was a problem hiding this comment.
Is it expected that group can be null? If so is null expected to make it through serialization and deserialization?
There was a problem hiding this comment.
No, the default value is ServiceDescriptor..DEFAULT_GROUP_NAME.
| return tServerInstance.getHost(); | ||
| } | ||
|
|
||
| public String getHostPort() { |
There was a problem hiding this comment.
Why were these methods removed?
There was a problem hiding this comment.
Because they were redundant. The calling code can just call the method directly on the TServerInstance returned by getServerInstance().
There was a problem hiding this comment.
ok, personally I liked some of these. Saw them as convenience methods that made common patterns a bit shorter. But I don't care that much if they are removed.
There was a problem hiding this comment.
I agree that it makes the calling code shorter to read. However, I saw them as a potential source for a bug if for some reason someone changed them.
| return 0; | ||
| } | ||
| return this.getHostPortSession().compareTo(other.getHostPortSession()); | ||
| return this.getHostPortSessionGroup().compareTo(other.getHostPortSessionGroup()); |
There was a problem hiding this comment.
Is it expected that the group would never change for an instance? If it did change it would be problematic to include it in compare, hashCode, and equals methods for tserver instance.
There was a problem hiding this comment.
The group would be passed to the process as an argument (-o tserver.group=foo), so it is expected to be static for the life of the instance. If the argument is not supplied, then the default value is used (ServiceDescriptor..DEFAULT_GROUP_NAME = default).
| updateCache(locToCache, lcSession); | ||
| } | ||
| } else { | ||
| log.warn("Metadata tablet not found for row: {}", metadataRow); |
There was a problem hiding this comment.
This case could happen when a metadata tablet is temporarily not hosted. Would not want to warn in that case.
| log.warn("Metadata tablet not found for row: {}", metadataRow); | |
| log.debug("Metadata tablet not found for row: {}", metadataRow); |
| "1.3.5"), | ||
| TABLE_ASSIGNMENT_GROUP("table.assignment.group", ServiceDescriptor.DEFAULT_GROUP_NAME, | ||
| PropertyType.STRING, | ||
| "Tablets for this table will be assigned to TabletServers that have a corresponding" |
There was a problem hiding this comment.
This statement may not be true, it depends on the behavior of the balancer? Unless the balancer is limited to only assigning to tserver within the group?
We could limit balancing choices to a group, so a balancer could only chose from tservers within this group. That may require some changes to the SPI, not sure. Or this could be provided as information to the balancer, but it does not have to honor it. If the balancer does not have to honor it then would need to change the description.
There was a problem hiding this comment.
Unless the balancer is limited to only assigning to tserver within the group?
I think we should do this given that there is a default resource group and the ability to create others.
| te.setLocationOnce(val, LocationType.FUTURE, suppressLocationError); | ||
| break; | ||
| case LastLocationColumnFamily.STR_NAME: | ||
| te.last = Location.last(val, qual); |
There was a problem hiding this comment.
What is the benefit of pushing the tservers group into the metadata table for each tablet?
There was a problem hiding this comment.
It would be needed by the Manager to know whether or not a table's tablets are balanced in the correct group.
There was a problem hiding this comment.
The manager could get the group information about each tserver w/o it being stored in each tablet.
There was a problem hiding this comment.
You may be correct, and it may already be done with the changes that I made to LiveTServerSet. I will investigate.
|
Closing in favor of the implementation in #3496 |
This change includes: