Skip to content

Remove Custom...Server.java classes and replace with Thrift implementation - #6454

Open
Amemeda wants to merge 11 commits into
apache:mainfrom
Amemeda:cleanup
Open

Remove Custom...Server.java classes and replace with Thrift implementation#6454
Amemeda wants to merge 11 commits into
apache:mainfrom
Amemeda:cleanup

Conversation

@Amemeda

@Amemeda Amemeda commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Investigated relevance of a few custom tserver related java classes, deleted them, reworked their implementation with thrift methods

Result:

  • Deleted files CustomThreadedSelectorServer.java, CustomBlockingServer.java, ClientInfoProcessorFactory.java
  • Added file ThriftServerEventHandler.java
  • in TServerUtils.java, implementing method setServerEventHandler(new ThriftServerEventHandler()); to applicable tservers
  • removed CUSTOM from ThriftServerType.CUSTOM_HS_HA, updated usages

@Amemeda
Amemeda marked this pull request as ready for review June 30, 2026 16:03
@Amemeda

Amemeda commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

@ctubbsii

@DomGarguilo DomGarguilo added this to the 4.0.0 milestone Jun 30, 2026
@DomGarguilo
DomGarguilo requested a review from ctubbsii June 30, 2026 21:04
@Amemeda
Amemeda requested a review from dlmarion July 8, 2026 16:23
Comment thread server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java Outdated
@Amemeda Amemeda changed the title Removing CustomThreadedSelectorServer.java Removing Custom...Server.java classes and replacing with Thrift implementation Jul 9, 2026
@Amemeda
Amemeda requested a review from dlmarion July 10, 2026 14:19
Comment thread server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java Outdated
@Amemeda
Amemeda requested a review from dlmarion July 13, 2026 15:09
@Amemeda Amemeda changed the title Removing Custom...Server.java classes and replacing with Thrift implementation Remove Custom...Server.java classes and replace with Thrift implementation Jul 16, 2026
@Amemeda
Amemeda requested a review from ctubbsii July 24, 2026 16:29

@ctubbsii ctubbsii left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I need to check this over again to see if there's anything else, but I did find one thing.

}

return new ServerAddress(new CustomNonBlockingServer(options), address);
final THsHaServer server = new THsHaServer(options);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In e2efd04, we added an override to the stop method because the upstream implementation does not attempt to shut down its internal executor service when stop is requested. In fact, it previously existed using reflection, but this commit cleaned up the implementation.

I think we probably still need that here, although, we don't need to override the whole class. We can probably just do it inline here, something like:

Suggested change
final THsHaServer server = new THsHaServer(options);
final THsHaServer server = new THsHaServer(options) {
@Override
public void stop() {
super.stop();
try {
getInvoker().shutdownNow();
} catch (Exception e) {
log.error("Unable to call shutdownNow", e);
}
}
};

This is probably a bugfix we can contribute to the Thrift project, so we don't need to maintain this indefinitely, but I think we still want it for now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I started looking into submitting a patch upstream to Thrift, and some of the code they have there seems worryingly bad. They have a graceful shutdown method for the invoker, but they never call it. It also uses awaitTermination but doesn't check the return boolean, and the loop uses the system clock rather (currentTimeMillis) than the CPU clock (nanoTime).

Upstream also allows the executor to be passed in as an argument, so you can provide a different implementation. But also that allows you to manage its lifecycle outside of this server's lifecycle, but I'm not sure that's a great idea.

In short, I think it's fine to keep our patch for now. Submitting a patch upstream isn't straight-forward... as it's not clear what the right design should be.

@dlmarion

Copy link
Copy Markdown
Contributor

I think ThriftServerType.CUSTOM_HS_HA needs to be renamed to remove CUSTOM_ from the enum name and value.

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.

4 participants