Skip to content

Commit 491a029

Browse files
committed
Merge remote-tracking branch 'origin/jh_experiment_new_ilp' into jh_experiment_new_ilp
2 parents 8fb0553 + 6452bd3 commit 491a029

14 files changed

Lines changed: 477 additions & 230 deletions

File tree

core/pom.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<maven.javadoc.skip>false</maven.javadoc.skip>
3333
<outputPath>target</outputPath>
3434
<runtime.assembly>none</runtime.assembly>
35-
<javac.target>17</javac.target>
35+
<javac.target>11</javac.target>
3636
<argLine>-ea -Dfile.encoding=UTF-8 -XX:+UseParallelGC</argLine>
3737
<test.exclude>None</test.exclude>
3838
<test.include>%regex[.*[^o].class]</test.include><!-- exclude module-info.class-->
@@ -198,7 +198,7 @@
198198
</executions>
199199
<configuration>
200200
<doclint>none</doclint>
201-
<source>17</source>
201+
<source>11</source>
202202
<detectJavaApiLink>false</detectJavaApiLink>
203203
<additionalJOptions>
204204
<additionalJOption>${compilerArg1}</additionalJOption>
@@ -296,7 +296,7 @@
296296
</executions>
297297
<configuration>
298298
<doclint>none</doclint>
299-
<source>17</source>
299+
<source>11</source>
300300
<detectJavaApiLink>false</detectJavaApiLink>
301301
<additionalJOptions>
302302
<additionalJOption>${compilerArg1}</additionalJOption>
@@ -384,20 +384,20 @@
384384
</build>
385385
</profile>
386386
<profile>
387-
<id>java17+</id>
387+
<id>java11+</id>
388388
<properties>
389-
<jdk.version>17</jdk.version>
390-
<java.enforce.version>17</java.enforce.version>
389+
<jdk.version>11</jdk.version>
390+
<java.enforce.version>11</java.enforce.version>
391391
<questdb.artifactid>questdb</questdb.artifactid>
392392
<compilerArg1>--add-exports</compilerArg1>
393393
<compilerArg2>java.base/jdk.internal.math=io.questdb.client</compilerArg2>
394-
<excludePattern1>nothing-to-exclude-dummy-value-include-all-java17plus</excludePattern1>
395-
<excludeTestPattern1>nothing-to-exclude-dummy-value-include-all-java17plus</excludeTestPattern1>
394+
<excludePattern1>nothing-to-exclude-dummy-value-include-all-java11plus</excludePattern1>
395+
<excludeTestPattern1>nothing-to-exclude-dummy-value-include-all-java11plus</excludeTestPattern1>
396396
<javac.compile.source>${javac.target}</javac.compile.source>
397397
<javac.compile.target>${javac.target}</javac.compile.target>
398398
</properties>
399399
<activation>
400-
<jdk>[17,)</jdk>
400+
<jdk>[11,)</jdk>
401401
</activation>
402402
<dependencies>
403403
<dependency>

core/src/main/java/io/questdb/client/Sender.java

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,23 @@ static LineSenderBuilder builder(CharSequence configurationString) {
150150
* @return Builder object to create a new Sender instance.
151151
*/
152152
static LineSenderBuilder builder(Transport transport) {
153-
int protocol = switch (transport) {
154-
case HTTP -> LineSenderBuilder.PROTOCOL_HTTP;
155-
case TCP -> LineSenderBuilder.PROTOCOL_TCP;
156-
case UDP -> LineSenderBuilder.PROTOCOL_UDP;
157-
case WEBSOCKET -> LineSenderBuilder.PROTOCOL_WEBSOCKET;
158-
};
153+
int protocol;
154+
switch (transport) {
155+
case HTTP:
156+
protocol = LineSenderBuilder.PROTOCOL_HTTP;
157+
break;
158+
case TCP:
159+
protocol = LineSenderBuilder.PROTOCOL_TCP;
160+
break;
161+
case UDP:
162+
protocol = LineSenderBuilder.PROTOCOL_UDP;
163+
break;
164+
case WEBSOCKET:
165+
protocol = LineSenderBuilder.PROTOCOL_WEBSOCKET;
166+
break;
167+
default:
168+
throw new IllegalArgumentException("unknown transport: " + transport);
169+
}
159170
return new LineSenderBuilder(protocol);
160171
}
161172

@@ -927,13 +938,19 @@ public Sender build() {
927938
channel = tlsChannel;
928939
}
929940
try {
930-
sender = switch (protocolVersion) {
931-
case PROTOCOL_VERSION_V1 -> new LineTcpSenderV1(channel, bufferCapacity, maxNameLength);
932-
case PROTOCOL_VERSION_V2 -> new LineTcpSenderV2(channel, bufferCapacity, maxNameLength);
933-
case PROTOCOL_VERSION_V3 -> new LineTcpSenderV3(channel, bufferCapacity, maxNameLength);
934-
default ->
935-
throw new LineSenderException("unknown protocol version [version=").put(protocolVersion).put("]");
936-
};
941+
switch (protocolVersion) {
942+
case PROTOCOL_VERSION_V1:
943+
sender = new LineTcpSenderV1(channel, bufferCapacity, maxNameLength);
944+
break;
945+
case PROTOCOL_VERSION_V2:
946+
sender = new LineTcpSenderV2(channel, bufferCapacity, maxNameLength);
947+
break;
948+
case PROTOCOL_VERSION_V3:
949+
sender = new LineTcpSenderV3(channel, bufferCapacity, maxNameLength);
950+
break;
951+
default:
952+
throw new LineSenderException("unknown protocol version [version=").put(protocolVersion).put("]");
953+
}
937954
} catch (Throwable t) {
938955
channel.close();
939956
throw rethrow(t);
@@ -1541,14 +1558,24 @@ private LineSenderBuilder fromConfig(CharSequence configurationString) {
15411558
throw new LineSenderException("invalid configuration string: ").put(sink);
15421559
}
15431560
if (protocol != PARAMETER_NOT_SET_EXPLICITLY) {
1561+
String protocolName;
1562+
switch (protocol) {
1563+
case PROTOCOL_HTTP:
1564+
protocolName = "http";
1565+
break;
1566+
case PROTOCOL_UDP:
1567+
protocolName = "udp";
1568+
break;
1569+
case PROTOCOL_WEBSOCKET:
1570+
protocolName = "websocket";
1571+
break;
1572+
default:
1573+
protocolName = "tcp";
1574+
break;
1575+
}
15441576
throw new LineSenderException("protocol was already configured ")
15451577
.put("[protocol=")
1546-
.put(switch (protocol) {
1547-
case PROTOCOL_HTTP -> "http";
1548-
case PROTOCOL_UDP -> "udp";
1549-
case PROTOCOL_WEBSOCKET -> "websocket";
1550-
default -> "tcp";
1551-
}).put("]");
1578+
.put(protocolName).put("]");
15521579
}
15531580
if (Chars.equals("http", sink)) {
15541581
if (tlsEnabled) {

core/src/main/java/io/questdb/client/cutlass/http/client/WebSocketClientFactory.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,17 @@ public static WebSocketClient newInsecureTlsInstance() {
8686
* @return a new platform-specific WebSocket client
8787
*/
8888
public static WebSocketClient newInstance(HttpClientConfiguration configuration, SocketFactory socketFactory) {
89-
return switch (Os.type) {
90-
case Os.LINUX -> new WebSocketClientLinux(configuration, socketFactory);
91-
case Os.DARWIN, Os.FREEBSD -> new WebSocketClientOsx(configuration, socketFactory);
92-
case Os.WINDOWS -> new WebSocketClientWindows(configuration, socketFactory);
93-
default -> throw new UnsupportedOperationException("Unsupported platform: " + Os.type);
94-
};
89+
switch (Os.type) {
90+
case Os.LINUX:
91+
return new WebSocketClientLinux(configuration, socketFactory);
92+
case Os.DARWIN:
93+
case Os.FREEBSD:
94+
return new WebSocketClientOsx(configuration, socketFactory);
95+
case Os.WINDOWS:
96+
return new WebSocketClientWindows(configuration, socketFactory);
97+
default:
98+
throw new UnsupportedOperationException("Unsupported platform: " + Os.type);
99+
}
95100
}
96101

97102
/**

core/src/main/java/io/questdb/client/cutlass/qwp/client/InFlightWindow.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,11 @@ public void awaitEmpty() {
287287
}
288288
}
289289

290+
// The I/O thread may have called fail() and then acknowledgeUpTo()
291+
// before this thread was scheduled, draining the window while an
292+
// error is pending. Check one final time after the window is empty.
293+
checkError();
294+
290295
LOG.debug("Window empty, all batches ACKed");
291296
} finally {
292297
waitingForEmpty = null;

core/src/main/java/io/questdb/client/cutlass/qwp/client/MicrobatchBuffer.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,18 @@ public MicrobatchBuffer(int initialCapacity) {
118118
* Returns a human-readable name for the given state.
119119
*/
120120
public static String stateName(int state) {
121-
return switch (state) {
122-
case STATE_FILLING -> "FILLING";
123-
case STATE_SEALED -> "SEALED";
124-
case STATE_SENDING -> "SENDING";
125-
case STATE_RECYCLED -> "RECYCLED";
126-
default -> "UNKNOWN(" + state + ")";
127-
};
121+
switch (state) {
122+
case STATE_FILLING:
123+
return "FILLING";
124+
case STATE_SEALED:
125+
return "SEALED";
126+
case STATE_SENDING:
127+
return "SENDING";
128+
case STATE_RECYCLED:
129+
return "RECYCLED";
130+
default:
131+
return "UNKNOWN(" + state + ")";
132+
}
128133
}
129134

130135
/**

core/src/main/java/io/questdb/client/cutlass/qwp/client/QwpColumnWriter.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,13 @@ private void encodeColumn(
7373
case TYPE_CHAR:
7474
buffer.putBlockOfBytes(dataAddr, (long) valueCount * 2);
7575
break;
76-
case TYPE_INT, TYPE_FLOAT:
76+
case TYPE_INT:
77+
case TYPE_FLOAT:
7778
buffer.putBlockOfBytes(dataAddr, (long) valueCount * 4);
7879
break;
79-
case TYPE_LONG, TYPE_DATE, TYPE_DOUBLE:
80+
case TYPE_LONG:
81+
case TYPE_DATE:
82+
case TYPE_DOUBLE:
8083
buffer.putBlockOfBytes(dataAddr, (long) valueCount * 8);
8184
break;
8285
case TYPE_TIMESTAMP:

0 commit comments

Comments
 (0)