I am running couchbase server 6.6.0 on the kubernetes operator helm chart 2.1.0; for a client application using version 3.0.5.931 of the dotnet SDK (Couchbase.Extensions.DependencyInjections). I am attempting to use a Map-Reduce view with this application code:
var totalPayments = bucket
.ViewQueryAsync<string,float>(
"client_group",
"client_group_payment_total",
options =>
{
options.Key(districtID + "_" + seasonID + "_" + groupID);
options.Reduce(true);
options.Group(true);
}).Result;
For a simple Map-Reduce summation:
"client_group_payment_total" : {
"map" : "function (doc, meta) {
if (doc.type == 'SeasonClient'
&& doc.countryCode
&& doc.districtID
&& doc.seasonID
&& doc.groupID) {
emit([doc.districtID,'_',doc.seasonID,'_',doc.groupID].join(''), parseFloat(doc.totalRepayment));
}
}",
reduce: "_sum"
}
This code works properly against a test windows installation (single couchbase node 6.6.0 with index, query and data services), but when attempting to run it against a full kubernetes cluster I get this error:
dbug: Couchbase.Core.ClusterContext[0]
Could not lookup node for service Views.
dbug: Couchbase.Core.ClusterContext[0]
Using node owned by rostercache using revision 65.21.5.189:32362
dbug: Couchbase.Core.ClusterContext[0]
Using node owned by rostercache using revision 95.217.177.223:30138
dbug: Couchbase.Core.ClusterContext[0]
Using node owned by rostercache using revision 95.217.209.179:11210
dbug: Couchbase.Core.ClusterContext[0]
Using node owned by rostercache using revision 65.21.5.189:11210
dbug: Couchbase.Core.ClusterContext[0]
Using node owned by rostercache using revision 95.217.177.223:11210
dbug: Couchbase.Core.ClusterContext[0]
Using node owned by (null) using revision 65.21.5.189:32362
dbug: Couchbase.Core.ClusterContext[0]
Using node owned by (null) using revision 95.217.177.223:30138
dbug: Couchbase.Core.ClusterContext[0]
Using node owned by (null) using revision 95.217.209.179:11210
dbug: Couchbase.Core.ClusterContext[0]
Using node owned by (null) using revision 65.21.5.189:11210
dbug: Couchbase.Core.ClusterContext[0]
Using node owned by (null) using revision 95.217.177.223:11210
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2]
Executed action DumaCacheInteractionAPI.Controllers.ReferenceDataReadController.GetSpecificGroupAsync (DumaCacheInteractionAPI) in 777.4637ms
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint 'DumaCacheInteractionAPI.Controllers.ReferenceDataReadController.GetSpecificGroupAsync (DumaCacheInteractionAPI)'
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HM8QOH97RDE0", Request id "0HM8QOH97RDE0:00000002": An unhandled exception was thrown by the application.
System.AggregateException: One or more errors occurred. (Service views not available.)
---> Couchbase.ServiceNotAvailableException: Service views not available.
at Couchbase.Core.ClusterContext.GetRandomNodeForService(ServiceType service, String bucketName)
at Couchbase.CouchbaseBucket.GetViewUri()
at Couchbase.CouchbaseBucket.ViewQueryAsync[TKey,TValue](String designDocument, String viewName, ViewOptions options)
-----------------------Context Info---------------------------
null
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at DumaCacheInteractionAPI.Controllers.ReferenceDataReadController.GetSpecificGroupAsync(String countryCode, Int32 regionID, Int32 districtID, Int32 sectorID, Int32 siteID, Int32 seasonID, Int32 groupID, Int32 calculateTotals, Int32 limit, Int32 offset)
at lambda_method5(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
I currently use multi-dimensional scaling in helm (for the test cluster, 2 data nodes, 2 index nodes and 1 query node). The client application is running within the same kubernetes cluster as couchbase, I attempted to use the “ExposedFeature” settings but these didn’t make a difference:
networking:
exposedFeatures:
- client
- xdcr
exposedFeatureServiceTemplate:
spec:
type: NodePort
From looking through the dotnet sdk source code, I see a lot of references to the “view service”: couchbase-net-client/ClusterContext.cs at 2cf4ef0907be195d64bd19df1f6b0c6539e1f8a5 · couchbase/couchbase-net-client · GitHub
However, the “View Service” isn’t a service option in the helm chart; how do map-reduce views and the helm chart operator work together? Are these two features compatible?