Mercurial > stress-tester
changeset 1113:37d6e04592dc
PgSql bugfixes
author | Devel 2 |
---|---|
date | Thu, 21 May 2020 11:53:03 +0200 |
parents | 35118d7d6acf |
children | 776dcb7c749e |
files | stress-tester/src/main/java/com/passus/st/client/FlowProcessor.java stress-tester/src/main/java/com/passus/st/client/pgsql/PgSqlResponsePacketsDecoder.java stress-tester/src/main/java/com/passus/st/client/pgsql/filter/PgSqlFilter.java |
diffstat | 3 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/FlowProcessor.java Thu May 21 10:18:41 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/FlowProcessor.java Thu May 21 11:53:03 2020 +0200 @@ -4,6 +4,7 @@ import com.passus.data.DataDecoder; import com.passus.data.HeapByteBuff; import com.passus.filter.Filter; +import com.passus.st.PacketsBulk; import com.passus.st.emitter.ChannelContext; import com.passus.st.emitter.Emitter; import com.passus.st.emitter.EmitterHandler; @@ -11,8 +12,6 @@ import com.passus.st.filter.FlowFilterChain; import org.apache.logging.log4j.Logger; -import java.util.List; - import static com.passus.st.client.FlowContext.*; import static com.passus.st.client.FlowError.*; import static com.passus.st.client.FlowUtils.*; @@ -449,9 +448,12 @@ Object resp = decoder.getResult(); if (logger.isDebugEnabled()) { debug(logger, flowContext, "Response decoded. Response class " + resp.getClass().getSimpleName() + "."); - if (resp instanceof List) { - List respList = (List) resp; - debug(logger, flowContext, "Decoded " + respList.size() + " packets."); + if (resp instanceof PacketsBulk) { + PacketsBulk bulk = (PacketsBulk) resp; + debug(logger, flowContext, "Decoded " + bulk.packets.size() + " packets."); + if (trace) { + bulk.packets.forEach(p -> trace(logger, flowContext, "Bulk packet " + p + ".")); + } } }
--- a/stress-tester/src/main/java/com/passus/st/client/pgsql/PgSqlResponsePacketsDecoder.java Thu May 21 10:18:41 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/pgsql/PgSqlResponsePacketsDecoder.java Thu May 21 11:53:03 2020 +0200 @@ -6,7 +6,9 @@ import com.passus.net.FixedSizeLengthPduXHandler; import com.passus.net.PduX; import com.passus.net.mysql.MySqlDecoder; -import com.passus.net.pgsql.*; +import com.passus.net.pgsql.PgSqlDecoder; +import com.passus.net.pgsql.PgSqlMessage; +import com.passus.net.pgsql.PgSqlMessageType; import com.passus.st.PacketsBulk; import com.passus.st.client.mysql.MySqlResponsePacketsDecoder; import org.apache.commons.lang3.mutable.MutableInt; @@ -46,7 +48,8 @@ PgSqlMessage packet = decoder.getResult(); if (packet != null) { bulk.packets.add(packet); - if (packet.getType() == PgSqlMessageType.READY_FOR_QUERY) { + if (packet.getType() == PgSqlMessageType.READY_FOR_QUERY + || packet.getType() == PgSqlMessageType.AUTH_REQUEST) { state(STATE_FINISHED); } }
--- a/stress-tester/src/main/java/com/passus/st/client/pgsql/filter/PgSqlFilter.java Thu May 21 10:18:41 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/pgsql/filter/PgSqlFilter.java Thu May 21 11:53:03 2020 +0200 @@ -14,7 +14,7 @@ @Override public int filterInbound(Object req, Object resp, FlowContext context) { - if (resp instanceof PgSqlMessage) { + if (resp instanceof PgSqlMessage || (resp instanceof PacketsBulk && ((PacketsBulk) resp).protocol == PGSQL)) { return filterInbound(req, (PacketsBulk<PgSqlMessage>) resp, context); } return DUNNO;