Skip to content

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

Merged
merged 15 commits into from
Feb 14, 2023

Conversation

dlmarion
Copy link
Contributor

@dlmarion dlmarion commented Feb 7, 2023

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

Copy link
Member

@ctubbsii ctubbsii left a 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?

Comment on lines +516 to +518
log.trace("tid={} Looking up manager location in zookeeper at {}.",
Thread.currentThread().getId(), zLockManagerPath);
Copy link
Member

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.

Comment on lines +154 to +152
this(new ServiceDescriptors(new HashSet<>(
Collections.singleton(new ServiceDescriptor(uuid, service, address, group)))));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
this(new ServiceDescriptors(new HashSet<>(
Collections.singleton(new ServiceDescriptor(uuid, service, address, group)))));
this(new ServiceDescriptors(Set.of(new ServiceDescriptor(uuid, service, address, group))));

Copy link
Contributor

@EdColeman EdColeman left a 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.

@ctubbsii
Copy link
Member

ctubbsii commented Feb 7, 2023

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.

@dlmarion
Copy link
Contributor Author

dlmarion commented Feb 7, 2023

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?

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"},
Copy link
Contributor

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.

Copy link
Member

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.

@ctubbsii
Copy link
Member

ctubbsii commented Feb 8, 2023

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?

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.

I am imagining the ScanServer's current -g option would go in the second PR, along with adding support for groups for tserver as well, so nothing is broken. I just think it makes sense to apply the "ServiceLockData abstraction/serialization" change feature first, then the "replace scan server group option with group added to ServiceLockData" feature after that, because they seem like they are discrete changes. I don't think the build needs to break to separate those out.

@dlmarion
Copy link
Contributor Author

dlmarion commented Feb 8, 2023

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.

@dlmarion
Copy link
Contributor Author

Created #3192 to remove arguments from the server processes

@dlmarion dlmarion force-pushed the 3178-tserver-groups-3.0 branch from f464cfc to bb05e41 Compare February 11, 2023 16:32
return toString().compareTo(other.toString());
}

public static Optional<ServiceLockData> parse(String lockData) {
Copy link
Contributor

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?

@EdColeman
Copy link
Contributor

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.

@dlmarion
Copy link
Contributor Author

Full IT build passed

@dlmarion
Copy link
Contributor Author

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

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.

@EdColeman
Copy link
Contributor

What caught my eye was ServiceLockData.parse(new String(data, UTF_8)); and was wondering if passing a byte[] would make it possible to isolate the internals more and then the rest was speculation on potential mods that could be able to use information stored within the lock itself.

@dlmarion
Copy link
Contributor Author

Another Full IT build passed. I believe I resolved all issues. I'm going to merge this morning.

@dlmarion dlmarion merged commit 476ebf2 into apache:main Feb 14, 2023
@dlmarion dlmarion deleted the 3178-tserver-groups-3.0 branch February 14, 2023 13:49
@dlmarion dlmarion changed the title Add group argument to server processes Modify ServiceLock to use ServiceLockData vs custom byte array Feb 14, 2023
@ctubbsii ctubbsii added this to the 3.0.0 milestone Jul 12, 2024
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.

Support balancing tablets using named tserver groups
4 participants