Skip to content

Issue 34488:Remove Abstract Component #35898

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 7 commits into from
Jan 25, 2019
Merged

Conversation

ricardojaferreira
Copy link
Contributor

TransportAction and BaseRestHandler now no longer extends AbstractComponent. The AbstractComponent no longer has usages so it was deleted.

Relates to #34488

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Member

@cbuescher cbuescher left a comment

Choose a reason for hiding this comment

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

@ricardojaferreira I left two comments, also please note that this change in its current form doesn't compile and there are PRs that are still not merged that are necessary to go in before we are actually able to remove this class entirely (e.g. #35394)


protected final String actionName;
private final ActionFilter[] filters;
protected final TaskManager taskManager;
private static final Logger logger = LogManager.getLogger(TransportAction.class);
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure that we want every action extending this to use the same logger. Also the visivility won't work, this leaves a lot of compile errors for me in "server".

Copy link
Member

Choose a reason for hiding this comment

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

I think we should do the same thing here as we do for BaseRestHandler.


public static final Setting<Boolean> MULTI_ALLOW_EXPLICIT_INDEX =
Setting.boolSetting("rest.action.multi.allow_explicit_index", true, Property.NodeScope);

private final LongAdder usageCount = new LongAdder();
private static final Logger logger = LogManager.getLogger(BaseRestHandler.class);
Copy link
Member

Choose a reason for hiding this comment

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

This logger appears to be unused.

Copy link
Member

Choose a reason for hiding this comment

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

I was thinking of having something like:

@Deprecated
protected static Logger logger = LogMangaer.getLogger(getClass());

in 6.x and master and then removing it entirely from master in a follow up change.


protected final String actionName;
private final ActionFilter[] filters;
protected final TaskManager taskManager;
@Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this logger deprecated?

Copy link
Member

Choose a reason for hiding this comment

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

I think that subclasses of TransportAction should declare their own logger. But I think it'd be kinder that that were only a hard requirement for 7.0 so making a deprecated logger here is nice, so long as we follow up to zap it.

Copy link
Contributor

@pgomulka pgomulka left a comment

Choose a reason for hiding this comment

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

@ricardojaferreira great effort, thank you. I left some comments. Make sure the build passes to you locally. Definitely ./gradlew assemble precommit. Consider running ./gradlew check to see all tests passing


public static final Setting<Boolean> MULTI_ALLOW_EXPLICIT_INDEX =
Setting.boolSetting("rest.action.multi.allow_explicit_index", true, Property.NodeScope);

private final LongAdder usageCount = new LongAdder();
@Deprecated
protected static Logger logger = LogManager.getLogger(BaseRestHandler.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this logger deprecated?

Copy link
Contributor

Choose a reason for hiding this comment

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

should this be for getClass() instead of BaseRestHandler.class?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, getClass() I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, Thanks for the comments. I am still understanding how the project works. Anyway, to use getClass() the logger cannot be static. Is that ok? (Or am I seeing something wrong here)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, Thanks for the comments. I am still understanding how the project works. Anyway, to use getClass() the logger cannot be static. Is that ok? (Or am I seeing something wrong here)

@@ -18,24 +18,26 @@
*/

package org.elasticsearch.action.support;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.message.ParameterizedMessage;
Copy link
Contributor

Choose a reason for hiding this comment

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

that seems to be unused, do we need that? (won't pass the build)


protected final String actionName;
private final ActionFilter[] filters;
protected final TaskManager taskManager;
@Deprecated
protected static Logger logger = LogManager.getLogger(TransportAction.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be for getClass() instead of TransportAction.class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same has above, use getClass with static?

Copy link
Member

@cbuescher cbuescher left a comment

Choose a reason for hiding this comment

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

Hi @ricardojaferreira, as far as I see your last commit only changed the visibility of the loggers in TransportAction and BaseRestHandler but their would still share the same logger with all inheriting classes. I left a comment along those lines. I might not be totally up to date with the current state of the final works on #34488 so I ask @nik9000 and @pgomulka to also take a look because they will know the remaining other work that needs to get done around it.


protected final String actionName;
private final ActionFilter[] filters;
protected final TaskManager taskManager;
@Deprecated
protected static Logger logger = LogManager.getLogger(TransportAction.class);
Copy link
Member

Choose a reason for hiding this comment

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

Using "LogManager.getLogger(TransportAction.class)" would still mean all inheriting classes using this would share the same logger. I don't think this is what we want. Something like "LogManager.getLogger(getClass())" might work for now. Also: why did you add the "@deprecated" annotation? The loggers themselves are not ment to be deprecated as far as I understand #34488 .

Copy link
Member

Choose a reason for hiding this comment

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

I like deprecating them because I think everything that wants a logger should declare one. That way we don't have a zillion loggers we don't use. I do think that if you deprecate something you should add javadoc explaining what to do instead. Something like:

/**
 * @deprecated declare your own logger.
 */
@Deprecated
protected static Logger logger = LogManager.getLogger(TransportAction.class);

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 will add the comment on deprecated loggers.


public static final Setting<Boolean> MULTI_ALLOW_EXPLICIT_INDEX =
Setting.boolSetting("rest.action.multi.allow_explicit_index", true, Property.NodeScope);

private final LongAdder usageCount = new LongAdder();
@Deprecated
protected static Logger logger = LogManager.getLogger(BaseRestHandler.class);
Copy link
Member

Choose a reason for hiding this comment

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

same here as above.

Copy link
Member

@cbuescher cbuescher left a comment

Choose a reason for hiding this comment

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

Thanks for the update, LGTM

@pgomulka
Copy link
Contributor

pgomulka commented Jan 21, 2019

@ricardojaferreira could you please merge upstream master into this PR? (as it is failing backwards compatibility tests at the moment)
Or do you mind if I do it instead (still on your master).

@pgomulka
Copy link
Contributor

pgomulka commented Jan 24, 2019

@elasticmachine run packaging-sample

@pgomulka
Copy link
Contributor

@elasticmachine run elasticsearch-ci/packaging-sample

Copy link
Contributor

@pgomulka pgomulka left a comment

Choose a reason for hiding this comment

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

LGTM. Build passes

@pgomulka pgomulka merged commit df8fa97 into elastic:master Jan 25, 2019
@pgomulka
Copy link
Contributor

@ricardojaferreira the PR now passed the build and I have merged your change. Thank you once again for you contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >refactoring v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants