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

Reap previously launched logviewer tasks #240

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

srikanth-viswanathan
Copy link

Reap previously launched logviewer tasks if mesos.logviewer.sidecar.enabled is now false

Fixes #239

Reap previously launched logviewer tasks if `mesos.logviewer.sidecar.enabled` is now `false`
@srikanth-viswanathan
Copy link
Author

srikanth-viswanathan commented Mar 17, 2018

The only visible side effect of this change is that you'll now see this line every 5 minutes if the logviewers znode doesn't exist (as would be the case if, say, logviewers were never enabled):

2018-03-17 03:25:16.968 s.m.u.ZKClient [ERROR] org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /storm-mesos/logviewers

Do you think this is a problem? I'm open to your suggestions.

@srishtyagrawal srishtyagrawal self-assigned this Mar 20, 2018
@JessicaLHartog JessicaLHartog self-assigned this Mar 20, 2018
import org.apache.mesos.Protos.OfferID;
import org.apache.mesos.Protos.SlaveID;
import org.apache.mesos.Protos.TaskStatus;
import org.apache.mesos.Protos.*;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you revert the * import back to explicit imports? We don't like * imports.

Choose a reason for hiding this comment

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

Sure, I didn't realize my IntelliJ settings had that enabled by default.

@@ -98,6 +94,7 @@ public void statusUpdate(SchedulerDriver driver, TaskStatus status) {
if (status.getTaskId().getValue().contains("logviewer")) {
updateLogviewerState(status);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please delete newly introduced newlines here at line 97 and at 125, 128, and 134 as well.

@@ -154,13 +160,34 @@ private void updateLogviewerState(TaskStatus status) {
}
}

private void checkRunningLogviewerState(String logviewerZKPath) {
private void ensureZNodeExists(String logviewerZKPath) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this is more for the Logviewer ZNode, can we rename it from ensureZNodeExists to ensureLogviewerZnodeExists?

.build();
taskStatuses.add(logviewerTaskStatus);
}
_timer.scheduleAtFixedRate(new TimerTask() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

align this with the rest of the code please

Choose a reason for hiding this comment

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

This is actually aligned with the rest of the code. The diff makes it seem like it isn't. I'm taking the timer thread out of the if (_enabledLogviewerSidecar) block and scheduling it unconditionally. See https://github.com/srikanth-viswanathan/mesos-storm/blob/66dcbbe502aa3438b2a1b107d146e25de058f82c/storm/src/main/storm/mesos/MesosNimbus.java#L291 for the full file.

// performing "explicit" reconciliation; master will respond with the latest state for all logviewer tasks
// in the framework scheduler's statusUpdate() method
List<TaskStatus> taskStatuses = new ArrayList<TaskStatus>();
List<String> logviewerPaths = _zkClient.getChildren(_logviewerZkDir);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this the line of code that is generating the log line that you mention as the visible side-effect of this change?

Choose a reason for hiding this comment

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

Correct. The more I think about this (and having seen the code run on our systems), I think this trace will be a nuisance, given how frequently the timer task runs (every 5 mins). I'm in favor of adding an explicit check to first test that the logviewer ZNode exists (without the error trace) before trying to get its children. Thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry for the incredibly slow response. I like this solution, please implement.

@srikanth-viswanathan
Copy link
Author

@JessicaLHartog Thanks for the review. I've pushed changes that address your comments.

P.S.: I had originally added spaces around lines of code to add visual separation for readability. I've since removed them after your comments, but I'm curious about the reason for your suggestion.

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.

None yet

3 participants