-
Notifications
You must be signed in to change notification settings - Fork 462
Modify ServiceLock to use ServiceLockData vs custom byte array #3189
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
Conversation
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.
I like the changes to the ServiceLockData abstraction. I think that's a useful change on its own. After that change is done, I think the changes to add the service group are probably relatively minimal, so it's probably okay (meaning, I think I'd be in favor), but I'd like to see what this PR looks like after the ServiceLockData abstraction is done first, without the addition of the group. Would you be willing to do that?
core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java
Outdated
Show resolved
Hide resolved
log.trace("tid={} Looking up manager location in zookeeper at {}.", | ||
Thread.currentThread().getId(), zLockManagerPath); |
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.
Some of these log message changes seem unrelated to this PR. Might be useful to do those separately, first, so they don't detract from reviews on the main changes intended in this PR.
core/src/main/java/org/apache/accumulo/core/util/ServiceLockData.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/accumulo/core/util/ServiceLockData.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/accumulo/core/util/ServiceLockData.java
Outdated
Show resolved
Hide resolved
this(new ServiceDescriptors(new HashSet<>( | ||
Collections.singleton(new ServiceDescriptor(uuid, service, address, group))))); |
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.
this(new ServiceDescriptors(new HashSet<>( | |
Collections.singleton(new ServiceDescriptor(uuid, service, address, group))))); | |
this(new ServiceDescriptors(Set.of(new ServiceDescriptor(uuid, service, address, group)))); |
server/base/src/main/java/org/apache/accumulo/server/ServerOpts.java
Outdated
Show resolved
Hide resolved
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.
This will likely make debugging test failures harder - why the change? You can always set the level in your local copy, so the question becomes who is more inconvenienced by wanting to have the level at info vs debug.
The current levels haven't been a problem at all, as far as I'm aware. This PR should probably just keep the same value that's there now so there's no risk of bloating the logs and spamming us or filling disks on CI servers. If there's a compelling reason to change it, we can definitely change it, but it hasn't been a problem to this point and it doesn't seem to be related to this PR (at least, it wasn't clear whether it was related). If Dave found it compelling to lower it to debug for testing this PR, or if we end up needing to do that a lot, that's probably a compelling reason to change it... as long as it's not too spammy. It just wasn't clear to me why it was being done here. |
Yes, I would be willing to do that. However, if the ServiceLockData object doesn't support the group, then that will break the client and likely break the build. |
@@ -27,6 +28,17 @@ public class ServerOpts extends ConfigOpts { | |||
@Parameter(names = {"-a", "--address"}, description = "address to bind to") | |||
private String address = null; | |||
|
|||
@Parameter(required = false, names = {"-g", "--group"}, |
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.
Adding this option to server types where it does not do anything seems confusing to me. Like I can start a manager with the option, but it will not have any effect. Scoping it to only the tserver and scan server seems less confusing to me.
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.
My comment above regarding using our normal configuration property would make this a non-issue. Only server types where it makes sense would have that configuration property.
I am imagining the ScanServer's current |
Considering the information about the configuration, I think I'll work on a PR to get rid of server process arguments, and replace them with properties. Then, once that is merged in, I can update this PR which should just be the ServiceLockData changes. |
Created #3192 to remove arguments from the server processes |
f464cfc
to
bb05e41
Compare
return toString().compareTo(other.toString()); | ||
} | ||
|
||
public static Optional<ServiceLockData> parse(String lockData) { |
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.
Would this be more general if it took byte[]
and did the string conversion internally to the method?
I general this looks like a good change. It may help if the internal representations of the lock data were more encapsulated so that the storage type was not visible outside of the LockData. Looking at how to handle tservers and other processes that have locks when an upgrade occurs, one improvement could be if the lock data included either the data version or maybe the release version. While added either of those at this point would be out of scope for this PR, designing it so that it is easier to extend could help limit changes in the future. |
Full IT build passed |
Can you be more specific about what you think should be changed? The storage type is a JSON string. The only serialization / deserialization that happens is inside of ServiceLockData. |
What caught my eye was |
Another Full IT build passed. I believe I resolved all issues. I'm going to merge this morning. |
This change elevates the group argument that was found in ScanServerOpts to ServerOpts, the options used as the base for all Accumulo server processes. The ScanServer used a different format for the lock data in ZooKeeper that comprised the host address and the group name, which allowed clients to find ScanServers that were part of a specific group. By moving the group from ScanServerOpts to ServerOpts it became necessary to embed the group name into the ZooKeeper lock data for all processes. Prior to this commit the ZooKeeper lock data was not using a defined structure, but a String that could be set to anything. I renamed the ServerServices class to ServiceLockData and created a well-defined structure for registering the Thrift Services that were exposed by the Accumulo server process to include the host, port, and group in this structure. Then, I modiified ServiceLock so that it expected and returned a ServiceLockData object instead of a byte[].
Closes #3178