Skip to content

[datafusion-cli] Replace mutex with AtomicU64 for stream duration tracking in instrumentedObjectStore#20802

Open
buraksenn wants to merge 3 commits intoapache:mainfrom
buraksenn:use-atomic-counter-instead-of-locks
Open

[datafusion-cli] Replace mutex with AtomicU64 for stream duration tracking in instrumentedObjectStore#20802
buraksenn wants to merge 3 commits intoapache:mainfrom
buraksenn:use-atomic-counter-instead-of-locks

Conversation

@buraksenn
Copy link
Contributor

Which issue does this PR close?

Related to #18138 but does not close any issue.

Rationale for this change

TimeToFirstItemStream held an Arc<Mutex<Vec>> and a request_index to write back the duration into the shared request list. I saw @alamb and @BlakeOrth's reviews on the PR #19127 about the improvements and wanted to change.

What changes are included in this PR?

  • Replace Arc<Mutex<Vec>> + index in TimeToFirstItemStream with a per-request Arc
  • Store duration as nanoseconds in AtomicU64 (0 = not yet set) with Release/Acquire ordering
  • Start the timer lazily on the first poll_next call instead of at stream creation, so only actual storage latency is measured

Are these changes tested?

Existing tests and I've also added time comparison

Are there any user-facing changes?

No

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.

1 participant