Skip to content

Commit 0428fd8

Browse files
committed
Clean up QWP recovery scaffolding
Remove the unused symbol-mirror append helper. Reuse shared wire parsing and deletion-assured temporary directory fixtures in recovery tests.
1 parent 8a1aaf0 commit 0428fd8

4 files changed

Lines changed: 331 additions & 404 deletions

File tree

core/src/main/java/io/questdb/client/cutlass/qwp/client/sf/cursor/CursorWebSocketSendLoop.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import io.questdb.client.std.CharSequenceLongHashMap;
4444
import io.questdb.client.std.MemoryTag;
4545
import io.questdb.client.std.QuietCloseable;
46-
import io.questdb.client.std.str.Utf8s;
4746
import io.questdb.client.std.Unsafe;
4847
import org.jetbrains.annotations.TestOnly;
4948
import org.slf4j.Logger;
@@ -2460,32 +2459,6 @@ private void accumulateSentDict(long payloadAddr, int payloadLen, int deltaStart
24602459
sentDictIndexedCount = sentDictCount;
24612460
}
24622461

2463-
/**
2464-
* Appends one symbol to the sent-dictionary mirror in wire form
2465-
* ({@code [len varint][utf8]}), advancing {@code sentDictCount}. Seeds the mirror at
2466-
* construction; {@link #accumulateSentDict} extends it from live frames thereafter.
2467-
*/
2468-
private void appendSymbolToMirror(CharSequence symbol) {
2469-
if (forceMirrorSeedFailureForTest) {
2470-
// Simulate a native realloc OOM on the seed path (see the field).
2471-
throw new LineSenderException("simulated mirror seed allocation failure (test only)");
2472-
}
2473-
int utf8Len = Utf8s.utf8Bytes(symbol);
2474-
int wireLen = NativeBufferWriter.varintSize(utf8Len) + utf8Len;
2475-
ensureSentDictCapacity((long) sentDictBytesLen + wireLen);
2476-
ensureSentDictEntryEndsCapacity((long) sentDictCount + 1L);
2477-
long p = NativeBufferWriter.writeVarint(sentDictBytesAddr + sentDictBytesLen, utf8Len);
2478-
if (utf8Len > 0) {
2479-
Utf8s.strCpyUtf8(symbol, p, utf8Len);
2480-
}
2481-
sentDictBytesLen += wireLen;
2482-
Unsafe.getUnsafe().putInt(
2483-
sentDictEntryEndsAddr + (long) sentDictCount * Integer.BYTES,
2484-
sentDictBytesLen);
2485-
sentDictCount++;
2486-
sentDictIndexedCount = sentDictCount;
2487-
}
2488-
24892462
private void ensureSentDictCapacity(long required) {
24902463
if (sentDictBytesCapacity >= required) {
24912464
return;

core/src/test/java/io/questdb/client/test/cutlass/qwp/client/DeltaDictRecoveryTest.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@
3535
import io.questdb.client.test.cutlass.qwp.websocket.TestWebSocketServer;
3636
import io.questdb.client.test.tools.DelegatingFilesFacade;
3737
import io.questdb.client.test.tools.TestUtils;
38-
import org.junit.After;
3938
import org.junit.Assert;
4039
import org.junit.Before;
40+
import org.junit.Rule;
4141
import org.junit.Test;
42+
import org.junit.rules.TemporaryFolder;
4243

4344
import java.io.IOException;
4445
import java.nio.ByteBuffer;
@@ -71,17 +72,15 @@ public class DeltaDictRecoveryTest {
7172

7273
private static final int DISTINCT_SYMBOLS = 8;
7374
private static final int ROWS = 40;
75+
76+
@Rule
77+
public final TemporaryFolder temporaryFolder = TemporaryFolder.builder().assureDeletion().build();
78+
7479
private String sfDir;
7580

7681
@Before
7782
public void setUp() {
78-
sfDir = Paths.get(System.getProperty("java.io.tmpdir"),
79-
"qdb-delta-recov-" + System.nanoTime()).toString();
80-
}
81-
82-
@After
83-
public void tearDown() {
84-
TestUtils.removeTmpDirRec(sfDir);
83+
sfDir = temporaryFolder.getRoot().toPath().resolve("qdb-delta-recovery").toString();
8584
}
8685

8786
@Test

0 commit comments

Comments
 (0)