-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix] Replace cached time with system clock in MasterService debug logs #7902
Conversation
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Looks like some tests are failing? |
We should change OpenSearch/server/src/main/java/org/opensearch/cluster/service/ClusterApplierService.java Line 715 in aa21585
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would want us to double click on this to see if we really need this accuracy. Based on my understanding we are simply using this for debugging. What are the actionable items if these numbers stack around few seconds lets say.
server/src/main/java/org/opensearch/cluster/service/MasterService.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/opensearch/cluster/service/MasterServiceTests.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com>
Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com>
Gradle Check (Jenkins) Run Completed with:
|
@andrross want to take a look at the updated version? much appreciated |
Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com>
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-7902-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 73b7a85d0a41580870a392aac9d47192adefa37a
# Push it to GitHub
git push --set-upstream origin backport/backport-7902-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.x Then, create a pull request where the |
…gs (opensearch-project#7902) * Replace cached time with system clock in MasterService debug logs Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> * Supply System.nanaoTime via TimeSupplier Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> * Add absolute time fetch method in Threadpool Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> * Rename absoluteTimeInNanos to preciseRelativeTimeInNanos Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> --------- Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> (cherry picked from commit 73b7a85)
…gs (opensearch-project#7902) * Replace cached time with system clock in MasterService debug logs Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> * Supply System.nanaoTime via TimeSupplier Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> * Add absolute time fetch method in Threadpool Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> * Rename absoluteTimeInNanos to preciseRelativeTimeInNanos Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> --------- Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> (cherry picked from commit 73b7a85)
…gs (opensearch-project#7902) * Replace cached time with system clock in MasterService debug logs Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> * Supply System.nanaoTime via TimeSupplier Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> * Add absolute time fetch method in Threadpool Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> * Rename absoluteTimeInNanos to preciseRelativeTimeInNanos Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> --------- Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> (cherry picked from commit 73b7a85)
…gs (opensearch-project#7902) * Replace cached time with system clock in MasterService debug logs Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> * Supply System.nanaoTime via TimeSupplier Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> * Add absolute time fetch method in Threadpool Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> * Rename absoluteTimeInNanos to preciseRelativeTimeInNanos Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> --------- Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com>
…gs (opensearch-project#7902) * Replace cached time with system clock in MasterService debug logs Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> * Supply System.nanaoTime via TimeSupplier Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> * Add absolute time fetch method in Threadpool Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> * Rename absoluteTimeInNanos to preciseRelativeTimeInNanos Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> --------- Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com> Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Description
Cached Time gives imprecise duration in computing multiple computation time since it caches every 200ms and multiple operation in MasterService regarding cluster state creation, update, publish require time frames less than 200ms during debugging. So changing the computation time to consume
System.nanotime()
to get clock time instead of cached time. This is essential when debug logs are enabled - else this is not logged by default.Before:
After:
Related Issues
Resolves #7849
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.