运行版本垃圾收集时出现以下错误:
"超过限制 100000 个文档,将下一个收集间隔减少到 37561439 秒","logger_name":"org.apache.jackrabbit.oak.plugins.document.VersionGarbageCollector","thread_name":"http-nio-8080-exec-3" "level":"INFO","level_value":20000} "Servlet.service() for servlet [dispatcherServlet] 在路径 [] 的上下文中抛出异常 [请求处理失败;嵌套异常是 org.apache.jackrabbit.oak。 plugins.document.DocumentStoreException: 读取 versionGC] 时出现异常,根本原因","logger_name":"org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]","thread_name ":"http-nio-8080-exec-3","level":"ERROR","level_value":40000,"stack_trace":" org.postgresql.util.PSQLException:无法在事务中间更改事务只读属性。\r\n\tat org.postgresql.jdbc.PgConnection.setReadOnly(PgConnection.java:693)\r\n\tat sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl .invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:498)\r\n\tat org.apache.tomcat.jdbc.pool.ProxyConnection.invoke (ProxyConnection.java:126)\r\n\tat org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)\r\n\tat org.apache.tomcat.jdbc.pool.interceptor .AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:79)\r\n\tat org.apache.tomcat.jdbc.pool.interceptor.StatementCache.invoke(StatementCache.java:203)\r\n\tat org.apache.tomcat .jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)\r\n\tat org.apache.tomcat.jdbc.pool.interceptor.ConnectionState。调用(ConnectionState.java:152)\r\n\tat org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)\r\n\tat org.apache.tomcat.jdbc.pool。拦截器.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:79)\r\n\tat org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)\r\n\tat org.apache.tomcat。 jdbc.pool.TrapException.invoke(TrapException.java:40)\r\n\tat org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)\r\n\tat org.apache。 tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:79)\r\n\tat org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)\r\n\tat org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:81)\r\n\tat com.sun.proxy.$Proxy81。setReadOnly(未知来源)\r\n\tat org.apache.jackrabbit.oak.plugins.document.rdb.RDBConnectionHandler.setReadOnly(RDBConnectionHandler.java:176)\r\n\tat org.apache.jackrabbit.oak.plugins .document.rdb.RDBConnectionHandler.getROConnection(RDBConnectionHandler.java:61)\r\n\tat org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.readDocumentUncached(RDBDocumentStore.java:1897)\r\n\ tat org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.readDocumentCached(RDBDocumentStore.java:1454)\r\n\tat org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.internalCreateOrUpdate(RDBDocumentStore .java:1557)\r\n\tat org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.createOrUpdate(RDBDocumentStore.java:367)\r\n\tat org.apache.jackrabbit.oak.plugins .document.VersionGarbageCollector$建议。setLongSetting(VersionGarbageCollector.java:1200)\r\n\tat org.apache.jackrabbit.oak.plugins.document.VersionGarbageCollector$Recommendations.evaluate(VersionGarbageCollector.java:1156)\r\n\tat org.apache.jackrabbit。 Oak.plugins.document.VersionGarbageCollector$GCJob.gc(VersionGarbageCollector.java:515)\r\n\tat org.apache.jackrabbit.oak.plugins.document.VersionGarbageCollector$GCJob.run(VersionGarbageCollector.java:475)\r \n\tat org.apache.jackrabbit.oak.plugins.document.VersionGarbageCollector.gc(VersionGarbageCollector.java:144)\r\n\tat com.springernature.mango.cms.services.rest.service.ServicesController.runGC( ServicesController.java:1080)\r\n\tat com.springernature.mango.cms.services.rest.service.ServicesController$$FastClassBySpringCGLIB$$bd16ea4e.invoke()\r\n\tat org.springframework.cglib.proxy .MethodProxy.invoke(MethodProxy.java:204)\r\n\tat org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)\r\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java: 157)\r\n\tat org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:84)\r\n\tat com.springernature.mango.cms.handler.LoggingHandler.logAround(LoggingHandler.java: 108)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl .invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:498)\r\n\tat org.springframework.aop.aspectj.AbstractAspectJAdvice。invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)\r\n\tat org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616)\r\n\tat org.springframework.aop.aspectj.AspectJAroundAdvice.invoke( AspectJAroundAdvice.java:70)\r\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)\r\n\tat org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor. java:92)\r\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)\r\n\tat org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy. java:671)\r\n\tat com.springernature.mango.cms.services.rest.service.ServicesController$$EnhancerBySpringCGLIB$$a5dbc1e7。运行GC()\r\n\tat
我的代码:
public void runGC() {
log.info("Running garbage collection for NodeStore");
try {
RepositoryUtil.getDocumentNodeStore().getVersionGarbageCollector().gc(
0,
TimeUnit.DAYS);
} catch (final IOException ioe) {
log.error("Error while running Version Garbage Collection : {}", ioe);
}
log.info("Garbage collection execution completed");
}
请让我知道如何在 jackrabbit 橡树中为已删除的节点正确运行版本垃圾收集。
下面是创建存储库并获取文档节点存储对象以进行版本垃圾收集的代码
private static Repository createRepo(final Map<String, String> dbDetails)
throws DataStoreException {
try {
final RDBOptions options =
new RDBOptions().tablePrefix(dbDetails.get(DB_TABLE_PREFIX)).dropTablesOnClose(
false);
final DataSource ds =
RDBDataSourceFactory.forJdbcUrl(
dbDetails.get("dbURL"),
dbDetails.get("dbUser"),
dbDetails.get("dbPassword"));
final Properties properties = buildS3Properties(dbDetails);
final S3DataStore s3DataStore = buildS3DataStore(properties);
final DataStoreBlobStore dataStoreBlobStore = new DataStoreBlobStore(s3DataStore);
final Whiteboard wb = new DefaultWhiteboard();
bapRegistration =
wb.register(
BlobAccessProvider.class,
(BlobAccessProvider) dataStoreBlobStore,
properties);
*documentNodeStore =*
new RDBDocumentNodeStoreBuilder()
.setBlobStore(dataStoreBlobStore)
.setBundlingDisabled(true)
.setRDBConnection(ds, options)
.build();
repository = new Jcr(documentNodeStore).with(wb).createRepository();
return repository;
} catch (final DataStoreException e) {
log.error("S3 Connection could not be created." + e);
throw new DataStoreException("S3 Connection could not be created");
}
}