Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/cosmos/azure-cosmos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Fixed Null Pointer Exception for query when container recreated with same name. - [PR 45930](https://github.com/Azure/azure-sdk-for-java/pull/45930)
* Fixed Null Pointer Exception for readMany when container recreated with same name. - [PR 45930](https://github.com/Azure/azure-sdk-for-java/pull/45930)
* Fixed parameterized query failures for Hybrid Search queries. - [PR 46446](https://github.com/Azure/azure-sdk-for-java/pull/46446)
* Fixed a rare race in parallel Hybrid Search queries by making internal SchedulingStopwatch start/stop atomic and idempotent. - [PR 46485](https://github.com/Azure/azure-sdk-for-java/pull/46485)

#### Other Changes
* Added change to optimize lease checkpointing in `ChangeFeedProcessor` by conditionally executing checkpoint operations for 304 responses based on continuation token comparison, which helps to reduce RU consumption for unchanged feeds. See [PR 46521](https://github.com/Azure/azure-sdk-for-java/pull/46521)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,34 @@ public SchedulingTimeSpan getElapsedTime() {

/**
* Tells the SchedulingStopwatch know that the process is in a state where it is ready to be worked on,
* which in turn starts the stopwatch for for response time and turnaround time.
* which in turn starts the stopwatch for response time and turnaround time.
*/
public void ready() {
startStopWatch(this.turnaroundTimeStopwatch);
startStopWatch(this.responseTimeStopwatch);
}

public void start() {
if (!this.runTimeStopwatch.isStarted()) {
synchronized (this.runTimeStopwatch) {
if (this.runTimeStopwatch.isStarted()) {
return;
}
if (!this.responded) {
// This is the first time the process got a response, so the response time stopwatch needs to stop.
this.responseTimeStopwatch.stop();
stopStopWatch(this.responseTimeStopwatch);
this.responded = true;
}
this.runTimeStopwatch.reset();
startStopWatch(this.runTimeStopwatch);
this.runTimeStopwatch.start();
}
}

public void stop() {
if (this.runTimeStopwatch.isStarted()) {
stopStopWatch(this.runTimeStopwatch);
synchronized (this.runTimeStopwatch) {
if (!this.runTimeStopwatch.isStarted()) {
return;
}
this.runTimeStopwatch.stop();
this.numPreemptions++;
}
}
Expand All @@ -59,12 +65,18 @@ public void terminate() {

private void startStopWatch(StopWatch stopwatch) {
synchronized (stopwatch) {
if (stopwatch.isStarted()) {
return; // idempotent start
}
stopwatch.start();
}
}

private void stopStopWatch(StopWatch stopwatch) {
synchronized (stopwatch) {
if (!stopwatch.isStarted()) {
return; // idempotent stop
}
stopwatch.stop();
}
}
Expand Down