-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
HBASE-26160: Configurable disallowlist for live editing of loglevels #3549
HBASE-26160: Configurable disallowlist for live editing of loglevels #3549
Conversation
156fd05
to
7216ff2
Compare
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@@ -345,6 +347,12 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) | |||
out.println(MARKER | |||
+ "Log Class: <b>" + log.getClass().getName() +"</b><br />"); | |||
if (level != null) { | |||
if (!isLogLevelChangeAllowed(logName, readOnlyLogLevels)) { | |||
response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After Jetty 9.4.21, sendError() no longer allows a custom message.
You can use setStatus() instead. See https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/AuthenticationFilter.java#L622 for reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pointer. It looks like hbase uses a shaded version of netty, and further up in this class uses sendError
to send an error response. I could change this if I get another vote from an hbase committer, but I probably should change both in that case. Seems out of scope for this jira, but can do it if we think I should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jojochuang I looked more closely, and there are at least 6 servlets that use the current sendError
behavior, as well as a couple filters and a bunch of tests. It seems like we might want to leave this alone here and instead create a jira to update all usages so that they are future proof. Or we could fix those issues as part of a future "upgrade netty" jira.
Does that sound reasonable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup make sense to me. It seems HBase doesn't validate the error messages, which is why this problem doesn't surface up when we bumped Jetty version.
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@@ -345,6 +347,12 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) | |||
out.println(MARKER | |||
+ "Log Class: <b>" + log.getClass().getName() +"</b><br />"); | |||
if (level != null) { | |||
if (!isLogLevelChangeAllowed(logName, readOnlyLogLevels)) { | |||
response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup make sense to me. It seems HBase doesn't validate the error messages, which is why this problem doesn't surface up when we bumped Jetty version.
return true; | ||
} | ||
for (String readOnlyLogLevel : readOnlyLogLevels) { | ||
if (readOnlyLogLevel.startsWith(logger)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would have thought it's the other way around: logger. startsWith(readOnlyLogLevel)? not sure.
It would be best if we can verify this new feature in TestLogLevel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Fixed and added a test.
As you may have anticipated in your original comment about response code verification, this meant I needed to update LogLevel to use setStatus
as you said :). This meant having to validate the response in the CLI, which is used in in the test. These were minor tweaks, but you'll see them in the latest commit.
c881ee2
to
0401fad
Compare
💔 -1 overall
This message was automatically generated. |
@jojochuang let me know if this looks good with the latest commit. If so, I'll squash and clean up the commits for merging. I'd also like to get this merged into branch-2 and branch-2.4. The LogLevel changes apply cleanly, but TestLogLevel has a bunch of merge conflicts. I'll need to submit a PR which reconciles those once ready. I think the latest test failure is because I force pushed as the build was starting. Hopefully will succeed on re-run. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
0401fad
to
55451a8
Compare
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
@jojochuang not sure why my latest commit did not kick off a re-build. Would you mind kicking one off when you get a chance? |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
Looks like all checks are passing now. Thanks whoever fixed that :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. thx
55451a8
to
69aa2c0
Compare
@jojochuang thanks for the review! As promised, I've squashed the commits here and submitted #3558 and #3559 for porting to branch 2 and 2.4. Let me know if there's anything else I need to do to get these merged. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
No description provided.