spring-sprout / osoon

for your better meet-up experience.
http://osoon.io/
Apache License 2.0
5 stars 0 forks source link

MissingIndexException #39

Closed keesun closed 7 years ago

keesun commented 7 years ago

Description

Caused by: org.neo4j.ogm.autoindex.MissingIndexException: Validation of Constraints and Indexes failed. Could not find the following : [CONSTRAINT ON ( meeting:Meeting ) ASSERT meeting.id IS UNIQUE, CONSTRAINT ON ( user:User ) ASSERT user.nickname IS UNIQUE, CONSTRAINT ON ( user:User ) ASSERT user.id IS UNIQUE, CONSTRAINT ON ( user:User ) ASSERT user.email IS UNIQUE, CONSTRAINT ON ( meetinglocation:MeetingLocation ) ASSERT meetinglocation.id IS UNIQUE, CONSTRAINT ON ( topic:Topic ) ASSERT topic.name IS UNIQUE, CONSTRAINT ON ( topic:Topic ) ASSERT topic.id IS UNIQUE, ]
    at org.neo4j.ogm.autoindex.AutoIndexManager.validateIndexes(AutoIndexManager.java:159)
    at org.neo4j.ogm.autoindex.AutoIndexManager.build(AutoIndexManager.java:96)
    at org.neo4j.ogm.session.SessionFactory.<init>(SessionFactory.java:81)
    at org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration.sessionFactory(Neo4jDataAutoConfiguration.java:73)
    at org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration$$EnhancerBySpringCGLIB$$8354ca87.CGLIB$sessionFactory$2(<generated>)
    at org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration$$EnhancerBySpringCGLIB$$8354ca87$$FastClassBySpringCGLIB$$2c548109.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:360)
    at org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration$$EnhancerBySpringCGLIB$$8354ca87.sessionFactory(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:155)

Repro Steps

App.java 실행하면 발생

System Info

keesun commented 7 years ago

spring.data.neo4j.auto-index=validate 이 옵션 때문에 앱이 뜨다가 죽는데 아에 DB를 새로 만들고 띄워도 죽어서 어떻게 써야 되는건지 모르겠네요. @KimJejun 님 한번 봐주세요. 일단은 주석 처리 해둡니다.

KimJejun commented 7 years ago

일단 assert 로 두고 개발 하면 될 것 같네요. validate 로 쓰면 도메인에 프로퍼티에 @Index 있는경우 DB에서 인덱스 만들어져 있는지 찾는데, 새로 생성된 도메인이나 디비를 새로 생성할 경우에는 만들어 진게 없어서 에러가 발생하네요.

그럼 운영 단계에서는 수동으로 만들어 줘야되나.. 아니면 assert 한번 띄워서 인덱스 한번 만들고 validate로 다시 띄워야되나..

https://docs.spring.io/spring-data/neo4j/docs/5.0.0.RELEASE/reference/html/#Index Creation

keesun commented 7 years ago

flyway 처럼 얘도 스키마 마이그레이션 하는 스크립트를 관리할꺼면 Validate로 띄울 수 있을거 같은데 그게 아니면 Validate는 힘들거 같네요.