Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
c2c7dc7
progress
nehrao1 Nov 24, 2024
6600a6b
add separate endpoint
nehrao1 Dec 1, 2024
0e6d796
start
nehrao1 Dec 2, 2024
0a06791
progress
nehrao1 Dec 3, 2024
ace2685
push progress
nehrao1 Dec 16, 2024
a570c83
Update ThinClientStoreModel.java
FabianMeiswinkel Dec 16, 2024
27318e5
Skeleton for ThinClientStoreModel and RNTBD serialization
FabianMeiswinkel Dec 17, 2024
63a1816
Merge pull request #1 from FabianMeiswinkel/users/fabianm/RntbdSerial…
nehrao1 Dec 18, 2024
4733a68
fix env var
nehrao1 Dec 19, 2024
2e0672d
Adding serialization skeleton in ThinClientStoreModel
jeet1995 Dec 21, 2024
33eded2
Merge pull request #2 from jeet1995/thinclientStoreModel
nehrao1 Dec 22, 2024
b2b9b8f
progress
nehrao1 Dec 26, 2024
2ee9484
pr comments
nehrao1 Jan 6, 2025
54c6777
cleanup
nehrao1 Jan 6, 2025
7b3f273
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
nehrao1 Jan 6, 2025
10f342a
changelog
nehrao1 Jan 6, 2025
2bb95f1
cleanup
nehrao1 Jan 6, 2025
e5dc25b
test
nehrao1 Jan 6, 2025
606a427
pr comments
nehrao1 Jan 10, 2025
4f0dba8
fix
nehrao1 Jan 13, 2025
7f2b881
merge main
nehrao1 Jan 13, 2025
f7ed838
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
nehrao1 Jan 13, 2025
1aa70bd
changelog
nehrao1 Jan 13, 2025
e414cd5
fix test
nehrao1 Jan 13, 2025
a6cbb07
Merge branch 'thinclientAPI' into thinclientEndpointDiscovery
nehrao1 Jan 13, 2025
c74405c
progress
nehrao1 Jan 15, 2025
da31f66
progress
nehrao1 Jan 16, 2025
513bd42
merge main
nehrao1 Jan 21, 2025
8c39fca
fix
nehrao1 Jan 21, 2025
b195862
test
nehrao1 Jan 21, 2025
0e561a9
progress
nehrao1 Jan 26, 2025
f589cd4
progress
nehrao1 Jan 27, 2025
a32bf7d
progress
nehrao1 Jan 27, 2025
90071c1
progress
nehrao1 Jan 29, 2025
5f0b5e0
progress
nehrao1 Jan 31, 2025
77e6b5e
progress
nehrao1 Jan 31, 2025
fd076fa
Adding ConsolidatedLocationEndpoints to encapsulate thin proxy locati…
jeet1995 Feb 1, 2025
bf2a3b9
Adding ConsolidatedLocationEndpoints to encapsulate thin proxy locati…
jeet1995 Feb 1, 2025
93a590a
Fixing unit tests.
jeet1995 Feb 1, 2025
2d3e83e
Fixing unit tests.
jeet1995 Feb 1, 2025
d3dd778
Fixing unit tests.
jeet1995 Feb 1, 2025
089a43a
Fixing unit tests.
jeet1995 Feb 1, 2025
1558260
Fixing unit tests.
jeet1995 Feb 1, 2025
a890f7a
Remove azure-cosmos dependency.
jeet1995 Feb 1, 2025
4aafa53
Fixing unit tests.
jeet1995 Feb 1, 2025
1472a5f
Fixing unit tests.
jeet1995 Feb 2, 2025
e6540a6
Fixing CI / live tests pipeline.
jeet1995 Feb 2, 2025
d43a3b8
Fixing CI / live tests pipeline.
jeet1995 Feb 2, 2025
b18feed
fixing rntbd request
nehrao1 Feb 5, 2025
ed53372
Merge pull request #3 from jeet1995/thinclientEndpointDiscoveryRefactor
nehrao1 Feb 6, 2025
9deb80b
progress
nehrao1 Feb 6, 2025
6959d2d
fix
nehrao1 Feb 6, 2025
52ca426
fix
nehrao1 Feb 7, 2025
1002537
fix
nehrao1 Feb 11, 2025
ce8ff80
Quick fix ordering rntbd tokens
FabianMeiswinkel Feb 11, 2025
4a456ae
Changing rntbd header order
FabianMeiswinkel Feb 11, 2025
81a8866
Hack to make the dotnet-benchmark a simple repro for test against loc…
FabianMeiswinkel Feb 11, 2025
ccca04a
Iterating on quick and dirty test
FabianMeiswinkel Feb 13, 2025
5d820ca
QuickAndDirty integration for Create/Read works now
FabianMeiswinkel Feb 14, 2025
d8f916b
Merge pull request #6 from FabianMeiswinkel/users/fabianm/rntbdOrdering
nehrao1 Feb 16, 2025
9318009
merge main
nehrao1 Mar 14, 2025
9dd5907
fix merge, remove unused imports, remove whitespace
nehrao1 Mar 14, 2025
b41558c
fixes to minimize diff
nehrao1 Mar 14, 2025
2f44f73
fix build issues
nehrao1 Mar 17, 2025
e773a1e
start adding thinclient endpoints
nehrao1 Mar 18, 2025
5def354
route requests to thin client store model
nehrao1 Mar 20, 2025
ef621a5
fix issue causing encoding failure
nehrao1 Mar 24, 2025
ea75b0d
working without hardcoding RNTBD tokens
nehrao1 Apr 1, 2025
9f85a01
cleanup
nehrao1 Apr 1, 2025
823aad9
get globalDatabaseAccountName from GlobalEndpointManager
nehrao1 Apr 1, 2025
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
Prev Previous commit
Next Next commit
progress
  • Loading branch information
nehrao1 committed Feb 6, 2025
commit 9deb80b6cbfcfd27d84c155ad07d551ddfc53baf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.azure.cosmos.implementation.directconnectivity.rntbd;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.testng.annotations.Test;

import java.util.EnumSet;
import java.util.Map;

import static com.azure.cosmos.implementation.directconnectivity.WFConstants.BackendHeaders.EFFECTIVE_PARTITION_KEY;

public class RntbdTokenStreamTests {
// Created this test for thin client testing
@Test(groups = { "unit" })
public void testThinClientSpecialCasing() {
RntbdContextRequest.Headers headers = new RntbdContextRequest.Headers(Unpooled.EMPTY_BUFFER);

RntbdTokenStream<RntbdConstants.RntbdRequestHeader> rntbdTokenStream =
new TestRntbdTokenStream(
RntbdConstants.RntbdRequestHeader.set,
RntbdConstants.RntbdRequestHeader.map,
Unpooled.EMPTY_BUFFER,
RntbdConstants.RntbdRequestHeader.class);

final ByteBuf out = Unpooled.buffer();
headers.encode(out);
}

final class TestRntbdTokenStream extends RntbdTokenStream<RntbdConstants.RntbdRequestHeader> {
TestRntbdTokenStream(EnumSet<RntbdConstants.RntbdRequestHeader> headers, Map<Short, RntbdConstants.RntbdRequestHeader> ids, ByteBuf in, Class<RntbdConstants.RntbdRequestHeader> classType) {
super(headers, ids, in, classType);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ public static class HttpHeaders {
// Priority Level for throttling
public static final String PRIORITY_LEVEL = "x-ms-cosmos-priority-level";

public static final String GLOBAL_DATABASE_ACCOUNT_NAME = "GlobalDatabaseAccountName";

// Thinclient headers
public static final String THINCLIENT_PROXY_OPERATION_TYPE = "x-ms-thinclient-proxy-operation-type";
public static final String THINCLIENT_PROXY_RESOURCE_TYPE = "x-ms-thinclient-proxy-resource-type";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ public enum RntbdRequestHeader implements RntbdHeader {
CorrelatedActivityId((short) 0x00B0, RntbdTokenType.Guid, false),
SDKSupportedCapabilities((short) 0x00A2, RntbdTokenType.ULong, false),
ChangeFeedWireFormatVersion((short) 0x00B2, RntbdTokenType.String, false),
PriorityLevel((short) 0x00BF, RntbdTokenType.Byte, false);
PriorityLevel((short) 0x00BF, RntbdTokenType.Byte, false),
GlobalDatabaseAccountName((short) 0x00CE, RntbdTokenType.Byte, false);

public static final Map<Short, RntbdRequestHeader> map;
public static final EnumSet<RntbdRequestHeader> set = EnumSet.allOf(RntbdRequestHeader.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public String toString() {
}
}

private static final class Headers extends RntbdTokenStream<RntbdContextRequestHeader> {
static final class Headers extends RntbdTokenStream<RntbdContextRequestHeader> {

private static final byte[] ClientVersion = Versions.CURRENT_VERSION.getBytes(StandardCharsets.UTF_8);

Expand All @@ -121,7 +121,7 @@ private static final class Headers extends RntbdTokenStream<RntbdContextRequestH
this.protocolVersion.setValue(CURRENT_PROTOCOL_VERSION);
}

private Headers(ByteBuf in) {
Headers(ByteBuf in) {

super(RntbdContextRequestHeader.set, RntbdContextRequestHeader.map, in, RntbdContextRequestHeader.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ final class RntbdRequestHeaders extends RntbdTokenStream<RntbdRequestHeader> {
final Map<String, String> headers = request.getHeaders();

// Special-case headers

this.addAimHeader(headers);
this.addAllowScanOnQuery(headers);
this.addBinaryIdIfPresent(headers);
Expand Down Expand Up @@ -124,6 +123,7 @@ final class RntbdRequestHeaders extends RntbdTokenStream<RntbdRequestHeader> {
this.addSDKSupportedCapabilities(headers);
this.addChangeFeedWireFormatVersion(headers);
this.addPriorityLevel(headers);
this.addGlobalDatabaseAccountName(headers);

// Normal headers (Strings, Ints, Longs, etc.)

Expand Down Expand Up @@ -283,6 +283,8 @@ private RntbdToken getCorrelatedActivityId() {

private RntbdToken getPriorityLevel() { return this.get(RntbdRequestHeader.PriorityLevel); }

private RntbdToken getGlobalDatabaseAccountName() { return this.get(RntbdRequestHeader.GlobalDatabaseAccountName); }

private RntbdToken getDatabaseName() {
return this.get(RntbdRequestHeader.DatabaseName);
}
Expand Down Expand Up @@ -776,6 +778,15 @@ private void addPriorityLevel(final Map<String, String> headers)
}
}

private void addGlobalDatabaseAccountName(final Map<String, String> headers)
{
final String value = headers.get(HttpHeaders.GLOBAL_DATABASE_ACCOUNT_NAME);

if (StringUtils.isNotEmpty(value)) {
this.getGlobalDatabaseAccountName().setValue(value);
}
}

private void addDateHeader(final Map<String, String> headers) {

// Since the HTTP date header is overridden by some proxies/http client libraries, we support an additional date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import java.util.EnumSet;
import java.util.Map;

import static com.azure.cosmos.implementation.HttpConstants.HttpHeaders.GLOBAL_DATABASE_ACCOUNT_NAME;
import static com.azure.cosmos.implementation.directconnectivity.WFConstants.BackendHeaders.EFFECTIVE_PARTITION_KEY;
import static com.azure.cosmos.implementation.directconnectivity.rntbd.RntbdConstants.RntbdHeader;
import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull;
import static com.azure.cosmos.implementation.guava27.Strings.lenientFormat;
Expand All @@ -28,7 +30,7 @@ abstract class RntbdTokenStream<T extends Enum<T> & RntbdHeader> implements Refe
checkNotNull(ids, "expected non-null ids");
checkNotNull(in, "expected non-null in");

this.tokens = new EnumMap<T, RntbdToken>(classType);
this.tokens = new EnumMap<>(classType);
headers.stream().forEach(h -> tokens.put(h, RntbdToken.create(h)));
this.headers = ids;
this.in = in;
Expand Down Expand Up @@ -89,6 +91,16 @@ static <T extends RntbdTokenStream<?>> T decode(final T stream) {
}

final void encode(final ByteBuf out) {
// TODO: special casing for thin client. need to revisit perf implications.
if (this.tokens.containsKey(EFFECTIVE_PARTITION_KEY)) {
this.tokens.get(EFFECTIVE_PARTITION_KEY).encode(out);
this.tokens.remove(EFFECTIVE_PARTITION_KEY);
}
if (this.tokens.containsKey(GLOBAL_DATABASE_ACCOUNT_NAME)) {
this.tokens.get(GLOBAL_DATABASE_ACCOUNT_NAME).encode(out);
this.tokens.remove(GLOBAL_DATABASE_ACCOUNT_NAME);
}

for (final RntbdToken token : this.tokens.values()) {
token.encode(out);
}
Expand Down