Erudika / para

Multitenant backend server for building web and mobile apps rapidly. The backend for busy developers. (self-hosted or hosted)
https://paraio.org
Apache License 2.0
531 stars 146 forks source link

data loss upgrading from 1.29.2 to 1.31.0 #55

Closed weisjohn closed 6 years ago

weisjohn commented 6 years ago

After upgrading the deployment, I saw that the data has been lost. After trying to downgrade back to a 1.29.2 image, here are the logs that I see:

λ k logs -f para-5cf9696dcb-s98rd

      ____  ___ _ ____ ___ _
     / __ \/ __` / ___/ __` /
    / /_/ / /_/ / /  / /_/ /
   / .___/\__,_/_/   \__,_/  v1.29.2
  /_/

2018-11-07 21:30:39 [INFO ] --- Para.initialize() [production] ---
2018-11-07 21:30:39 [INFO ] Loaded new DAO, Search and Cache implementations - H2DAO, LuceneSearch and CaffeineCache.
2018-11-07 21:30:41 [WARN ] Couldn't get IndexReader - 'para-lucene' does not exist: Format version is not supported (resource BufferedChecksumIndexInput(MMapIndexInput(path="/para/data/para-lucene/segments_xq"))): 9 (needs to be between 6 and 8)
2018-11-07 21:30:41 [WARN ] Server is unhealthy - root app not found. Open /v1/_setup in the browser to initialize Para.
2018-11-07 21:30:41 [INFO ] Instance #1 initialized.
2018-11-07 21:30:41 [INFO ] Starting ParaServer on para-5cf9696dcb-s98rd with PID 7 (/para/para-war-1.29.2.war started by root in /para)
2018-11-07 21:30:41 [INFO ] The following profiles are active: production
2018-11-07 21:30:42 [INFO ] Listening on port 8080...
2018-11-07 21:30:44 [INFO ] Started ParaServer in 3.206 seconds (JVM running for 6.351)
2018-11-07 21:31:11 [WARN ] Couldn't get IndexReader - 'para-lucene' does not exist: Format version is not supported (resource BufferedChecksumIndexInput(MMapIndexInput(path="/para/data/para-lucene/segments_xq"))): 9 (needs to be between 6 and 8)
2018-11-07 21:32:11 [WARN ] Couldn't get IndexReader - 'para-lucene' does not exist: Format version is not supported (resource BufferedChecksumIndexInput(MMapIndexInput(path="/para/data/para-lucene/segments_xq"))): 9 (needs to be between 6 and 8)
2018-11-07 21:33:11 [WARN ] Couldn't get IndexReader - 'para-lucene' does not exist: Format version is not supported (resource BufferedChecksumIndexInput(MMapIndexInput(path="/para/data/para-lucene/segments_xq"))): 9 (needs to be between 6 and 8)
2018-11-07 21:34:11 [WARN ] Couldn't get IndexReader - 'para-lucene' does not exist: Format version is not supported (resource BufferedChecksumIndexInput(MMapIndexInput(path="/para/data/para-lucene/segments_xq"))): 9 (needs to be between 6 and 8)
2018-11-07 21:35:11 [WARN ] Couldn't get IndexReader - 'para-lucene' does not exist: Format version is not supported (resource BufferedChecksumIndexInput(MMapIndexInput(path="/para/data/para-lucene/segments_xq"))): 9 (needs to be between 6 and 8)
2018-11-07 21:36:11 [WARN ] Couldn't get IndexReader - 'para-lucene' does not exist: Format version is not supported (resource BufferedChecksumIndexInput(MMapIndexInput(path="/para/data/para-lucene/segments_xq"))): 9 (needs to be between 6 and 8)
weisjohn commented 6 years ago

I was able to restore the data directory from a snapshot, however, I can't understand what to do to upgrade from 1.29.2.

Is there some way to do a data export, upgrade to 1.31.0 and then import that data?

albogdano commented 6 years ago

Upgrading the para-search-lucene plugin to 1.30.x requires a full reindex. There are some breaking changes to the schema. Details here: https://github.com/Erudika/para-search-lucene/releases Additionally, there might be an incompatibility between Lucene index versions 6/7.

I wouldn't call it data loss, rather, index corruption. Once the index has been rebuilt, everything should be back to normal. Here's the documentation on this topic: http://paraio.org/docs/#data-consistency-and-resilience

weisjohn commented 6 years ago

Thanks @albogdano for the pointer to the docs!

I'll document the resolution here in hope that it is helpful to others.

After moving from 1.29.2 to 1.31.0, restarting the server, I get additional logs. The most distressing line to me is Server is unhealthy - root app not found. Open /v1/_setup in the browser to initialize Para.. That seems unrelated to the index issue. As a user/admin, I'd be really hesitant to try to hit the _setup endpoint, as I actually don't want to do that; I want to restore the data that already exists, and I'd rather not rotate my client (scoold) secret.

λ k logs -f para-68d6fd4f57-gqphl

      ____  ___ _ ____ ___ _
     / __ \/ __` / ___/ __` /
    / /_/ / /_/ / /  / /_/ /
   / .___/\__,_/_/   \__,_/  v1.31.0
  /_/

2018-11-08 15:39:10 [INFO ] --- Para.initialize() [production] ---
2018-11-08 15:39:10 [INFO ] Loaded new DAO, Search and Cache implementations - H2DAO, LuceneSearch and CaffeineCache.
2018-11-08 15:39:11 [INFO ] Table 'para' was altered to include 'json_updates' column.
2018-11-08 15:39:12 [WARN ] No search results for type 'null' in app 'para': unexpected docvalues type SORTED for field 'timestamp' (expected one of [SORTED_NUMERIC, NUMERIC]). Re-index with correct docvalues type..
2018-11-08 15:39:12 [WARN ] Server is unhealthy - root app not found. Open /v1/_setup in the browser to initialize Para.
2018-11-08 15:39:12 [INFO ] Instance #1 initialized.
2018-11-08 15:39:13 [INFO ] Starting ParaServer on para-68d6fd4f57-gqphl with PID 1 (/para/para-jar-1.31.0.jar started by root in /para)
2018-11-08 15:39:13 [INFO ] The following profiles are active: production
2018-11-08 15:39:13 [INFO ] Listening on port 8080...
2018-11-08 15:39:15 [INFO ] Started ParaServer in 2.819 seconds (JVM running for 6.885)
2018-11-08 15:39:42 [WARN ] No search results for type 'null' in app 'para': unexpected docvalues type SORTED for field 'timestamp' (expected one of [SORTED_NUMERIC, NUMERIC]). Re-index with correct docvalues type..
2018-11-08 15:40:42 [WARN ] No search results for type 'null' in app 'para': unexpected docvalues type SORTED for field 'timestamp' (expected one of [SORTED_NUMERIC, NUMERIC]). Re-index with correct docvalues type..
2018-11-08 15:41:42 [WARN ] No search results for type 'null' in app 'para': unexpected docvalues type SORTED for field 'timestamp' (expected one of [SORTED_NUMERIC, NUMERIC]). Re-index with correct docvalues type..
2018-11-08 15:42:42 [WARN ] No search results for type 'null' in app 'para': unexpected docvalues type SORTED for field 'timestamp' (expected one of [SORTED_NUMERIC, NUMERIC]). Re-index with correct docvalues type..
2018-11-08 15:43:42 [WARN ] No search results for type 'null' in app 'para': unexpected docvalues type SORTED for field 'timestamp' (expected one of [SORTED_NUMERIC, NUMERIC]). Re-index with correct docvalues type..

So, following your advice, I tried to issue a re-index. I downloaded Postman, learned how to use the AWS authentication, and learned about the _me and _health routes. Before re-indexing:

{
    "code": 500,
    "message": "unhealthy"
}

Then I issued the re-index; response:

{
    "tookMillis": 1964,
    "reindexed": 405
}

logs from re-indexing:

2018-11-08 16:02:22 [INFO ] Deleting 'para' index before rebuilding it...
2018-11-08 16:02:24 [INFO ] rebuildIndex(): Done. 405 objects reindexed.

After re-indexing:

{
    "code": 500,
    "message": "unhealthy"
}

Then, about a minute later, I noticed another log:

2018-11-08 16:03:16 [INFO ] Server is healthy.

If you look at those timestamps, it appears that the re-indexing took a while to "take".

After that, all the data came back and the service was restored in Scoold as well.

albogdano commented 6 years ago

I agree with you that the message "root app not found" is misleading and I'll see if I can make it appear only when that is actually the case. The reason for this message is that Para uses the search index to find all the apps on startup including the root app. If the index is corrupted then the root app isn't found but it's actually there. Thanks for the feedback!

weisjohn commented 6 years ago

Not sure if this is related, but I'm now getting another issue with the database:

2018-11-09 18:07:05 [ERROR] null
org.h2.jdbc.JdbcSQLException: General error: "java.lang.IllegalStateException: Reading from nio:/para/data/para.mv.db failed; file length 1675264 read length 12288 at 41999 [1.4.197/1]"; SQL statement:
SELECT json, json_updates FROM para WHERE id IN (?) [50000-197]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:357)
    at org.h2.message.DbException.get(DbException.java:168)
    at org.h2.message.DbException.convert(DbException.java:307)
    at org.h2.command.Command.executeQuery(Command.java:216)
    at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:114)
    at com.erudika.para.persistence.H2Utils.readRows(H2Utils.java:290)
    at com.erudika.para.persistence.H2DAO.read(H2DAO.java:83)
    at com.erudika.para.persistence.H2DAO$$EnhancerByGuice$$89845244.CGLIB$read$13(<generated>)
    at com.erudika.para.persistence.H2DAO$$EnhancerByGuice$$89845244$$FastClassByGuice$$e1900739.invoke(<generated>)
    at com.google.inject.internal.cglib.proxy.$MethodProxy.invokeSuper(MethodProxy.java:228)
    at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:76)
    at com.erudika.para.aop.IndexAndCacheAspect.invokeDAO(IndexAndCacheAspect.java:152)
    at com.erudika.para.aop.IndexAndCacheAspect.readFromCacheOperation(IndexAndCacheAspect.java:291)
    at com.erudika.para.aop.IndexAndCacheAspect.handleCaching(IndexAndCacheAspect.java:186)
    at com.erudika.para.aop.IndexAndCacheAspect.invoke(IndexAndCacheAspect.java:130)
    at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:78)
    at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:54)
    at com.erudika.para.persistence.H2DAO$$EnhancerByGuice$$89845244.read(<generated>)
    at com.erudika.para.persistence.H2DAO.read(H2DAO.java:156)
    at com.erudika.para.persistence.H2DAO$$EnhancerByGuice$$89845244.CGLIB$read$12(<generated>)
    at com.erudika.para.persistence.H2DAO$$EnhancerByGuice$$89845244$$FastClassByGuice$$e1900739.invoke(<generated>)
    at com.google.inject.internal.cglib.proxy.$MethodProxy.invokeSuper(MethodProxy.java:228)
    at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:76)
    at com.erudika.para.aop.IndexAndCacheAspect.invokeDAO(IndexAndCacheAspect.java:152)
    at com.erudika.para.aop.IndexAndCacheAspect.invoke(IndexAndCacheAspect.java:139)
    at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:78)
    at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:54)
    at com.erudika.para.persistence.H2DAO$$EnhancerByGuice$$89845244.read(<generated>)
    at com.erudika.para.security.RestAuthFilter.appAuthRequestHandler(RestAuthFilter.java:172)
    at com.erudika.para.security.RestAuthFilter.doFilter(RestAuthFilter.java:86)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at com.erudika.para.security.JWTRestfulAuthFilter.doFilter(JWTRestfulAuthFilter.java:125)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at com.erudika.para.security.filters.SAMLMetadataFilter.doFilter(SAMLMetadataFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:100)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
    at com.erudika.para.utils.filters.CORSFilter.handleNonCORS(CORSFilter.java:415)
    at com.erudika.para.utils.filters.CORSFilter.doFilter(CORSFilter.java:164)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
    at com.erudika.para.utils.filters.ErrorFilter.doFilter(ErrorFilter.java:59)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle(Server.java:503)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Reading from nio:/para/data/para.mv.db failed; file length 1675264 read length 12288 at 41999 [1.4.197/1]
    at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:870)
    at org.h2.mvstore.DataUtils.readFully(DataUtils.java:417)
    at org.h2.mvstore.FileStore.readFully(FileStore.java:98)
    at org.h2.mvstore.Page.read(Page.java:181)
    at org.h2.mvstore.MVStore.readPage(MVStore.java:1936)
    at org.h2.mvstore.MVMap.readPage(MVMap.java:698)
    at org.h2.mvstore.Page.getChildPage(Page.java:208)
    at org.h2.mvstore.MVMap.binarySearch(MVMap.java:454)
    at org.h2.mvstore.MVMap.binarySearch(MVMap.java:455)
    at org.h2.mvstore.MVMap.get(MVMap.java:436)
    at org.h2.mvstore.db.TransactionStore$TransactionMap.getValue(TransactionStore.java:1239)
    at org.h2.mvstore.db.TransactionStore$TransactionMap.get(TransactionStore.java:1215)
    at org.h2.mvstore.db.TransactionStore$TransactionMap.get(TransactionStore.java:1183)
    at org.h2.mvstore.db.MVPrimaryIndex.getRow(MVPrimaryIndex.java:200)
    at org.h2.mvstore.db.MVTable.getRow(MVTable.java:492)
    at org.h2.mvstore.db.MVSecondaryIndex$MVStoreCursor.get(MVSecondaryIndex.java:493)
    at org.h2.index.IndexCursor.get(IndexCursor.java:299)
    at org.h2.table.TableFilter.getValue(TableFilter.java:1051)
    at org.h2.expression.ExpressionColumn.getValue(ExpressionColumn.java:189)
    at org.h2.command.dml.Select$LazyResultQueryFlat.fetchNextRow(Select.java:1460)
    at org.h2.result.LazyResult.hasNext(LazyResult.java:79)
    at org.h2.result.LazyResult.next(LazyResult.java:59)
    at org.h2.command.dml.Select.queryFlat(Select.java:527)
    at org.h2.command.dml.Select.queryWithoutCache(Select.java:633)
    at org.h2.command.dml.Query.queryWithoutCacheLazyCheck(Query.java:114)
    at org.h2.command.dml.Query.query(Query.java:371)
    at org.h2.command.dml.Query.query(Query.java:333)
    at org.h2.command.CommandContainer.query(CommandContainer.java:114)
    at org.h2.command.Command.executeQuery(Command.java:202)
    ... 103 common frames omitted
Caused by: java.io.IOException: I/O error
    at sun.nio.ch.FileDispatcherImpl.pread0(Native Method)
    at sun.nio.ch.FileDispatcherImpl.pread(FileDispatcherImpl.java:52)
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:220)
    at sun.nio.ch.IOUtil.read(IOUtil.java:197)
    at sun.nio.ch.FileChannelImpl.readInternal(FileChannelImpl.java:741)
    at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:727)
    at org.h2.store.fs.FileNio.read(FilePathNio.java:74)
    at org.h2.mvstore.DataUtils.readFully(DataUtils.java:403)
    ... 130 common frames omitted

Happy to close again if unrelated. Currently trying to learn more about what happened.

weisjohn commented 6 years ago

I was able to reboot that server and it came back, but not sure how that happened.

albogdano commented 6 years ago

Hm, that's definitely not related to the search index. It's an I/O error meaning that the database file para.mv.db couldn't be read. That's related to the para-dao-sql plugin and H2 DB in particular.

albogdano commented 6 years ago

It's not a common error. It could mean that the DB file is locked, missing or corrupted. Related discussion: https://groups.google.com/forum/#!topic/h2-database/GVNb3GgJJEs

albogdano commented 6 years ago

This looks like a bug in H2 which seems to have been recently resolved. I'll update the SQL plugin once H2 v1.4.198 is released. Closing for now...

albogdano commented 6 years ago

@weisjohn Upon further investigation, it appears that there's a "retry:" prefix in H2 which prevents that exception. You can try to enable the retry logic by setting para.db.dir = "retry:./data" which simply adds the "retry:" prefix to the location of the DB file ./data. I have not tested it though.

sainatrajt commented 2 months ago

Hi @albogdano when im trying to update my existing scoold and para to latest stable docker images im gettingt this exception, Can you please assist in resolving this issues, thanks

2024-09-17 07:40:46 [ERROR] null
org.h2.jdbc.JdbcSQLNonTransientConnectionException: Unsupported database file version or invalid file header in file "/para/data/para.mv.db" [90048-224]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:690)
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
    at org.h2.message.DbException.get(DbException.java:212)
    at org.h2.mvstore.db.Store.convertMVStoreException(Store.java:158)
    at org.h2.mvstore.db.Store.<init>(Store.java:142)
    at org.h2.engine.Database.<init>(Database.java:326)
    at org.h2.engine.Engine.openSession(Engine.java:92)
    at org.h2.engine.Engine.openSession(Engine.java:222)
    at org.h2.engine.Engine.createSession(Engine.java:201)
    at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:343)
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:125)
    at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:322)
    at org.h2.jdbcx.JdbcDataSource.getPooledConnection(JdbcDataSource.java:352)
    at org.h2.jdbcx.JdbcConnectionPool.getConnectionNow(JdbcConnectionPool.java:233)
    at org.h2.jdbcx.JdbcConnectionPool.getConnection(JdbcConnectionPool.java:198)
    at com.erudika.para.server.persistence.H2Utils.getConnection(H2Utils.java:95)
    at com.erudika.para.server.persistence.H2Utils.readRows(H2Utils.java:284)
    at com.erudika.para.server.persistence.H2DAO.read(H2DAO.java:79)
    at com.erudika.para.server.persistence.H2DAO$$EnhancerByGuice$$1d8fcf.GUICE$TRAMPOLINE(<generated>)
    at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:74)
    at com.erudika.para.server.aop.IndexAndCacheAspect.invokeDAO(

And also

Caused by: org.h2.mvstore.MVStoreException: The write format 2 is smaller than the supported format 3 [2.2.224/5]
    at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996)
    at org.h2.mvstore.FileStore.getUnsupportedWriteFormatException(FileStore.java:943)
    at org.h2.mvstore.FileStore.processCommonHeaderAttributes(FileStore.java:547)
    at org.h2.mvstore.RandomAccessStore.readStoreHeader(RandomAccessStore.java:227)
    at org.h2.mvstore.FileStore.start(FileStore.java:916)
    at org.h2.mvstore.MVStore.<init>(MVStore.java:289)
    at org.h2.mvstore.MVStore$Builder.open(MVStore.java:2035)
    at org.h2.mvstore.db.Store.<init>(Store.java:133)
2024-09-17 07:40:46 [ERROR] Failed to initialize Para.
java.lang.RuntimeException: DAO write operation failed!
    at com.erudika.para.server.persistence.H2Utils.throwIfNecessary(H2Utils.java:476)
    at com.erudika.para.server.persistence.H2Utils.createRows(H2Utils.java:356)
    at com.erudika.para.server.persistence.H2DAO.create(H2DAO.java:68)
    at com.erudika.para.server.aop.IndexAndCacheAspect.invokeDAO(IndexAndCacheAspect.java:161)
    at com.erudika.para.server.aop.IndexAndCacheAspect.addToIndexOperation(IndexAndCacheAspect.java:226)
    at com.erudika.para.server.aop.IndexAndCacheAspect.handleIndexing(IndexAndCacheAspect.java:171)
    at com.erudika.para.server.aop.IndexAndCacheAspect.invoke(IndexAndCacheAspect.java:138)
    at com.erudika.para.core.App.create(App.java:1043)
    at com.erudika.para.core.utils.Para.newApp(Para.java:432)
    at com.erudika.para.core.utils.Para.newApp(Para.java:406)
    at com.erudika.para.core.utils.Para.setup(Para.java:394)
    at com.erudika.para.server.utils.HealthUtils$1.onInitialize(HealthUtils.java:107)
    at com.erudika.para.core.utils.Para.initialize(Para.java:114)
    at com.erudika.para.server.ParaServer.initialize(ParaServer.java:148)
    at com.erudika.para.server.ParaServer.builder(ParaServer.java:399)
albogdano commented 2 months ago

@sainatrajt Use the migration script to convert /para/data/para.mv.db to the new database format. https://github.com/Erudika/para/blob/master/migrate-h2.sh You will have to edit the file and change the old and new versions of H2 accordingly.

sainatrajt commented 2 months ago

Thanks @albogdano i was able to migrate, One more issue im facing is google login, After adding

scoold.gp_app_id
scoold.gp_secret

i have added my scoold public URL and /signin as well in authorized redirect url in google cloud console but it is im getting issue with Access blocked: This app’s request is invalid, when i add public-Url with /google_auth in the redirect URL im able to see google signin but afte login in it is redirecting to 404-notfound url. Can you please help with this My Any changes in need to do at application level,

scoold.para_endpoint = "http://para:8080"
para.security.redirect_uri = "http://para:8080"
scoold.security.redirect_uri = "http://localhost:8000"

thanks Screenshot from 2024-09-19 16-08-43

Screenshot from 2024-09-19 16-07-29

albogdano commented 2 months ago

@sainatrajt See my answer here: https://github.com/Erudika/scoold/issues/458#issuecomment-2336769745

albogdano commented 2 months ago

The /google_auth endpoint is part of Para, not Scoold. You have to expose it to the internet or login with Google will fail.