From b472274ce2d8029dd7fa67181b7473ce56277258 Mon Sep 17 00:00:00 2001 From: Mikhail Yevchenko Date: Sun, 5 Apr 2026 18:02:18 +0000 Subject: [PATCH] Fix: remove fallback LLM slop-crap --- .../fixtures/ChronicleMapFixture.java | 21 +++++----- .../benchmark/fixtures/IkvStoreFixture.java | 39 +++++-------------- 2 files changed, 18 insertions(+), 42 deletions(-) diff --git a/src/main/java/com/benchmark/fixtures/ChronicleMapFixture.java b/src/main/java/com/benchmark/fixtures/ChronicleMapFixture.java index d73a842..d1f8436 100644 --- a/src/main/java/com/benchmark/fixtures/ChronicleMapFixture.java +++ b/src/main/java/com/benchmark/fixtures/ChronicleMapFixture.java @@ -8,14 +8,11 @@ import net.openhft.chronicle.map.ChronicleMap; import net.openhft.chronicle.map.ChronicleMapBuilder; import java.io.IOException; -import java.util.HashMap; import java.util.List; -import java.util.Map; public class ChronicleMapFixture implements DataFixtures { private ChronicleMap usersById; - private Map fallbackUsersById; private Kryo kryo; @Override @@ -24,11 +21,9 @@ public class ChronicleMapFixture implements DataFixtures { kryo.setRegistrationRequired(false); kryo.register(User.class); - Map encodedUsers = new HashMap<>(users.size()); int maxValueSize = 1; for (User user : users) { byte[] encoded = serialize(user); - encodedUsers.put(user.getId(), encoded); maxValueSize = Math.max(maxValueSize, encoded.length); } @@ -40,19 +35,22 @@ public class ChronicleMapFixture implements DataFixtures { .averageValue(new byte[maxValueSize]) .create(); - for (Map.Entry entry : encodedUsers.entrySet()) { - usersById.put(entry.getKey(), entry.getValue()); + for (User user : users) { + usersById.put(user.getId(), serialize(user)); } - fallbackUsersById = null; - } catch (Throwable ignored) { + } catch (Throwable t) { usersById = null; - fallbackUsersById = encodedUsers; + throw new IllegalStateException( + "ChronicleMap initialization failed. Cause: " + + t.getClass().getSimpleName() + " - " + t.getMessage(), + t + ); } } @Override public User findById(long id) { - byte[] encoded = usersById != null ? usersById.get(id) : fallbackUsersById.get(id); + byte[] encoded = usersById.get(id); return encoded == null ? null : deserialize(encoded); } @@ -61,7 +59,6 @@ public class ChronicleMapFixture implements DataFixtures { if (usersById != null) { usersById.close(); } - fallbackUsersById = null; } private byte[] serialize(User user) { diff --git a/src/main/java/com/benchmark/fixtures/IkvStoreFixture.java b/src/main/java/com/benchmark/fixtures/IkvStoreFixture.java index f62865b..c8b05e1 100644 --- a/src/main/java/com/benchmark/fixtures/IkvStoreFixture.java +++ b/src/main/java/com/benchmark/fixtures/IkvStoreFixture.java @@ -4,17 +4,11 @@ import com.benchmark.model.User; import java.lang.reflect.Method; import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; public class IkvStoreFixture implements DataFixtures { - private static final AtomicBoolean FALLBACK_WARNING_PRINTED = new AtomicBoolean(false); - - private final InMemoryFixture fallback = new InMemoryFixture(); - private Object reader; private Object writer; - private boolean useFallback; @Override public void setup(List users) throws Exception { @@ -24,10 +18,10 @@ public class IkvStoreFixture implements DataFixtures { String mountDirectory = getenv("IKV_MOUNT_DIRECTORY"); if (accountId == null || accountPassKey == null || storeName == null || mountDirectory == null) { - useFallback = true; - fallback.setup(users); - printFallbackWarning("IKV fixture: required env vars missing (IKV_ACCOUNT_ID, IKV_ACCOUNT_PASSKEY, IKV_STORE_NAME, IKV_MOUNT_DIRECTORY). Using in-memory fallback."); - return; + throw new IllegalStateException( + "IKV fixture requires IKV_ACCOUNT_ID, IKV_ACCOUNT_PASSKEY, IKV_STORE_NAME, and IKV_MOUNT_DIRECTORY. " + + "Results are invalid without a real IKV backend." + ); } try { @@ -80,25 +74,21 @@ public class IkvStoreFixture implements DataFixtures { // IKV is eventually consistent for reads. Small delay before measurement starts. Thread.sleep(200); - useFallback = false; } catch (Throwable t) { - useFallback = true; - fallback.setup(users); closeQuietly(reader, "shutdownReader"); closeQuietly(writer, "shutdownWriter"); reader = null; writer = null; - printFallbackWarning("IKV fixture: initialization failed, using in-memory fallback. Cause: " - + t.getClass().getSimpleName() + " - " + t.getMessage()); + throw new IllegalStateException( + "IKV fixture initialization failed. Cause: " + + t.getClass().getSimpleName() + " - " + t.getMessage(), + t + ); } } @Override public User findById(long id) throws Exception { - if (useFallback) { - return fallback.findById(id); - } - String key = Long.toString(id); String name = (String) reader.getClass().getMethod("getStringValue", String.class, String.class) .invoke(reader, key, "name"); @@ -117,11 +107,6 @@ public class IkvStoreFixture implements DataFixtures { @Override public void teardown() throws Exception { - if (useFallback) { - fallback.teardown(); - return; - } - closeQuietly(reader, "shutdownReader"); closeQuietly(writer, "shutdownWriter"); reader = null; @@ -143,10 +128,4 @@ public class IkvStoreFixture implements DataFixtures { // Ignore cleanup issues for benchmark fixture shutdown. } } - - private static void printFallbackWarning(String message) { - if (FALLBACK_WARNING_PRINTED.compareAndSet(false, true)) { - System.out.println(message); - } - } }