Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ ones are marked like "v1.0.0-fork".

## [Unreleased]

### Fixed

* **Japanese (MeCab) parsing produced no tokens on Windows**: both MeCab output
readers split their lines on `PHP_EOL`, but a subprocess's line terminator
comes from MeCab, not from the host PHP runs on. Wherever the two disagree —
notably Windows, where `PHP_EOL` is `"\r\n"` while the output ends lines with
`"\n"` — the entire output stayed a single line and every token collapsed into
one, yielding zero usable tokens. Both
`JapaneseTextParser::buildTokensFromMecab()` and
`MecabParser::parseMecabOutput()` now normalize line endings before splitting,
the same way `SqlFileParser` does since #241. This is what failed the Windows
PHPUnit jobs. Verified end-to-end against MeCab 0.996 and covered by tests
that assert LF, CRLF and CR-only output tokenize identically.

### Changed

* **Word-status model is now a single source of truth** (#238, Phase 1): the
Expand Down
21 changes: 21 additions & 0 deletions db/migrations/20260702_120000_drop_persistent_scratch_tables.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- Migration: Drop the persistent parse/import scratch tables.
--
-- temp_word_occurrences, temp_words and tempexprs used to be persistent,
-- globally-shared InnoDB tables that every parse/import TRUNCATEd and refilled.
-- That caused two problems:
-- * "Tablespace is missing for a table" (InnoDB error 194) crashes on
-- TRUNCATE when the table's .ibd file went missing (notably on Windows) —
-- every text import then failed. See issue #247.
-- * Concurrent parses/imports corrupted each other's rows (no isolation).
--
-- They are now created per database connection as CREATE TEMPORARY TABLE at
-- runtime (see src/Shared/Infrastructure/Database/ScratchTables.php), so the
-- persistent versions are no longer needed. Dropping them here also repairs
-- installs whose tablespace was already orphaned (the reported crash).
--
-- DROP TABLE IF EXISTS is idempotent and succeeds even when the tablespace is
-- missing, so it clears the orphaned dictionary entry as well.

DROP TABLE IF EXISTS temp_word_occurrences;
DROP TABLE IF EXISTS temp_words;
DROP TABLE IF EXISTS tempexprs;
23 changes: 6 additions & 17 deletions db/schema/baseline.sql
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,12 @@ CREATE TABLE IF NOT EXISTS word_occurrences (
)
ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS temp_word_occurrences (
TiCount smallint(5) unsigned NOT NULL,
TiSeID mediumint(8) unsigned NOT NULL,
TiOrder smallint(5) unsigned NOT NULL,
TiWordCount tinyint(3) unsigned NOT NULL,
TiText varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS temp_words (
WoText varchar(250) DEFAULT NULL,
WoTextLC varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
WoTranslation varchar(500) NOT NULL DEFAULT '*',
WoRomanization varchar(100) DEFAULT NULL,
WoSentence varchar(1000) DEFAULT NULL,
WoTaglist varchar(255) DEFAULT NULL,
PRIMARY KEY(WoTextLC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- The parse/import scratch tables (temp_word_occurrences, temp_words, tempexprs)
-- are no longer persistent shared tables. They are created per database
-- connection as CREATE TEMPORARY TABLE at runtime (see
-- src/Shared/Infrastructure/Database/ScratchTables.php). This avoids InnoDB
-- "Tablespace is missing" (error 194) crashes on TRUNCATE and isolates
-- concurrent parses/imports from each other. See issue #247.

CREATE TABLE IF NOT EXISTS texts (
TxID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
Expand Down
Loading