* feat: add an admin function that discards a datanode's pending WAL tails
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* fix: refuse a tail discard over an unconfirmed manifest update and address review
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* test: drop the integration test that repeats the admin function's region form
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* fix: refuse a tail discard while a tail replay's update is uncertain
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* build: pin greptime-proto to the branch that adds the pending tails truncate kind
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* test: record the region id case of the discard_pending_tails sqlness test
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* fix: track the uncertain replay update only without conditional publication and pin the truncate wire format
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* test: simplify the truncate wire test
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* test: cover the discard requests sent to regions and the metric data region
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* test(mito2): pin the WAL history a discard relies on after a crash
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* test(common-function): describe the mock pending tails discard
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* fix(operator): report discard failures per region and clarify pending tails docs
Log each failed region of a by-table pending tails discard with its region id
and the tails the other regions discarded, derive the unsupported message from
the truncate kind, drop the unused feature parameter, document that a discard
raises the flushed entry id to the tail bound, and test discarding a kept tail
after a replay commit with an uncertain result.
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* fix(operator): warn with the partial discard count and state the WAL history check precisely
Format request.rs, log the tails discarded by the regions that succeeded at
warn level when another region fails, state in the docs that an open checks WAL
history through the flushed entry id where the log store checks history and
that whoever adds a tail ensures it for every node that may lead the region,
and rename two tests after the outcomes they assert.
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* docs(mito2): note that accepting missing WAL history opens a region past a discarded bound
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* docs(mito2): rewrap the pending tails discard handler doc
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* refactor(store-api): discard pending WAL tails with a dedicated region request
Carry the discard as RegionRequest::DiscardPendingTails, decoded from the
DiscardPendingTailsRequest body, instead of a truncate kind. Mito handles it as
a worker control request, so the truncate path no longer special-cases it;
the Metric Engine forwards it to a physical region's data region; the
frontend builds it for a region or for every region of a table, sharing the
table lookup with the discard of unflushed data. The wire fixture now pins the
new request body.
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* refactor(metric-engine): give the pending tails discard its own error context
Report a failed discard as a pending tails discard rather than a truncate in
the Metric Engine, pin that Mito handles the discard as a worker control
request, state that physical_region_ids returns a logical table's physical
regions, and drop leftovers from the truncate kind in the tests.
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* build: pin greptime-proto to the dedicated pending tails discard request
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* build: pin greptime-proto to the merged pending tails discard request
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
---------
Signed-off-by: jeremyhi <fengjiachun@gmail.com>
* fix(mito): return from manual index builds only after the index is published
A manual build_index could report success while the index was missing:
the request was rejected or coalesced behind another build, the manifest
commit failed, the indexer dropped an error, or the region was staging.
Manual builds now wait for active builds of the same SST, keep their
waiters across coalescing and schema-change retries, are notified after
the worker applies the edit, and verify the files against the manifest
before returning.
The consistency check also honors inverted_index.ignore_column_ids and a
zero segment row count, so such SSTs are no longer rebuilt on every call.
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* test(mito): cover manual index build waiting for a schema-change retry
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* fix(mito): select manual index build files by the applied version
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* chore(mito): log why index builds are skipped or aborted
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* refactor(mito): split IndexBuildTask::index_build into phases
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* fix(mito): stop scheduling index builds when the region state changes
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* chore(mito): document region file id and silent aborts in index builds
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* fix(mito): log why a manual index build is incomplete
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* fix(mito): expose incomplete index builds and treat compacted files as done
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* test(mito): pin index build concurrency in the compaction test
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
---------
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* fix: align fulltext bloom tokens with matches_term and use them for LIKE
The bloom fulltext index stored tokens that did not follow
matches_term's word boundaries (`_`, ASCII next to Han, Han substrings),
so pruning dropped rows matches_term accepts.
Tokens and query probes now share the character classes of
matches_term, Han runs are indexed as bigrams, and LIKE patterns use the
same probes. The bloom blob is written under a new key; blobs from older
versions are no longer probed. Tantivy no longer serves matches_term.
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* chore: drop unused lazy_static from index and avoid typo-flagged test tokens
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* docs: link like_probes to tokenize instead of the downstream ScriptTokenizer
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* refactor: name probe extraction with verbs and document CharClass
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* feat: rebuild legacy fulltext bloom indexes and probe lower(col)
The manifest records the fulltext bloom version per column, so ADMIN
BUILD_INDEX now rebuilds SSTs whose bloom index predates the current
tokens, and ssts_index_meta shows the version.
Case-insensitive bloom indexes also store the tokens of the whole
lowercased text for rows where it can differ (U+0130, U+212A, sigma),
so matches_term(lower(col), ..) and lower(col) LIKE .. use the index.
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* test: cover legacy bloom index rewrite by compaction in the compat case
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* chore: log outdated fulltext bloom indexes in the consistency check
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* docs: explain the unrecorded fulltext bloom version
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
---------
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* test(sqlness): run environments concurrently with external backends
The runner forced both environment and instance parallelism to 1 whenever
etcd/PG/MySQL or an external Kafka was set up, so the standalone and
distributed environments ran one after the other.
Only distributed uses the kv backend, and the two environments use
different Kafka topic prefixes, so they can run at the same time. Keep one
instance per environment, since instances would share the metadata table
and Kafka topics. Runs with a runner-managed Kafka, an external server, a
test filter, or `-j 1` stay fully serial.
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* test(sqlness): drop redundant restarts and sleeps
- flow_rebuild: drop the R2 block, which repeats R1 from the same state,
and the restart in R5, whose result R1 already asserts.
- flow_advance_ttl, flow_view, ttl_instant: drop sleeps that no assertion
depends on.
- flow_basic, flow_null, flow_call_df_func: drop the bytes_log section
(covered by flow_insert), a duplicate state_size query, an unchecked
insert, and flushes that run with no new data.
- alter_table_options, skip_wal: share restarts between independent tables.
- session_skip_wal, copy_skip_wal: check every case after a single restart.
Tables copied or inserted with skip_wal = true first get a WAL row that is
truncated, so the check that truncated WAL entries are not replayed stays.
- region_statistics: wait once for the statistics of all three tables.
- build_index_table: fold its index_size checks into
build_index_table_restart, which runs the same fixture and waits.
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* test(sqlness): restore session_skip_wal and copy_skip_wal
Checking every case after a single restart dropped two state transitions
the original cases cover: recovering a region whose memtable only held
skipped rows, and writing to the recovered region before restarting again.
Restore the original cases.
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* test(sqlness): restore the one-restart check in flow_auto_sink_table
#5112 checked the auto-created sink before a restart and the flow and sink
after it. #5987 moved the restart in front of the first SHOW and added a
second one. Flow recovery only creates the sink when it is missing, so the
second restart recovers from the same persisted state as the first.
Restore the original before/after check with one restart.
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* test(sqlness): keep one instance per environment with external store addresses
Instances of the distributed environment share the etcd behind --store-addrs, so run one instance per environment when it is set, same as --setup-etcd.
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
* test(sqlness): restore the false-branch batch in flow_basic and assert it
The kept batch (20, 22) is all above the threshold. The second batch (10, 23) is the only input that hits the false branch of the CASE and makes the flow compute again. Restore it and check the result, which the original case never did.
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
---------
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>