Repository navigation
Entity kill purge filters - #1029
Closed
tonyjamesstark wants to merge 14 commits into
Closed
tonyjamesstark wants to merge 14 commits into
tonyjamesstark wants to merge 14 commits into
Conversation
co_entity has no world column, so /co purge r:#world deleted the kill rows in co_block but kept every co_entity row. Those blobs became orphans that no later purge removed. - SQLite: copy only the co_entity rows that a retained kill row still references. This also drops orphans left by earlier purges. - MySQL/DuckDB: delete the co_entity rows of the kill rows a world purge removes, before co_block is purged. MySQL uses a join so MariaDB and MySQL 5.7 do not run a dependent subquery. Global purges keep the cheaper time-based delete, which is equivalent. If MySQL stops between the two deletes, running the same purge again removes the remaining kill rows. Player kills use the kill action with type 0 and a user id in data, so they are never treated as co_entity references. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PdEuKbjcVoVinVQJq4te1f
On SQLite, /co purge r:#world i:<block> built the retain condition for world-scoped tables without checking the block restriction, so it purged co_container, co_chat and the other world-scoped tables in that world although a block restriction should leave them untouched. The entity_container/entity_interaction branch and the MySQL path already check it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PdEuKbjcVoVinVQJq4te1f
MySQL deletes in place, so co_entity rows orphaned by earlier world purges stay until something removes them. With #optimize, delete every co_entity row that no kill row references, through a temporary table of referenced ids (avoids an anti-join on the unindexed co_block.data), then let OPTIMIZE reclaim the space. Failures are reported like the table loop, so the entity_spawn link cleanup still runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PdEuKbjcVoVinVQJq4te1f
PurgeFilter now builds the purge condition for every table, and the SQLite copy, the SQLite recovery path and the MySQL/DuckDB delete all use it instead of three hand-built copies. Behavior is unchanged; the block restriction check that the previous commit added to the SQLite copy is part of the shared condition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PdEuKbjcVoVinVQJq4te1f
/co purge rejected entity types and actions, so mob farm kill logs could only be removed together with all other data. New arguments on SQLite, MySQL and DuckDB: - a:kill purges only entity kill rows. - i:<entity> purges kills of those entity types; it can be combined with block types. - e:<entity> keeps kills of those entity types while purging the rest. Each purged kill also removes its co_entity row. a:kill with block types, entity types in both i: and e:, e: with only block types in i:, non-entity exclusions and entity filters on ClickHouse are rejected. Any a: value other than a kill alias is rejected instead of falling through to an unrestricted purge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PdEuKbjcVoVinVQJq4te1f
Contributor
|
The selective kill-purge feature makes sense, but please fix empty exclusion handling before merge. /co purge t:30d e: currently passes validation, produces empty exclusion collections, and proceeds as an unrestricted age-based purge. exclude:, e:,, and e:,,, have the same issue. Please reject an explicitly supplied exclusion argument that contains no valid entity values before starting the purge, while preserving valid space-separated continuation syntax. An incomplete exclusion must never silently become “no exclusions.” |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The #optimize orphan sweep snapshots the co_entity ids that kill rows reference, then deletes every row missing from the snapshot. Another installation sharing the database could commit a kill between the two statements and lose its entity data. The sweep now only deletes rows inside the purge time range. A kill always writes its co_entity row with the current time, and a purge range ends at least 24 hours ago, so a concurrent kill never matches. A world purge deletes the entity data of the purged kills and then the kill rows. On MySQL a failure or cancellation between the two left kept kill rows without their rollback data. Both deletes now run in one transaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A SQLite purge dropped every co_entity row no kill referenced, including rows newer than the purge range, and counted them as deleted. It now only removes unreferenced rows inside the range, like the MySQL #optimize sweep. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/co purge t:30d e: passed validation, parsed to no exclusions, and ran as an unrestricted time purge. e:, and e:,,, did the same, as did an e: at the end of the command and an empty i:. The argument check now follows each include or exclude list across its continuation tokens and rejects a list that ends without a value. Space-separated lists such as e:zombie, villager still work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bukkit resolves a legacy name such as zombie_pigman to the renamed type, so the filter only matched the id of the new name. e:zombie_pigman then purged the old kills it was meant to keep, and i:zombie_pigman missed them. The filter now covers every entity map id that resolves to the type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An include or exclude list that ended with a comma took the next token as a list value whatever it was. The radius, world and action parsers still read that token, so /co purge t:30d e:zombie, a:foo skipped the kill-only action check and ran without an action restriction, and any unknown key after a trailing comma skipped the unsupported argument check. A list now continues only with plain or minecraft: namespaced values; any other key ends the list and is checked as an argument. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LFQuzYmYun57wJi2a5mqkM
Contributor
|
Accepted, but merge conflicts must be resolved. |
…-filters # Conflicts: # docs/commands.md # lang/en.yml # src/main/java/net/coreprotect/command/PurgeCommand.java # src/main/java/net/coreprotect/database/PurgeFilter.java # src/main/java/net/coreprotect/language/Language.java
Contributor
|
These changes were included in #1030. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR depends on PRs 1 and 2 and contains their commits. Merge it after them.
PurgeFilterbuilds the purge condition for every table. The SQLite copy, the SQLite recovery path and the MySQL/DuckDB delete all use it, in place of three hand-built copies.a:killpurges only entity kills.i:<entity>purges kills of those entity types, and it can be combined with block types.e:<entity>keeps kills of those types while the rest is purged.a:killwith block types, entity types in bothi:ande:,e:with only block types, non-entity exclusions, and any entity filter on ClickHouse. Anya:value other than a kill alias is also rejected, so it can never fall through to an unrestricted purge.lang/en.ymlanddocs/commands.mdare updated.