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
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ const mockConnections: ConnectionInfo[] = [
instanceSize: 'M10',
clusterType: 'SHARDED',
clusterUniqueId: 'clusterUniqueId',
geoSharding: {
selfManagedSharding: false,
},
},
},
{
Expand All @@ -111,6 +114,26 @@ const mockConnections: ConnectionInfo[] = [
clusterUniqueId: 'clusterUniqueId',
},
},
{
id: 'dedicated-geo-sharded-self-managed',
connectionOptions: {
connectionString: 'mongodb://foo',
},
atlasMetadata: {
orgId: 'orgId',
projectId: 'projectId',
clusterName: 'clusterName',
regionalBaseUrl: 'https://example.com',
metricsId: 'metricsId',
metricsType: 'cluster',
instanceSize: 'M30',
clusterType: 'GEOSHARDED',
clusterUniqueId: 'clusterUniqueId',
geoSharding: {
selfManagedSharding: true,
},
},
},
];

function connectionInfoById(connectionId: string): ConnectionInfo {
Expand Down Expand Up @@ -195,5 +218,14 @@ describe('connectionSupports', function () {
)
).to.be.true;
});

it('should return false if the cluster type is geosharded but self managed', function () {
expect(
connectionSupports(
connectionInfoById('dedicated-geo-sharded-self-managed'),
'globalWrites'
)
).to.be.false;
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ function supportsGlobalWrites(connectionInfo: ConnectionInfo) {
return false;
}

return atlasMetadata.clusterType === 'GEOSHARDED';
return (
atlasMetadata.clusterType === 'GEOSHARDED' &&
!atlasMetadata.geoSharding?.selfManagedSharding
);
}

export function connectionSupports(
Expand Down
7 changes: 7 additions & 0 deletions packages/compass-web/src/connection-storage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ describe('buildConnectionInfoFromClusterDescription', function () {
dataProcessingRegion: {
regionalUrl: 'https://example.com',
},
geoSharding: {
selfManagedSharding: true,
},
replicationSpecList: [
{
regionConfigs: [
Expand Down Expand Up @@ -162,6 +165,10 @@ describe('buildConnectionInfoFromClusterDescription', function () {
instanceSize: expectedInstanceSize,
regionalBaseUrl: 'https://example.com',
clusterType: clusterDescription.clusterType,
geoSharding: {
selfManagedSharding:
clusterDescription.geoSharding?.selfManagedSharding,
},
});
});
}
Expand Down
6 changes: 6 additions & 0 deletions packages/compass-web/src/connection-storage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ type ClusterDescription = {
deploymentItemName: string;
replicationSpecList?: ReplicationSpec[];
isPaused?: boolean;
geoSharding?: {
selfManagedSharding?: boolean;
};
};

export type ClusterDescriptionWithDataProcessingRegion = ClusterDescription & {
Expand Down Expand Up @@ -205,6 +208,9 @@ export function buildConnectionInfoFromClusterDescription(
...getMetricsIdAndType(description, deploymentItem),
instanceSize: getInstanceSize(description),
clusterType: description.clusterType,
geoSharding: {
selfManagedSharding: description.geoSharding?.selfManagedSharding,
},
},
};
}
Expand Down
4 changes: 4 additions & 0 deletions packages/connection-info/src/connection-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export interface AtlasClusterMetadata {
* https://github.com/10gen/mms/blob/9e6bf2d81d4d85b5ac68a15bf471dcddc5922323/client/packages/types/nds/clusterDescription.ts#L12-L16
*/
clusterType: 'REPLICASET' | 'SHARDED' | 'GEOSHARDED';

geoSharding?: {
selfManagedSharding?: boolean;
};
}

export interface ConnectionInfo {
Expand Down
Loading