From 38b6d87220291c340894f67026eab5aeb871d36c Mon Sep 17 00:00:00 2001 From: Intelli Date: Sun, 18 Oct 2026 12:29:06 -0600 Subject: [PATCH] Fix DuckDB lookup memory usage and failure recovery --- .../net/coreprotect/database/LookupRaw.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/coreprotect/database/LookupRaw.java b/src/main/java/net/coreprotect/database/LookupRaw.java index 17efef06..92908bf1 100644 --- a/src/main/java/net/coreprotect/database/LookupRaw.java +++ b/src/main/java/net/coreprotect/database/LookupRaw.java @@ -42,7 +42,6 @@ import net.coreprotect.model.lookup.LookupRollbackState; import net.coreprotect.model.rollback.SignRollbackChange; import net.coreprotect.utility.EntitySpawnTracking; import net.coreprotect.utility.EntityUtils; -import net.coreprotect.utility.ErrorReporter; import net.coreprotect.utility.DatabaseUtils; import net.coreprotect.utility.MaterialUtils; import net.coreprotect.utility.WorldUtils; @@ -150,7 +149,7 @@ public class LookupRaw extends Queue { return new RawLookupPage(totalRows, rows, nextCursor); } catch (Exception exception) { - ErrorReporter.report(exception); + Database.reportDatabaseFailure(exception); return new RawLookupPage(knownTotalRows > 0L ? knownTotalRows : 0L, Collections.emptyList(), null); } finally { @@ -381,7 +380,7 @@ public class LookupRaw extends Queue { } } catch (Exception e) { - ErrorReporter.report(e); + Database.reportDatabaseFailure(e); return null; } finally { @@ -390,7 +389,7 @@ public class LookupRaw extends Queue { results.close(); } catch (Exception e) { - ErrorReporter.report(e); + Database.reportDatabaseFailure(e); } } if (paused) { @@ -1279,7 +1278,7 @@ public class LookupRaw extends Queue { } } catch (Exception e) { - ErrorReporter.report(e); + Database.reportDatabaseFailure(e); } return results; @@ -1565,11 +1564,12 @@ public class LookupRaw extends Queue { if (includePlaced && includeOther) { predicates.add("action=" + action); } - else if (includePlaced) { - predicates.add("(action=" + action + " AND type IN(" + placedEntityTypes + "))"); - } - else if (includeOther) { - predicates.add("(action=" + action + " AND type NOT IN(" + placedEntityTypes + "))"); + else if (includePlaced || includeOther) { + String negation = includePlaced ? "" : "NOT "; + String typePredicate = ConfigHandler.databaseType.isDuckDB() + ? negation + "list_contains([" + placedEntityTypes + "],type)" + : "type " + negation + "IN(" + placedEntityTypes + ")"; + predicates.add("(action=" + action + " AND " + typePredicate + ")"); } }