Skip to content

MDEV-37187 hashicorp plugin: avoid expensive clock() in hot path#5296

Open
vaintroub wants to merge 1 commit into
10.11from
MDEV-37187
Open

MDEV-37187 hashicorp plugin: avoid expensive clock() in hot path#5296
vaintroub wants to merge 1 commit into
10.11from
MDEV-37187

Conversation

@vaintroub

Copy link
Copy Markdown
Member

The plugin used clock() only to timestamp cache entries and measure elapsed time against millisecond timeouts. As shown in MDEV-12345, clock() is prohibitively expensive, and we do not need per-thread or per-process CPU time here, only time differences.

Replace clock()/clock_t with the monotonic std::chrono::steady_clock. Timeouts are kept as std::chrono::milliseconds

The plugin used clock() only to timestamp cache entries and measure
elapsed time against millisecond timeouts. As shown in MDEV-12345,
clock() is prohibitively expensive, and we do not need per-thread or
per-process CPU time here, only time differences.

Replace clock()/clock_t with the monotonic std::chrono::steady_clock.
Timeouts are kept as std::chrono::milliseconds

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the HashiCorp Key Management plugin to use std::chrono::steady_clock instead of clock_t and clock() for tracking cache timeouts and timestamps, ensuring monotonic and accurate real-time measurements. I have no feedback to provide as there are no review comments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant