jason810496 opened a new issue, #2141:
URL: https://github.com/apache/polaris/issues/2141

   ### Describe the bug
   
   POST `/api/catalog/v1/oauth/tokens HTTP/1.1` returns a 500 status code with 
the error: `ERROR: relation "polaris_schema.version" does not exist` when using 
a Kubernetes setup with Helm and Postgres as the backend.
   
   ### To Reproduce
   
   
   I setup Polaris on Kubernetes with the following script:
   
   ```bash 
   kubectl apply --namespace apache-polaris -f helm/apache-polaris/ci/fixtures/
   kubectl wait --namespace apache-polaris --for=condition=ready pod 
--selector=app.kubernetes.io/name=postgres --timeout=120s
   
   helm install apache-polaris ./helm/apache-polaris \
     --namespace apache-polaris \
     --set storage.secret.awsAccessKeyId=${AWS_ACCESS_KEY_ID} \
     --set storage.secret.awsSecretAccessKey=${AWS_SECRET_ACCESS_KEY} \
     --values helm/apache-polaris/ci/persistence-values.yaml
   ```
    
   then follow the 
[getting-started](https://polaris.apache.org/in-dev/unreleased/getting-started/using-polaris/)
 guide and try to setup the catalog
   
   ```bash
   export POLARIS_CLIENT_ID=polarisclient
   export POLARIS_CLIENT_SECRET=polarisclientsecret
   export POLARIS_DEFAULT_BASE_LOCATION=s3://lakehouse
   
   cd ~/polaris
   
   ./polaris \
     --client-id ${POLARIS_CLIENT_ID} \
     --client-secret ${POLARIS_CLIENT_SECRET} \
     catalogs \
     create \
     --storage-type s3 \
     --default-base-location ${POLARIS_DEFAULT_BASE_LOCATION} \
     --role-arn ${POLARIS_S3_ROLE_ARN} \
     lakehouse_catalog
   ```
   
   but result in the following error:
   ```
   ...
   Caused by: org.postgresql.util.PSQLException: ERROR: relation 
"polaris_schema.version" does not exist
   ...
   2025-07-20 16:47:02,918 INFO  [io.qua.htt.access-log] [,POLARIS] [,,,] 
(executor-thread-1) 127.0.0.1 - - [20/Jul/2025:16:47:02 +0000] "POST 
/api/catalog/v1/oauth/tokens HTTP/1.1" 500 99
   ```
   
   
   ### Actual Behavior
   
   _No response_
   
   ### Expected Behavior
   
   _No response_
   
   ### Additional context
   
   
   ## Full Traceback
   
   ```
   2025-07-20 16:47:02,917 ERROR [org.apa.pol.ser.exc.IcebergExceptionMapper] 
[,POLARIS] [,,,] (executor-thread-1) Unhandled exception returning 
INTERNAL_SERVER_ERROR: java.lang.IllegalStateException: Failed to retrieve 
schema version
           at 
org.apache.polaris.persistence.relational.jdbc.JdbcBasePersistenceImpl.loadVersion(JdbcBasePersistenceImpl.java:646)
           at 
org.apache.polaris.persistence.relational.jdbc.JdbcBasePersistenceImpl.<init>(JdbcBasePersistenceImpl.java:96)
           at 
org.apache.polaris.persistence.relational.jdbc.JdbcMetaStoreManagerFactory.lambda$initializeForRealm$0(JdbcMetaStoreManagerFactory.java:110)
           at 
org.apache.polaris.persistence.relational.jdbc.JdbcMetaStoreManagerFactory.checkPolarisServiceBootstrappedForRealm(JdbcMetaStoreManagerFactory.java:306)
           at 
org.apache.polaris.persistence.relational.jdbc.JdbcMetaStoreManagerFactory.getOrCreateSessionSupplier(JdbcMetaStoreManagerFactory.java:214)
           at 
org.apache.polaris.persistence.relational.jdbc.JdbcMetaStoreManagerFactory_ClientProxy.getOrCreateSessionSupplier(Unknown
 Source)
           at 
org.apache.polaris.service.quarkus.config.QuarkusProducers.polarisCallContext(QuarkusProducers.java:132)
           at 
org.apache.polaris.service.quarkus.config.QuarkusProducers_ProducerMethod_polarisCallContext_MGTQDFZxeL33U92ScLq4YD5TMU0_Bean.doCreate(Unknown
 Source)
           at 
org.apache.polaris.service.quarkus.config.QuarkusProducers_ProducerMethod_polarisCallContext_MGTQDFZxeL33U92ScLq4YD5TMU0_Bean.create(Unknown
 Source)
           at 
org.apache.polaris.service.quarkus.config.QuarkusProducers_ProducerMethod_polarisCallContext_MGTQDFZxeL33U92ScLq4YD5TMU0_Bean.create(Unknown
 Source)
           at 
io.quarkus.arc.impl.CurrentManagedContext$1.get(CurrentManagedContext.java:111)
           at 
io.quarkus.arc.impl.CurrentManagedContext$1.get(CurrentManagedContext.java:107)
           at 
io.quarkus.arc.generator.Default_jakarta_enterprise_context_RequestScoped_ContextInstances.c23(Unknown
 Source)
           at 
io.quarkus.arc.generator.Default_jakarta_enterprise_context_RequestScoped_ContextInstances.computeIfAbsent(Unknown
 Source)
           at 
io.quarkus.arc.impl.CurrentManagedContext.getIfActive(CurrentManagedContext.java:107)
           at 
io.quarkus.arc.impl.ClientProxies.getSingleContextDelegate(ClientProxies.java:30)
           at 
org.apache.polaris.core.context.QuarkusProducers_ProducerMethod_polarisCallContext_MGTQDFZxeL33U92ScLq4YD5TMU0_ClientProxy.arc$delegate(Unknown
 Source)
           at 
org.apache.polaris.core.context.QuarkusProducers_ProducerMethod_polarisCallContext_MGTQDFZxeL33U92ScLq4YD5TMU0_ClientProxy.getPolarisCallContext(Unknown
 Source)
           at 
org.apache.polaris.service.auth.DefaultOAuth2ApiService.getToken(DefaultOAuth2ApiService.java:108)
           at 
org.apache.polaris.service.auth.DefaultOAuth2ApiService_ClientProxy.getToken(Unknown
 Source)
           at 
org.apache.polaris.service.catalog.api.QuarkusProducers_ProducerMethod_icebergRestOAuth2ApiService_WIcWvUvfehJAYxX0Gc0olpOBA_k_ClientProxy.getToken(Unknown
 Source)
           at 
org.apache.polaris.service.catalog.api.IcebergRestOAuth2Api.getToken(IcebergRestOAuth2Api.java:99)
           at 
org.apache.polaris.service.catalog.api.IcebergRestOAuth2Api_Subclass.getToken$$superforward(Unknown
 Source)
           at 
org.apache.polaris.service.catalog.api.IcebergRestOAuth2Api_Subclass$$function$$1.apply(Unknown
 Source)
           at 
io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:73)
           at 
io.quarkus.arc.impl.AroundInvokeInvocationContext$NextAroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:97)
           at 
io.smallrye.faulttolerance.FaultToleranceInterceptor.lambda$syncFlow$8(FaultToleranceInterceptor.java:364)
           at io.smallrye.faulttolerance.core.Future.from(Future.java:85)
           at 
io.smallrye.faulttolerance.FaultToleranceInterceptor.lambda$syncFlow$9(FaultToleranceInterceptor.java:364)
           at 
io.smallrye.faulttolerance.core.FaultToleranceContext.call(FaultToleranceContext.java:20)
           at 
io.smallrye.faulttolerance.core.Invocation.apply(Invocation.java:29)
           at 
io.smallrye.faulttolerance.core.metrics.MetricsCollector.apply(MetricsCollector.java:98)
           at 
io.smallrye.faulttolerance.FaultToleranceInterceptor.syncFlow(FaultToleranceInterceptor.java:367)
           at 
io.smallrye.faulttolerance.FaultToleranceInterceptor.intercept(FaultToleranceInterceptor.java:205)
           at 
io.smallrye.faulttolerance.FaultToleranceInterceptor_Bean.intercept(Unknown 
Source)
           at 
io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
           at 
io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:70)
           at 
io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:62)
           at 
io.quarkus.micrometer.runtime.MicrometerTimedInterceptor.timedMethod(MicrometerTimedInterceptor.java:79)
           at 
io.quarkus.micrometer.runtime.MicrometerTimedInterceptor_Bean.intercept(Unknown 
Source)
           at 
io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
           at 
io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:30)
           at 
io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:27)
           at 
org.apache.polaris.service.catalog.api.IcebergRestOAuth2Api_Subclass.getToken(Unknown
 Source)
           at 
org.apache.polaris.service.catalog.api.IcebergRestOAuth2Api$quarkusrestinvoker$getToken_f6dd65d68bbb7be8bc087c1c82d2d2a56984933f.invoke(Unknown
 Source)
           at 
org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
           at 
io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141)
           at 
org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
           at 
io.quarkus.vertx.core.runtime.VertxCoreRecorder$15.runWith(VertxCoreRecorder.java:637)
           at 
org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2651)
           at 
org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2630)
           at 
org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1622)
           at 
org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1589)
           at 
org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
           at 
org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
           at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
           at java.base/java.lang.Thread.run(Thread.java:1583)
   Caused by: java.sql.SQLException: Failed due to ERROR: relation 
"polaris_schema.version" does not exist
     Position: 27, after , 1 attempts and 5000 milliseconds
           at 
org.apache.polaris.persistence.relational.jdbc.DatasourceOperations.withRetries(DatasourceOperations.java:299)
           at 
org.apache.polaris.persistence.relational.jdbc.DatasourceOperations.executeSelectOverStream(DatasourceOperations.java:159)
           at 
org.apache.polaris.persistence.relational.jdbc.DatasourceOperations.executeSelect(DatasourceOperations.java:140)
           at 
org.apache.polaris.persistence.relational.jdbc.JdbcBasePersistenceImpl.loadVersion(JdbcBasePersistenceImpl.java:639)
           ... 56 more
   Caused by: org.postgresql.util.PSQLException: ERROR: relation 
"polaris_schema.version" does not exist
     Position: 27
           at 
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2736)
           at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2423)
           at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:374)
           at 
org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:518)
           at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:435)
           at 
org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:196)
           at 
org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:139)
           at 
io.agroal.pool.wrapper.PreparedStatementWrapper.executeQuery(PreparedStatementWrapper.java:80)
           at 
org.apache.polaris.persistence.relational.jdbc.DatasourceOperations.lambda$executeSelectOverStream$2(DatasourceOperations.java:167)
           at 
org.apache.polaris.persistence.relational.jdbc.DatasourceOperations.withRetries(DatasourceOperations.java:274)
           ... 59 more
   
   2025-07-20 16:47:02,918 INFO  [io.qua.htt.access-log] [,POLARIS] [,,,] 
(executor-thread-1) 127.0.0.1 - - [20/Jul/2025:16:47:02 +0000] "POST 
/api/catalog/v1/oauth/tokens HTTP/1.1" 500 99
   ```
   
   ### System information
   
   Kubernetes: `v1.29.12`
   Polaris: `1.0.0`
   Object Store: Apache Ozone `1.4.1` on Kubernetes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to