Skip to content

fix: remove partition type cache causing concurrent map write panic - #627

Merged
zeroshade merged 2 commits into
apache:mainfrom
hamilton-earthscope:fix-concurrent-map-write
Nov 18, 2025
Merged

zeroshade merged 2 commits into
apache:mainfrom
hamilton-earthscope:fix-concurrent-map-write

Conversation

@hamilton-earthscope

Copy link
Copy Markdown
Contributor

In #622 , specifically commit 5eb2aba, I introduced a map to cache partition type info. However, during testing I did not account for the fact that this map could be written to in parallel by the fanout writer when there are more than 1 worker.

Introducing a mutex on the PartitionSpec struct to protect the cache writes would require changing all pass-by-value to pass-by-ref and this would touch a lot of code.

Instead, I just removed the cache. The other optimizations in #622 introduced after 5eb2aba obviate the need for this cache.

I am seeing no discrepancy in write throughput with go test -run=NONE -bench=BenchmarkPartitionedWriteThroughput -benchtime=5s -benchmem before/after this change: the difference in records written/sec is noise (sometimes ever-so-slightly higher, sometimes ever-so-slightly lower).

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. thanks!

@zeroshade
zeroshade merged commit fab2315 into apache:main Nov 18, 2025
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