You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2025/07/07 15:31:21 UTC
(asterixdb) branch master updated: [NO ISSUE][HYR][HTTP] Fix omitted access log on some netty responses
This is an automated email from the ASF dual-hosted git repository.
mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new 4c28936903 [NO ISSUE][HYR][HTTP] Fix omitted access log on some netty responses
4c28936903 is described below
commit 4c28936903de6a969fc3770a002e078a428bcde1
Author: Michael Blow <mi...@couchbase.com>
AuthorDate: Mon Jul 7 00:27:36 2025 -0400
[NO ISSUE][HYR][HTTP] Fix omitted access log on some netty responses
The CLFLogger had assumptions that if a DefaultFullHttpResponse was
not received, it would receive one or more DefaultHttpContent
instances followed by a LastHttpContent. In reality, Netty is free to
return a DefaultHttpContent that also implements LastHttpContent,
which causes the CLF log entry to never be emitted.
Ext-ref: MB-67407
Change-Id: I8aa6c6e8e61eb63a83dd259afbe30b08969128eb
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20027
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Michael Blow <mb...@apache.org>
Reviewed-by: Michael Blow <mb...@apache.org>
---
.../main/java/org/apache/hyracks/http/server/CLFLogger.java | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/CLFLogger.java b/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/CLFLogger.java
index a24ed9575b..6476ab9e3d 100644
--- a/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/CLFLogger.java
+++ b/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/CLFLogger.java
@@ -34,10 +34,8 @@ import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.DefaultHttpContent;
import io.netty.handler.codec.http.DefaultHttpResponse;
-import io.netty.handler.codec.http.HttpContent;
import io.netty.handler.codec.http.HttpHeaderNames;
import io.netty.handler.codec.http.HttpRequest;
-import io.netty.handler.codec.http.HttpResponse;
import io.netty.handler.codec.http.LastHttpContent;
//Based in part on LoggingHandler from Netty
@@ -99,18 +97,15 @@ public class CLFLogger extends ChannelDuplexHandler {
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
- if (msg instanceof DefaultHttpResponse) {
- HttpResponse resp = (DefaultHttpResponse) msg;
+ if (msg instanceof DefaultHttpResponse resp) {
statusCode = resp.status().code();
if (msg instanceof DefaultFullHttpResponse) {
- lastChunk = true;
respSize = resp.headers().getInt(HttpHeaderNames.CONTENT_LENGTH, 0);
}
- } else if (msg instanceof DefaultHttpContent) {
- HttpContent content = (DefaultHttpContent) msg;
-
+ } else if (msg instanceof DefaultHttpContent content) {
respSize += content.content().readableBytes();
- } else if (msg instanceof LastHttpContent) {
+ }
+ if (msg instanceof LastHttpContent) {
lastChunk = true;
}