-
Notifications
You must be signed in to change notification settings - Fork 230
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
ERROR: relation "eventuate.saga_instance" does not exist #95
Comments
Some thing is not right with the database. How have you configured the DB? Are you using an Eventuate container image? What's the JDBC connection string? |
I haven't used Eventuate Container Image for the Postgres DB instead I have installed it in my local PC or Postgres Container Order Micro service: Customer Micro service: Queries:
Please refer below application.yml for JDBC connection string. (Note: already shared these details in my previous post itself) application.yml |
|
Hi @cer, So this is my understanding
Otherwise I will be getting below issues while creating an order
So please correct me.
cdcservice: Order Micro service: application.yml |
Correct
Yes. You can. You have multiple options:
The services and the CDC need to be configured appropriately.
Correct. However, the unreleased version of Eventuate supports using flyway to create the DB schema
The orchestrator can either be a services.
See answer to 2. DB per service supported.
The CustomerProxy is building - not sending - the message.
This example uses the not yet released version of Eventuate that supports flyway.
This is the simplified configuration of the CDC - here's the multiple DB configuration: https://github.com/eventuate-tram/eventuate-tram-sagas-examples-customers-and-orders/blob/775a42e67689ffa983526522f700760879a31d16/docker-compose-postgres.yml#L118 To debug the CDC problem:
|
@cer
could not access database PreparedStatementCallback; bad SQL grammar [update public.cdc_monitoring set last_time = ? where reader_id = ?]; nested exception is org.postgresql.util.PSQLException: ERROR: relation "public.cdc_monitoring" does not exist |
Short answer is question: https://github.com/eventuate-foundation/eventuate-common/tree/master/postgres and https://github.com/eventuate-tram/eventuate-tram-sagas/tree/master/postgres
You need to create the cdc_monitoring table too. |
Thanks for your reply. I am finding difficulties with eventuate workflow and its tables creation as I am unable to make SAGA flow working My Queries:
As per your suggestion now My CDC service is points to 2 different databases.
But as per the given links there are 5 sql scripts which are all points to eventuate schema 1.initialize-database.sql But I didn't execute all the above script files and just tried to fix the CDC error by creating some of the eventuate tables across 3 DB schema
Now CDC is up and running and it is healthy but unfortunately there is no SAGA initiated as still my ORDER is in PENDING state. |
Hmm.. I see the problem with those scripts - they use Eventuate as the hardwired schema. But the key point is to create the same tables as those scripts. It's great that the CDC is healthy. Perhaps the Order Service is writing to Eventuate tables in one schema (e.g. eventuate) and the CDC is reading from tabled in a different schema (e.g. public). I'd would only create the eventuate is one schema in each database server. For example, I'd take a look at this file: https://github.com/eventuate-tram/eventuate-tram-sagas-examples-customers-and-orders/blob/development/docker-compose-postgres.yml
|
@cer As you have mentioned I will execute below 5 script files in both order-service and customer-service postgres DB under public schema instead of eventuate schema. But where to execute this schema file
More queries:
|
Even though some tables are orchestrator specific and some are participant specific, I would execute it in both for both the order and customer services. |
Please could you clarify the question. Names of which topics? |
@cer |
The Customer Service and Order Service have to agree on the name of the customer service's command channel: This channel name is defined by you and could be read from a configuration file. A sagas reply channel name is derived from the saga class name There is also the concept of ChannelMapping, which by default (if you don't define your own bean) is DefaultChannelMapping |
JDBC string: customer micro service: 2. List down all possible properties to configure topic names in application.yml like below ? As I could see there are 2 other topics were created automatically other than customerService.
|
I think you are missing: https://github.com/eventuate-tram/eventuate-tram-sagas-examples-customers-and-orders/blob/6526fd92030fa533e8d59f143e24ce67ec97e6eb/docker-compose-postgres.yml#L47
|
Ok.what is the corresponding configuration property |
|
@cer
|
The next version, which should be released in the next couple of weeks.
The split into common, orchestrator and participant tables might not happen until later.
Take a look at https://github.com/eventuate-platform/eventuate-platform-dependencies If you then look in
That table is created by the application. Not the saga implementation.
Those tables are created by the application. That's entirely up to you.
That's application level.
Which business entity tables are you referring to? |
Sorry for some of my dumb question as I clearly want to understand your framework so that I can use it in my application. Queries:
|
|
Actually, what you are describing is often an anti-pattern: https://martinfowler.com/bliki/AnemicDomainModel.html Quite often a better approach is to have a Rich domain model (https://martinfowler.com/eaaCatalog/domainModel.html) where entities have data and behavior. |
@cer Currently I am using
In https://github.com/eventuate-platform/eventuate-platform-dependencies/blob/master/gradle.properties#L13 it is eventuateCdcVersion=0.15.0.BUILD-SNAPSHOT You mean ****BUILD-SNAPSHOT is PROD version? |
No. You need to look at a release of the platform. e..g for example: https://github.com/eventuate-platform/eventuate-platform-dependencies/blob/2022.2.RELEASE/gradle.properties |
Thank you 👍 |
|
2. what is the PROD verison of image: eventuateio/eventuate-vanilla-postgres:0.17.0.BUILD-SNAPSHOT ? |
I'm guessing that WAL is not installed. See https://github.com/eventuate-foundation/eventuate-common/blob/master/postgres/Dockerfile-vanilla |
This is new in the forthcoming release. |
|
|
Strictly speaking https://packages.ubuntu.com/focal/postgresql-12-wal2json is a PostgreSQL logical decoding JSON output plugin. See https://www.postgresql.org/docs/current/logicaldecoding.html |
Not currently. |
Not explicitly. It inserts into the DB; publishes to a broker; and subscribes to a broker. It leverages the security capabilities of the DB and the broker. Did you have any specific requirements in mind? |
@cer Did you have any specific requirements in mind? Not specifically but framework like AXON provides security features and data protection and also we want to fix issues found by SCA (Software Composition Analyses tool) |
Is there any docker image and helm chart for PostgreSQL with WAL enabled as I currently we are using official postgres image from the docker hub and I dont see any environmental variable for the WAL configuration ? |
I'm not aware of any. It's a simple matter to build your own image (or use the Eventuate one). |
The Axxon GDPR module is targeted when you have an immutable event store for Event Sourcing. The Eventuate Tram (Saga) framework is not an immutable event store for Event Sourcing. e.g. Kafka retains events for a finite period of time. Having said that, is this something that you think you need? Client's community with the Axxon server so it has specific security needs. I'm happy to discuss concrete requirements, however. |
Stack Trace:
2023-03-09T04:53:23.687+05:30 ERROR 40264 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [INSERT INTO eventuate.saga_instance(saga_type, saga_id, state_name, last_request_id, saga_data_type, saga_data_json, end_state, compensating) VALUES(?, ?, ?, ?, ?, ?, ?, ?)]] with root cause
org.postgresql.util.PSQLException: ERROR: relation "eventuate.saga_instance" does not exist
Position: 13
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676) ~[postgresql-42.5.4.jar:42.5.4]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366) ~[postgresql-42.5.4.jar:42.5.4]
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356) ~[postgresql-42.5.4.jar:42.5.4]
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:496) ~[postgresql-42.5.4.jar:42.5.4]
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:413) ~[postgresql-42.5.4.jar:42.5.4]
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:190) ~[postgresql-42.5.4.jar:42.5.4]
at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:152) ~[postgresql-42.5.4.jar:42.5.4]
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61) ~[HikariCP-5.0.1.jar:na]
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java) ~[HikariCP-5.0.1.jar:na]
at org.springframework.jdbc.core.JdbcTemplate.lambda$update$2(JdbcTemplate.java:965) ~[spring-jdbc-6.0.6.jar:6.0.6]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:651) ~[spring-jdbc-6.0.6.jar:6.0.6]
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:960) ~[spring-jdbc-6.0.6.jar:6.0.6]
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:1015) ~[spring-jdbc-6.0.6.jar:6.0.6]
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:1025) ~[spring-jdbc-6.0.6.jar:6.0.6]
at io.eventuate.common.common.spring.jdbc.EventuateSpringJdbcStatementExecutor.update(EventuateSpringJdbcStatementExecutor.java:23) ~[eventuate-common-common-spring-jdbc-0.9.0.RELEASE.jar:na]
at io.eventuate.tram.sagas.orchestration.SagaInstanceRepositoryJdbc.save(SagaInstanceRepositoryJdbc.java:89) ~[eventuate-tram-sagas-orchestration-0.13.0.RELEASE.jar:na]
at io.eventuate.tram.sagas.orchestration.SagaManagerImpl.create(SagaManagerImpl.java:87) ~[eventuate-tram-sagas-orchestration-0.13.0.RELEASE.jar:na]
at io.eventuate.tram.sagas.orchestration.SagaManagerImpl.create(SagaManagerImpl.java:69) ~[eventuate-tram-sagas-orchestration-0.13.0.RELEASE.jar:na]
at io.eventuate.tram.sagas.orchestration.SagaInstanceFactory.create(SagaInstanceFactory.java:21) ~[eventuate-tram-sagas-orchestration-0.13.0.RELEASE.jar:na]
at com.mt.unity.orderservice.saga.OrderSagaService.createOrder(OrderSagaService.java:37) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) ~[spring-aop-6.0.6.jar:6.0.6]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196) ~[spring-aop-6.0.6.jar:6.0.6]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-6.0.6.jar:6.0.6]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750) ~[spring-aop-6.0.6.jar:6.0.6]
Application.yml
spring:
datasource:
driver-class-name: org.postgresql.Driver
username: postgres
password: admin
url: jdbc:postgresql://${DATABASE_HOST:localhost}:5432/${DB_POSTGRES_DATABASE_NAME:orders}
jpa:
properties:
'[hibernate.default_schema]': public note: I used eventuate instead of public but that also doesn't work.
show-sql: true
generate-ddl: true
hibernate:
ddl-auto: update
database: postgresql
eventuate dependencies
eventuatelocal.kafka.bootstrap.servers: ${DOCKER_HOST_IP:localhost}:9092
eventuatelocal.zookeeper.connection.string: ${DOCKER_HOST_IP:localhost}:2181
Main Class:
@SpringBootApplication
@slf4j
@import({
SagaOrchestratorConfiguration.class,
TramMessageProducerJdbcConfiguration.class,
EventuateTramKafkaMessageConsumerConfiguration.class
})
public class OrderServiceApplication {
}
Pom.xml
<java.version>17</java.version>
<org.mapstruct.version>1.4.2.Final</org.mapstruct.version>
0.24.0.RELEASE
0.13.0.RELEASE
The text was updated successfully, but these errors were encountered: