Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 4.3.1 breaks findAll(PageRequest) in spring-cloud-gcp-data-datastore #1880

Closed
stjasink opened this issue May 19, 2023 · 3 comments
Closed

Comments

@stjasink
Copy link

stjasink commented May 19, 2023

Describe the bug

When using the findAll(Pageable) repository method in release 4.3.1, it throws an exception: com.google.datastore.v1.client.DatastoreException: Method google.datastore.v1.Datastore/RunAggregationQuery is unimplemented. Longer stack trace below.

Using release 4.3.0 works okay. Using findAll() with no parameters works okay too.

Sample

I have an example at https://github.com/stjasink/datastore-find-all-test

The example includes two tests, one with simple findAll() which works, and one that uses the PageRequest parameter and fails.

Stack trace

com.google.cloud.datastore.DatastoreException: Method google.datastore.v1.Datastore/RunAggregationQuery is unimplemented
	at app//com.google.cloud.datastore.spi.v1.HttpDatastoreRpc.translate(HttpDatastoreRpc.java:140)
	at app//com.google.cloud.datastore.spi.v1.HttpDatastoreRpc.translate(HttpDatastoreRpc.java:125)
	at app//com.google.cloud.datastore.spi.v1.HttpDatastoreRpc.runAggregationQuery(HttpDatastoreRpc.java:211)
	at app//com.google.cloud.datastore.RetryAndTraceDatastoreRpcDecorator.lambda$runAggregationQuery$0(RetryAndTraceDatastoreRpcDecorator.java:109)
	at app//com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:103)
	at app//com.google.cloud.RetryHelper.run(RetryHelper.java:76)
	at app//com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:50)
	at app//com.google.cloud.datastore.RetryAndTraceDatastoreRpcDecorator.invokeRpc(RetryAndTraceDatastoreRpcDecorator.java:115)
	at app//com.google.cloud.datastore.RetryAndTraceDatastoreRpcDecorator.runAggregationQuery(RetryAndTraceDatastoreRpcDecorator.java:108)
	at app//com.google.cloud.datastore.execution.AggregationQueryExecutor.execute(AggregationQueryExecutor.java:54)
	at app//com.google.cloud.datastore.DatastoreImpl.runAggregation(DatastoreImpl.java:201)
	at app//com.google.cloud.spring.data.datastore.core.DatastoreTemplate.count(DatastoreTemplate.java:264)
	at app//com.google.cloud.spring.data.datastore.repository.support.SimpleDatastoreRepository.lambda$findAll$1(SimpleDatastoreRepository.java:100)
	at app//com.google.cloud.spring.data.datastore.repository.support.SimpleDatastoreRepository.getOrComputeTotalCount(SimpleDatastoreRepository.java:248)
	at app//com.google.cloud.spring.data.datastore.repository.support.SimpleDatastoreRepository.findAll(SimpleDatastoreRepository.java:100)
	at java.base@17.0.5/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base@17.0.5/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base@17.0.5/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base@17.0.5/java.lang.reflect.Method.invoke(Method.java:568)
	at app//org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:288)
	at app//org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:136)
	at app//org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:120)
	at app//org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:516)
	at app//org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285)
	at app//org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:628)
	at app//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at app//org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:168)
	at app//org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:143)
	at app//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at app//org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
	at app//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at app//org.springframework.data.repository.core.support.MethodInvocationValidator.invoke(MethodInvocationValidator.java:94)
	at app//org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at app//org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223)
	at app/jdk.proxy3/jdk.proxy3.$Proxy84.findAll(Unknown Source)
	at app//com.tjasink.datastorefindalltest.BookRepositoryTest.find all books with pages and sorting(BookRepositoryTest.kt:45)
@stjasink stjasink changed the title Release 4.3.1 breaks findAll(Pageable) in spring-cloud-gcp-starter-data-datastore Release 4.3.1 breaks findAll(Pageable) in spring-cloud-gcp-data-datastore May 19, 2023
@stjasink stjasink changed the title Release 4.3.1 breaks findAll(Pageable) in spring-cloud-gcp-data-datastore Release 4.3.1 breaks findAll(PageRequest) in spring-cloud-gcp-data-datastore May 19, 2023
@meltsufin
Copy link
Member

Is this only an issue when using the Datastore Emulator? I've tested findAll(PageRequest) against the actual Datastore service and it worked for me.
cc: @kolea2

@meltsufin
Copy link
Member

Based on the stack trace, it looks like #1782 is the change that's causing this. It uses the count aggregation query, which is currently not supported by the Datastore Emulator.

@meltsufin meltsufin closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2023
@stjasink
Copy link
Author

@meltsufin I have just run it against actual Datastore and it does work, so it looks like it is indeed only failing on the emulator. Thanks for investigating.

I'll have to disable some of my tests until the emulator supports aggregations 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants