Skip to content

Avoid copying measurements when updating last cache#18059

Merged
jt2594838 merged 2 commits into
apache:masterfrom
Caideyipi:avoid-last-cache-measurement-copy
Jun 30, 2026
Merged

Avoid copying measurements when updating last cache#18059
jt2594838 merged 2 commits into
apache:masterfrom
Caideyipi:avoid-last-cache-measurement-copy

Conversation

@Caideyipi

Copy link
Copy Markdown
Collaborator

Description

Avoid copying measurements on last cache write path

This PR avoids materializing a copied raw measurement array when InsertRow/InsertTablet nodes update last cache. Write nodes pass their existing measurements array to cache update APIs, and cache update resolves raw measurement names from measurement schemas by index.

Preserve alias and failed-column semantics

TableDeviceLastCache and tree schema cache now resolve schema raw names only when the original measurement slot is still valid, so failed measurements remain skipped. getRawMeasurements() keeps copy-on-write behavior for callers that still need a raw measurement array.

Tests

  • Added alias regression coverage for tree last cache update.
  • Added coverage for copy-on-write getRawMeasurements() behavior.

Validation:

  • mvn -Ddevelocity.off=true -DspotlessFiles=... -pl iotdb-core/datanode spotless:apply
  • git diff --check

mvn ... test-compile was attempted but the local workspace fails on existing generated Freemarker sources (IFill, Accumulator, ComparatorChain resolution), unrelated to this change.


This PR has:

  • been self-reviewed.
    • concurrent read
    • concurrent write
    • concurrent read and write
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods.
  • added or updated version, license, or notice information
  • added comments explaining the why and the intent of the code wherever would not be obvious
    for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage.
  • added integration tests.
  • been tested in a test IoTDB cluster.

Key changed/added classes (or packages if there are too many classes) in this PR
  • InsertNode, InsertRowNode, InsertTabletNode, RelationalInsertRowNode, RelationalInsertTabletNode
  • TableDeviceLastCache, TableDeviceSchemaCache, TableDeviceCacheEntry, TreeDeviceNormalSchema
  • TreeDeviceSchemaCacheManagerTest, InsertNodeIsMeasurementFailedTest

@jt2594838 jt2594838 merged commit aabf552 into apache:master Jun 30, 2026
45 of 48 checks passed
@jt2594838 jt2594838 deleted the avoid-last-cache-measurement-copy branch June 30, 2026 07:33
jt2594838 pushed a commit that referenced this pull request Jul 1, 2026
* Avoid copying measurements when updating last cache

* spotless

(cherry picked from commit aabf552)
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