[Feature] Maintain primary-key full-text index archives on write and compaction
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
Línea de trabajo
Start with src/paimon/core/index/pk/bucketed_primary_key_index_maintainer.cpp and the level-planning code in src/paimon/core/index/pksorted/, after reviewing dependencies #400 and #408. Use the Java-aligned PkFullTextIndexFileTest, PkFullTextDataFileReaderTest, PkFullTextBucketIndexStateTest, and BucketedFullTextIndexMaintainerTest as behavioral references; done means archives are maintained through restore, commit, compaction, and abort, with the listed cross-language tests passing.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Search before asking
- I searched in the issues and found nothing similar.
Motivation
Sub-issue of #399 (step 5: primary-key full-text index, write side).
BucketedPrimaryKeyIndexMaintainer keeps only BTree definitions (src/paimon/core/index/pk/bucketed_primary_key_index_maintainer.cpp:128-132), and restore keeps only BTree payloads (IsPrimaryKeyBTreePayload). This has two effects:
- Paimon C++ writers never build primary-key full-text archives.
- When C++ compacts a table that already has Java-written archives, those archives are neither rebuilt nor retired. They keep pointing at data files that compaction has removed, and the new compacted files are not indexed.
Java model (apache/paimon#8649, apache/paimon#8651, apache/paimon#8672, apache/paimon#8992):
- One archive per level. Each (partition, bucket, non-zero data level) has exactly one immutable archive. It covers all eligible files of that level, sorted by file name.
- Eligible files. A file is eligible when
fileSource == COMPACT && level > 0(PrimaryKeyIndexSourcePolicy). - Row ids. An archive's row ids are the concatenated physical row positions of its source files, including rows deleted by deletion vectors and null rows.
PkFullTextIndexFilebuilds one archive:- index type
full-text; - every source has the same level > 0 and a positive row count;
- it calls
GlobalIndexSingleColumnWriter#write(text, sourceOffset + rowPos)for each row; finish()must return exactly one entry whose row count equals the total source row count.- The resulting
IndexFileMetahasGlobalIndexMeta(0, total - 1, fieldId, null, indexMeta, sourceMeta):indexMetais the flat JSON of the prefix-stripped options;sourceMetaisPrimaryKeyIndexSourceMeta(level, sourceFiles).
- The file is named
index-{uuid}-{N}under the index directory, or in the bucket directory whenindex-file-in-data-file-diris set.
- index type
PkFullTextDataFileReaderreads one text value per physical row, with no deletion-vector filtering.PkFullTextIndexBuilderbuilds an archive for one file or a list of files.PkFullTextBucketIndexState#fromActiveDataFilesclassifies payloads:- A payload is current only if its (level, ordered source files) exactly matches the level's eligible active files and its row counts match.
- A payload that fails this is stale. So is every payload of a level that has more than one match, and any payload whose metadata cannot be parsed.
- Level planning (
PrimaryKeyIndexLevels, shared with the sorted indexes) picks the lowest level whose payload is missing or out of date. A plan with no source files removes the payload. BucketedFullTextIndexMaintainer:- Restore: stale payloads are retired and emitted as deletions in the next commit.
prepareCommit(append, compact, waitCompaction):- Applies the data transition: removes
compactBeforefiles and adds eligiblecompactAfterfiles. - Finishes or starts a single background build.
- Atomically replaces the level's archive when the build is still valid (
canAccept); otherwise deletes the generated file. - Routes the result to the compact increment if there was a compact transition, and to the append increment otherwise.
- Rolls back and deletes generated files on failure. The returned commit carries an
aborthook.
- Applies the data transition: removes
- A failed build is not retried within the same call. The next
prepareCommitplans again.
- Wiring:
BucketedPrimaryKeyIndexMaintainer.Factorycreates the full-text maintainer for fixed-bucket writes and for postpone-bucket compaction (apache/paimon#8992).IndexFileHandler#pkFullTextIndex(partition, bucket)provides the index file.- Writers are not closed while a build is pending.
Solution
- Port the classes above.
- Reuse the existing C++
PrimaryKeyIndexSourceMeta,PrimaryKeyIndexSourcePolicyandPrimaryKeyIndexSourceFile. Extract the level planning currently embedded insrc/paimon/core/index/pksorted/so it can be shared. - Wire the full-text maintainer into
BucketedPrimaryKeyIndexMaintainer: restore,prepareCommit, abort, and merging the increments. Create it through thefull-textindexer from #400, using the options resolved in #408. - Add tests aligned with Java
PkFullTextIndexFileTest,PkFullTextDataFileReaderTest,PkFullTextBucketIndexStateTestandBucketedFullTextIndexMaintainerTest, plus:- C++ compaction of a table with Java-written primary-key full-text archives; stale archives are retired and new ones built;
- Java reading archives written by C++.
Anything else?
- Depends on #400 and #408.
- The realtime path still rejects primary-key global indexes (
src/paimon/core/utils/primary_key_table_utils.cpp:136-141). That is out of scope here.
Are you willing to submit a PR?
- I'm willing to submit a PR!
- Lenguaje dominante
- C++
- Estrellas
- 66
- Forks
- 33
- Merge medio
- 1 d 14 h
- PR fusionados (30 d)
- 57
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/paimon-cpp
-
[Feature] Warm up next data file in ConcatBatchReaderPosiblemente ocupada @SteNicholas la tomó hace 5 días. Abiertoenhancement
apache/paimon-cpp#419 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
apache/paimon-cpp#410 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
apache/paimon-cpp#408 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
apache/paimon-cpp#407 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
apache/paimon-cpp#406 ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/paimon-cpp
Issues similares
-
WiFiMulti::addAP rejects valid 32-byte SSIDsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. AbiertoStatus: Awaiting triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
espressif/arduino-esp32#12984 ·
Los mantenedores suelen responder en 1 día
-
torch_ops/logprob.cu does not compile with the serving container's nvcc (13.3.73); check_torch_ops.py cannot run as shippedPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 Menos de una hora Aptitud para principiantes 72/100
ashhart/TensorFold#535 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 Menos de una hora Aptitud para principiantes 78/100
sudoevolve/EUI-NEO#95 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día