Skip to content

Redesign the access to meta version - #436

Merged
morningman merged 8 commits into
apache:masterfrom
morningman:meta_version
Dec 17, 2018
Merged

morningman merged 8 commits into
apache:masterfrom
morningman:meta_version

Conversation

@morningman

@morningman morningman commented Dec 16, 2018 •

Copy link
Copy Markdown
Contributor

Because the meta version is only be used in catalog saving and loading.
So currently this version is a field of Catalog class. And we can get this
version only by calling Catalog.getCurrentCatalogJournalVersion().

But in restore process, we need to read the meta data which is saved with
a specified meta version. So we need a flexible way to read a meta data
using a specified meta version, not only the version from Catalog.

So we create a new class called MetaContext. Currently it only has one field,
'journalVersion', to save the current journal version. And it is a
thread local variable, so that we can create a MetaContext anywhere we want,
and setting the 'journalVersion' which we want to use for reading meta.

Currently, there are 4 threads which is related to meta data saving and loading.

  1. The Frontend starting thread, which will call Catalog.initialize() to load the image.
  2. the Frontend state listener thread, which will listen the state changing, and call
    transferToMaster() or transferToNonMaster().
  3. Edit log replayed thread, which is created when calling transferToNonMaster().
    It will replay edit log
  4. Checkpoint thread, which is created when calling transferToMaster(). It will do
    the checkpoint periodically.

Notice that we get the 'current meta version' only when 'READING' the meta (not WRITING).
So we only need to take care of all 'READING' threads.
We create MetaContext thread local variable for these 4 threads, and thread 2,3,4's
meta context inherit from thread 1's meta context. Because thread 1 will load the origin
image file and get the very first meta version.

And we leave the Catalog.getCurrentCatalogJournalVersion()'s name unchanged, just
change its content, because we don't want change a lot codes this time.

On the other hand, we add the current meta version in backup job info file when doing
backup job. So that when restoring from a backup snapshot, we can know which meta
version we should use for read the meta.
And also , we add a new property "meta_version" for Restore stmt, so that we can specify
the meta version used for reading backup meta. It is for those old backup snapshots
which do not has meta version saving in backup job info file.

meta version(journal version) is currently a field of Catalog.
Each time we want to judge the meta version when we read the journal,
we call Catalog.getCurrentCatalogJournalVersion().

This is no flexible to get the meta version anywhere.
Currently, meta version can only be set and get in main Catalog thread
and checkpoint catalog thread. But for some cases, we want to decide
our own meta version when reading a journal, not the version got from
Catalog.

So we create a new class called MetaContext. Currently it only has a field
'journalVersion' to save the current journal version. And it has is a
thread local variable, so that we can create a MetaContext anywhere we want,
and setting the 'journalVersion' which we want to use for reading journal.
@morningman morningman changed the title Redesign meta version Redesign the access to meta version Dec 16, 2018
@morningman
morningman merged commit 45e42bd into apache:master Dec 17, 2018
morningman added a commit to morningman/doris that referenced this pull request Nov 18, 2026
### Background

ORC physical stripe readers reuse parsed immutable file metadata and lazy row prefixes. The SDK implementation has merged into the upstream orc branch.

### What problem does this PR solve?

Issue Number: None
Related PR: apache/doris-thirdparty#436 (merged SDK), apache#70664 (consumer)
PR Type: Release/Dependency

Problem Summary:

Replace the local SDK pin with its upstream squash-merge commit so the Doris dependency is available from the maintained branch.

### Details

- **Versions:** contrib/apache-orc 89c98c2 to upstream 00fa6d6.
- **Upstream changes:** Both commits have identical complete source trees; apache#436 combines parsed file-tail sharing with lazy prefix initialization.
- **Compatibility:** Source and test contents are unchanged. Native consumers build against the extended SDK interface already used by this branch.
- **Rollback:** Restore the prior pin if the dependency update must be reverted.

### Testing

Verified identical SDK tree hashes. The prior local ASAN build and 255 selected tests cover these exact SDK source bytes; they were not rerun for the hash-only pin update.

### Release note

None

### Check List (For Author)

- Behavior changed: No
- Does this need documentation: No
- Pre-submission status: Ready

### AI Disclosure

- Tool: Codex
- Generated: Dependency update and commit description
- Human review: not stated
morningman added a commit that referenced this pull request Nov 19, 2026
### Background

FE assigns external-file byte ranges to BE scanners. Native Parquet and
ORC readers select each range's row groups or stripes, whose physical
layout determines the safe unit of parallel work.

### What problem does this PR solve?

Issue Number: None
Related PR: #66802 (branch-4.2 source), #68143 (Iceberg missing-file
policy in split planning), apache/doris-thirdparty#435 (merged ORC
statistics sharing), apache/doris-thirdparty#436 (merged parsed-tail
sharing), apache/doris-thirdparty#437 (merged prefix-initialization
retry fix)
PR Type: Enhancement

Problem Summary:

This backport adds FE coarse ranges and BE row-group/stripe tasks for
eligible native scans, preserving runtime filters, source completion and
condition-cache publication. Eligible scans use dedicated FE/BE size
targets after upgrading.

Original author: @Gabriel39

### Details

- **Change map:** 2,555 production lines/50 files; 3,352 test lines/28
files; two submodule-pointer lines and two build-metadata lines. BE
covers scheduling, ownership and shared state; FE/SPI covers
synchronous, batch and streaming planning. Tests cover ported behavior
and engine/plugin boundaries.
- **Before and after:** FE previously used source-specific splitting.
Eligible Parquet/ORC scans use 512 MiB FE targets; BE coalesces physical
tasks toward 64 MiB. Delete-bearing Iceberg files, logical/JNI Paimon,
metadata COUNT and serial scans retain fallbacks. BE may refine without
an FE target; positive BE targets control coalescing.
- **Configs and defaults:** Add session variables
`file_split_size_on_fe=536870912` and `file_split_size_on_be=67108864`,
both forwarded and changeable through SET. Nonpositive values keep
legacy FE planning; they do not disable BE refinement.
- **Impact on existing users:** Eligible scans use dedicated targets
instead of `file_split_size` (still the fallback). Load keeps FE
boundaries. Optional Thrift field 17 matches 4.1/4.2; upgrade BE first
because older BE cannot recover coarse-range parallelism. Connector API
35.0 requires rebuilt plugins. Results and delete semantics are
preserved.

### Testing

The ASAN BE+FE build passed at `0430b14`. Later `feec288` adds six
comment lines, and the FEUT follow-up only updates existing Iceberg test
reflection signatures and arguments; non-comment production source is
unchanged.

- Latest local `run-fe-ut.sh`: 389 tests in 10 Iceberg manifest,
planning, range and statement-scope classes passed, with zero failures,
errors or skips. All 14 `IcebergManifestReadContextTest` cases pass
after adding the missing coarse split argument; the original
cancellation and shared-budget assertions remain unchanged.
- `run-be-ut.sh`: 482 tests in 10 suites passed, covering Fluss,
ORC/SDK, scanners and TableReader; zero failures, errors or skips. The
driver began at `0430b14` and covered identical non-comment source.
- Prior local `run-fe-ut.sh` at `feec288`: 448 tests in 75 classes
passed, including the complete 37-class SPI suite, both surface
baselines/API35 and engine planning/path-partition tests; zero failures,
errors or skips.
- A prior controlled restoration of repeated SDK setup failed counter
assertions at 9/72/72 tail parses/prefix entries/range visits for eight
children, versus 1/8/16 with the candidate, while row values matched.
Counts measure setup work.
- SDK #437: Linux x86_64 ASAN passed 516/516 tests plus 400 repeated
shared-tail case executions; the same cases fail before the fix. The
merged SDK tree is identical to that tested candidate. Full Linux Doris
BEUT has not been rerun.
- Full FEUT on the updated head, external cluster regression and RELEASE
timing benchmarks were not run.

### Notes for Reviewers

Three narrow `NOLINT` annotations cover `DORIS_CHECK`'s intentional
streaming-macro `else`; the assertions are unchanged.

API 35.0 extends master's existing 34.0 surface, preserving its
path-partition-key API alongside the split-planning additions. The
planning missing-file classifier follows normal Iceberg reads.

Children retain exact stripe-ID intervals and share parsed immutable
file tails and lazy row prefixes. Merged apache/doris-thirdparty#435
shares lazy Metadata and evaluates owned stripes; streams, metrics and
SARG appliers remain private. Metadata-only opens and no-SARG planning
remain lazy. `OrcFileTailParses`, `OrcStripeDirectoryEntries` and
`OrcRowReaderStripeVisits` track SDK tail/prefix/range setup.
`OrcStripeStatisticsParses` and `OrcStripeStatisticsEvaluations` expose
parse attempts and explicit selection work, excluding RowReader PPD.

The ORC pin moves from `5962bb0` to merged apache/doris-thirdparty#437
commit `d88650dcd09`, whose complete source tree equals the tested SDK
`0ddc8c1bc34`. The range includes parsed-tail sharing #436, shared
statistics #435, canonical seek fix #431 (the old pin already has
equivalent Reader.cc behavior), and Maven output ignore #434: eight
files, +702/-100 lines. The incremental #437 change is three files,
+61/-3: a C++ mutex keeps failed prefix construction retryable without
unwinding through `pthread_once`. Shared loaders publish only after
success.

Iceberg SDK offsets can override size targets. Small-range fixtures
disable coarse FE planning; the new regression compares parallel scans
with a single-scanner reference without handwritten output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants