Skip to content

Commit 5bf4b0a

Browse files
authored
Revert "Hybrid Search: Adding fixes for schedulingStopWatch start/stop for a …" (#46585)
This reverts commit be82227.
1 parent be82227 commit 5bf4b0a

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

sdk/cosmos/azure-cosmos/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
* Fixed Null Pointer Exception for query when container recreated with same name. - [PR 45930](https://github.com/Azure/azure-sdk-for-java/pull/45930)
1313
* Fixed Null Pointer Exception for readMany when container recreated with same name. - [PR 45930](https://github.com/Azure/azure-sdk-for-java/pull/45930)
1414
* Fixed parameterized query failures for Hybrid Search queries. - [PR 46446](https://github.com/Azure/azure-sdk-for-java/pull/46446)
15-
* 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)
1615

1716
#### Other Changes
1817
* 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)

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/metrics/SchedulingStopwatch.java

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,28 @@ public SchedulingTimeSpan getElapsedTime() {
2626

2727
/**
2828
* Tells the SchedulingStopwatch know that the process is in a state where it is ready to be worked on,
29-
* which in turn starts the stopwatch for response time and turnaround time.
29+
* which in turn starts the stopwatch for for response time and turnaround time.
3030
*/
3131
public void ready() {
3232
startStopWatch(this.turnaroundTimeStopwatch);
3333
startStopWatch(this.responseTimeStopwatch);
3434
}
3535

3636
public void start() {
37-
synchronized (this.runTimeStopwatch) {
38-
if (this.runTimeStopwatch.isStarted()) {
39-
return;
40-
}
37+
if (!this.runTimeStopwatch.isStarted()) {
4138
if (!this.responded) {
4239
// This is the first time the process got a response, so the response time stopwatch needs to stop.
43-
stopStopWatch(this.responseTimeStopwatch);
40+
this.responseTimeStopwatch.stop();
4441
this.responded = true;
4542
}
4643
this.runTimeStopwatch.reset();
47-
this.runTimeStopwatch.start();
44+
startStopWatch(this.runTimeStopwatch);
4845
}
4946
}
5047

5148
public void stop() {
52-
synchronized (this.runTimeStopwatch) {
53-
if (!this.runTimeStopwatch.isStarted()) {
54-
return;
55-
}
56-
this.runTimeStopwatch.stop();
49+
if (this.runTimeStopwatch.isStarted()) {
50+
stopStopWatch(this.runTimeStopwatch);
5751
this.numPreemptions++;
5852
}
5953
}
@@ -65,18 +59,12 @@ public void terminate() {
6559

6660
private void startStopWatch(StopWatch stopwatch) {
6761
synchronized (stopwatch) {
68-
if (stopwatch.isStarted()) {
69-
return; // idempotent start
70-
}
7162
stopwatch.start();
7263
}
7364
}
7465

7566
private void stopStopWatch(StopWatch stopwatch) {
7667
synchronized (stopwatch) {
77-
if (!stopwatch.isStarted()) {
78-
return; // idempotent stop
79-
}
8068
stopwatch.stop();
8169
}
8270
}

0 commit comments

Comments
 (0)