Skip to content

Commit

Permalink
make xds directory lazy to subscribe names
Browse files Browse the repository at this point in the history
  • Loading branch information
bohhyang committed Jan 31, 2025
1 parent b2da251 commit d22357a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ and what APIs have changed, if applicable.

## [Unreleased]

## [29.63.2] - 2025-01-31
- Make XdsDirectory lazy to subscribe the names

## [29.63.1] - 2025-01-14
- Add XdsDirectory to get d2 service and cluster names from INDIS

Expand Down Expand Up @@ -5764,7 +5767,8 @@ patch operations can re-use these classes for generating patch messages.

## [0.14.1]

[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.63.1...master
[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.63.2...master
[29.63.2]: https://github.com/linkedin/rest.li/compare/v29.63.1...v29.63.2
[29.63.1]: https://github.com/linkedin/rest.li/compare/v29.63.0...v29.63.1
[29.63.0]: https://github.com/linkedin/rest.li/compare/v29.62.1...v29.63.0
[29.62.1]: https://github.com/linkedin/rest.li/compare/v29.62.0...v29.62.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ public XdsDirectory(XdsClient xdsClient)

public void start() {
LOG.debug("Starting. Setting isUpdating to true");
_isUpdating.set(true); // initially set to true to block reads before the first update completes
addNameWatcher();
_isUpdating.set(true); // initially set to true to block reads before the first (lazy) update completes
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.testng.annotations.Test;

import static com.linkedin.d2.xds.TestXdsClientImpl.*;
import static java.lang.Thread.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

Expand All @@ -40,6 +41,7 @@ public void testGetClusterAndServiceNames() throws InterruptedException {
List<String> expectedClusterNames = Collections.singletonList(CLUSTER_NAME);
List<String> expectedServiceNames = Collections.singletonList(SERVICE_NAME);
fixture.runCallers(halfCallers, expectedClusterNames, expectedServiceNames);
sleep(50); // sleep just a bit so the caller threads can add watcher
XdsClient.WildcardD2ClusterOrServiceNameResourceWatcher watcher = Objects.requireNonNull(directory._watcher.get());

// verified names are not updated, results are empty, which means all threads are waiting.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=29.63.1
version=29.63.2
group=com.linkedin.pegasus
org.gradle.configureondemand=true
org.gradle.parallel=true
Expand Down

0 comments on commit d22357a

Please sign in to comment.