0

我正在开发 Spring Boot 应用程序(内容管理系统),它借助 Jack rabbit Oak 节点结构实现和 PostgreSQL 10.4 db 中的所有节点元数据存储在 amazon-s3 存储库中存储多个文件。我们的应用部署在 Cloud Foundry 上,无论应用在什么地方启动,在推送一些更改后,都需要 4 个小时左右的时间才能启动。经过分析,我可以在启动日志中看到大量出现以下日志:

{
"@timestamp":"2019-12-03T15:23:28.156+00:00",
"@version":1,"message":"Slow Query Report SQL=select ID, MODIFIED, MODCOUNT, CMODCOUNT, 
HASBINARY, DELETEDONCE, VERSION, SDTYPE, SDMAXREVTIME, DATA, BDATA from table_NODES 
where ID > ? and ID < ? order by ID FETCH FIRST 1601 ROWS ONLY; time=23329 ms;",
"logger_name":"org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport",
"thread_name":"main","level":"WARN","level_value":30000
}
Long running query on table_NODES with 1601 hits (limited to 1601),
 elapsed time 23335ms (configured QUERYTIMELIMIT 10000), 
params minid '1:/3d3ea681-xxxx-4ed7-b68d-7fgfj8ggkl' maxid '1:0' excludeKeyPatterns [] conditions [] limit 1601. 
Result range: '1:/3d3ea6fe-xxxx-ghjggb3-4ghvkklh'...'1:/3jsffsd8-810a-xxxx-b51a-XXXXXXXX'. 
Read 1323775 chars from DATA and 0 bytes from BDATA. Check calling method. 

由于我是 Jack rabbit Oak 功能和 PostgreSQL 的新手,我不确定应用程序启动时内部发生了什么以及为什么要花费这么多时间。请帮助我获得这些理解以及如何克服这个问题,以便应用程序可以快速启动。您还可以在下面找到数据库配置日志:

{
"@timestamp":"2019-12-03T15:23:25.338+00:00",
"@version":1,"message":"RDBDocumentStore (1.10.2) instantiated for database PostgreSQL 10.4 
(Ubuntu 10.4-2.pgdg16.04+1) (10.4), using driver: PostgreSQL JDBC Driver 42.2.2 (42.2), 
connecting to: jdbc:postgresql:<connection URL>, properties: {datcollate=C, 
pg_encoding_to_char(encoding)=UTF8}, transaction isolation level: TRANSACTION_READ_COMMITTED (2), 
.table_nodes: id varchar(512), modified int8, hasbinary int2, deletedonce int2, modcount int8, 
cmodcount int8, dsize int8, data varchar(16384), bdata bytea(2147483647), version int2, 
sdtype int2, sdmaxrevtime int8 /* {bytea=-2, int2=5, int8=-5, varchar=12
}

*/ /* index table_nodes_mod on public.table_nodes (modified ASC) other (#109582080, p623124), 
unique index table_nodes_pkey on public.table_nodes (id ASC) other (#109582080, p2389650), 
index table_nodes_sdm on public.table_nodes (sdmaxrevtime ASC) other (#109582080, p487463), 
index table_nodes_sdt on public.table_nodes (sdtype ASC) other (#109582080, p474156), 
index table_nodes_vsn on public.table_nodes (version ASC) other (#109582080, p473956) */",
"logger_name":"org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore",
"thread_name":"main","level":"INFO","level_value":20000}
Initialized DocumentNodeStore with clusterNodeId: 387, updateLimit: 100000 (id: 387, 
startTime: 1575386605462, machineId: mac:xxxxxxxxxxx, instanceId: /home/vcap/app, 
pid: 8, uuid: xxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxx, readWriteMode: null, leaseCheckMode: STRICT, 
state: ACTIVE, oakVersion: 1.10.2, formatVersion: 1.8.0)
4

1 回答 1

0

第一条消息的完整堆栈跟踪会很有帮助。您可能没有正确关闭系统,这会导致在下次启动时进行 LastRevRecovery 扫描。

最好通过正确关闭系统来避免该扫描。在 Oak 版本 >= 1.12.0 中扫描本身应该更快(请参阅https://issues.apache.org/jira/browse/OAK-8002)。

于 2019-12-04T10:07:30.027 回答