Skip to content
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

Changes to public API to expose resource groups #4851

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

dlmarion
Copy link
Contributor

Created ServerId objects to represent server addresses and resource groups Modified instance operations to use the new ServerId objects Consolidated all server location lookup code to new ServerIds object A lot of changes to use the new non-deprecated InstanceOperations methods

Closes #4849

Created ServerId objects to represent server addresses and resource groups
Modified instance operations to use the new ServerId objects
Consolidated all server location lookup code to new ServerIds object
A lot of changes to use the new non-deprecated InstanceOperations methods

Closes apache#4849
@dlmarion dlmarion marked this pull request as draft August 30, 2024 18:42
@@ -779,6 +761,21 @@ private void fetchCompactions() {
ThriftUtil.returnClient(tserver, context);
}
}
for (ServerId server : context.instanceOperations().getServers(ServerTypeName.COMPACTOR)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder if this change will start to show external compactions on the monitor front page.

@dlmarion dlmarion marked this pull request as ready for review August 30, 2024 20:11
*
* @param server The ServerId object
* @return the list of active compactions
* @since 4.0.0
Copy link
Contributor

Choose a reason for hiding this comment

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

This could have throws javadoc like getActiveScans does. Could also test passing in unexpected server types in an IT.

* @param server server type and address
* @return A stream of active scans on server.
* @since 4.0.0
* @throws IllegalArgumentException when the type of the server is not TABLET_SERVER or
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to test passing unexpected server types to this method in an IT.


import com.google.common.base.Preconditions;

public abstract class ServerId implements Comparable<ServerId> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should have javadoc w/ a since tag. Also the child types should have a since tag.

*/
package org.apache.accumulo.core.client.admin.servers;

public enum ServerTypeName {
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs a since tag.

private final String host;
private final int port;

protected ServerId(ServerTypeName type, String resourceGroup, String host, int port) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This suggestion of making the constructor package private goes w/ making the child classes final.

Suggested change
protected ServerId(ServerTypeName type, String resourceGroup, String host, int port) {
ServerId(ServerTypeName type, String resourceGroup, String host, int port) {

@@ -145,6 +145,8 @@ enum Type {
String getAddress();

int getPort();

String getResourceGroup();
Copy link
Contributor

@keith-turner keith-turner Sep 3, 2024

Choose a reason for hiding this comment

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

We should open a follow on issue to look into deprecating and replacing this CompactionHost interface in favor of the new ServerId type.


import com.google.common.net.HostAndPort;

public class ServerIds {
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't really look at this class, let me know if there is anything in it you would like a 2nd pair of eyes on.

break;
}
if (test == null) {
return results;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could avoid returning mutable sets.

Suggested change
return results;
return Collections.unmodifiableSet(results);

For the stream I think Collectors has a function for collecting to an unmodifiable set.

final Set<ServerId> results = new HashSet<>();
switch (type) {
case COMPACTOR:
results.addAll(context.getServerIdResolver().getCompactors());
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure this is worthwhile, wondering if would be useful to push the predicate down. Please ignore this comment if it does not make sense.

Suggested change
results.addAll(context.getServerIdResolver().getCompactors());
results.addAll(context.getServerIdResolver(test).getCompactors());

@dlmarion
Copy link
Contributor Author

dlmarion commented Sep 3, 2024

Full IT build passed

@dlmarion dlmarion self-assigned this Sep 11, 2024
@dlmarion dlmarion added this to the 4.0.0 milestone Sep 11, 2024
@dlmarion
Copy link
Contributor Author

Merged in main which contains #4861 . Setting this back to draft because I need to re-review the changes.

@dlmarion dlmarion marked this pull request as draft September 16, 2024 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Add resource group to CompactionHost
2 participants