我有一份工作,执行时会获得liquibase db lock。如果出现问题,则在不释放锁定的情况下退出作业。所以我需要在失败时触发下一个作业,以便它解锁数据库,使用数据库的其他作业不会因为这个锁而引发错误。
......
[ERROR]: Unexpected error running Liquibase: Could not acquire change log lock. Currently locked by srvcldpcld262 since 4/28/17 8:40 AM
[ERROR]: SEVERE 4/28/17 10:48 AM: liquibase: Could not acquire change log lock. Currently locked by srvcldpcld262 since 4/28/17 8:40 AM
[ERROR]: liquibase.exception.LockException: Could not acquire change log lock. Currently locked by srvcldpcld262 since 4/28/17 8:40 AM
[ERROR]: at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:173)
[ERROR]: at liquibase.Liquibase.update(Liquibase.java:182)
[ERROR]: at liquibase.Liquibase.update(Liquibase.java:174)
[ERROR]: at liquibase.integration.commandline.Main.doMigration(Main.java:997)
...........
错误将如上所述。现在我已经配置了一个条件步骤,它将运行正则表达式匹配,如下所示:
Expression: ^.*\s.*Could not acquire change log lock.*\s\[.*\s*
Label: ${BUILD_LOG_REGEX,regex="Could\snot\sacquire\schange\slog\slock"}
执行时,日志如下:
Regular expression run condition: Expression=[Could\snot\sacquire\schange\slog\slock], Label=[[...truncated 1841 lines...]
[ERROR]: Unexpected error running Liquibase: Could not acquire change log lock. Currently locked by srvcldpcld262 since 4/28/17 11:58 AM
[ERROR]: SEVERE 4/28/17 12:13 PM: liquibase: Could not acquire change log lock. Currently locked by srvcldpcld262 since 4/28/17 11:58 AM
[ERROR]: liquibase.exception.LockException: Could not acquire change log lock. Currently locked by srvcldpcld262 since 4/28/17 11:58 AM
[...truncated 212 lines...]
]
Run condition [Regular expression match] preventing perform for step [Trigger/call builds on other projects]
您能否请求标签和表达部分如何配置?提前谢谢。
答案 0 :(得分:0)
问题是表达式和标签不匹配。 Exp:。 MATCH。 标签:$ {BUILD_LOG_REGEX,正则表达式="无法获取更改日志锁定",linesBefore = 0,linesAfter = 0,maxMatches = 1,showTruncatedLines = false,escapeHtml = true,substText =" MATCH&# 34;,addNewline = false} 我们不得不寻找"无法获得更改日志锁定"在构建日志中,然后执行操作。请注意标签内的表达式是使用java表达式lang推导出来的。 subsText和Exp应匹配意味着包含文本的整行#34;无法获取更改日志锁定"将被#34; MATCH"关键词。添加addNewline后,在日志中进行grepping后,添加了新行。