New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Execution/processing time for initial databasechangelog read is excessive when switching from v3.5.3 to v4.17.2 #3816
Comments
I am experiencing the same problem with Postgres database and Liquibase version 4.18.0 on localhost (Docker container) and also in cloud environment (Bitbucket pipeline default runner). There is a part of log output: |
We have been working on performance improvements over the last couple releases, including 4.19.0 and 4.19.1 which should come out next week. Would you be able to run liquibase with the |
I sent the .jfr via email. Thanks! |
I sent a new zipped version of the file via email. thanks! |
I was able to get the new jfr file to load, @doakd. Thanks! It looks like the time is primarily spent in DatabaseChangelog.normalizePath()'s replaceAll() calls. There was a performance fix in 4.15.0 in this method with #3063 but it looks like there is more to do with it. I'd guess calls to that method need to be combined/cached/removed vs. just optimizing the call itself. We could also replace some (or all?) of the regexp replacements with a more simple char replacement which will perform a lot better given that this is a commonly called function. The performance is likely getting worse based on the number of changesets in your databasechangelog file (including any included files). Do you have a general count of what you have for reference? |
@nvoxland Unfortunately the zip was removed from the email by my company. I replied to your email also. There are 1774 changesets in the databasechangelog table. The current folder structure looks like this:
There are 389 total folders: 112 folders with 277 subfolders. They add new folders for each deployment. Hope this makes sense. |
@nvoxland Starting Liquibase at 06:53:31 (version [Core: //normalizePath-performance/7520/670753/2023-02-22 16:59+0000, Pro: master/2787/e6eff1/2023-02-20T17:19:52Z] #7520 built at 2023-02-22 16:59+0000) |
Thanks @doakd . It looks like the validation failed and execution stopped vs. correctly generating the SQL? Could you send me the complete log (especially the validation failed error and stacktrace) and a new --monitor-performance output? |
I sent the new jfr and output via email. The changelogs unfortunately have some validation issues that I can't correct. Hopefully that not an issue. If it is I'll work with the developer to see how I can get a clean test. Thanks. |
I wouldn't think #3853 would impact validation, but sometimes there unexpected results. If you are seeing the validation errors only with the snapshot jar, let me know and I can help look into it. The new profile report has the remaining spent time solidly in the "compute the checksums for sql changes". I think that will be addressed with #3616 which will hopefully be merged soon. That PR does makes a variety of changes to the checksum calculation logic, including a significant streamlining of the checksum logic for sql changes. Its enough of a change that we upgrade the "checksum version" which makes swapping between versions a bit odd, and it won't have the change from #3853 in it, so it's hard to get you a build with those two changes in there. Based on your performance log, though, I think it should resolve most of the remaining slowness. |
Yes it turns out that only the new version gets the validation error. I'll let the customer know that a potential fix is coming soon. Thanks. |
Can you list what the validation error is? Is it a "duplicate changeset" error" Or something else? |
I resolved the validation issue, and sent you an updated log and jfr via email. Read time is at 13 minutes. |
Yes, the validation error was a duplicate changeset. Just ran update-sql again on 4.17.2, took a little less than 10 minutes: [2023-02-27 23:21:41] INFO [liquibase.changelog] Reading from TPPONPREMDEV.DATABASECHANGELOG |
I don't know the issue numbers that were in the jar that @nvoxland had me download. |
Hello @doakd - would you be able to run a test using Liquibase 4.16.1 ? We had some breaking changes on 4.17.0 and I believe it may be related to this problem, but would like to confirm that. |
@filipelautert You are correct, works fine in v4.16.1: Starting Liquibase at 09:45:35 (version 4.16.1 #4594 built at 2022-09-14 15:27+0000) |
Hello @doakd - do you mind running 4.20.0 it in debug (--log-level=debug) and send me the results at ... ? Then we can take from there. |
@filipelautert I ran v4.20.0, it's back to 13 minutes, and all of the time was spent on computing checksums, like this: [2023-03-14 11:17:50] FINE [liquibase.util] Computed checksum for inputStream as b2abdd9fa353eb4ec5d250a84a9b4d1d I reran v4.16.1 with debug, the compute checksum step took 35 seconds for the exact same files. |
@filipelautert Can you tell me what the next steps are on this? |
Hello @doakd - PR #3853 was merged to master. You can get the jar here -> https://github.com/liquibase/liquibase/suites/11640405747/artifacts/604371760 . Can you use it and check if there are any changes? Also can you send me the jfr file at flautert@liquibase.org ? |
@filipelautert I'm getting a 404 when I try to follow that link. |
Hello @doakd - this is the updated link: https://github.com/liquibase/liquibase/suites/11771216072/artifacts/613789067 |
@filipelautert I don't know what to do with all of the files in that zip. I'm not a java programmer, I'm just an Oracle DBA. LOL |
haha no problems @doakd ! Inside the zip file you may find liquibase-core-0-SNAPSHOT.jar . Just replace the liquibase-core.jar that you are using with this one and you'll be able to test it. |
@filipelautert Still took 11 minutes. files sent via email. |
@filipelautert I replied to your email that I was not able to download using the link you provided. |
Starting Liquibase at 09:31:18 (version [Core: //DAT-13285/8989/b241e5/2023-04-11 20:37+0000, Pro: master/2922/ef3bc8/2023-03-07T16:20:38Z] #8989 built at 2023-04-11 20:37+0000) |
I experience similar situation to the one described by doakd. I can only provide partial data but maybe it will be useful.
In my setup, I spawn multiple Liquibase instances and migrate multiple hosts in parallel. |
just upgraded to v4.21.1, same problem exists. 10 minutes reading changelog: Starting Liquibase at 17:25:49 (version 4.21.1 #9070 built at 2023-04-13 20:56+0000) UPDATE SUMMARY
|
I also encountered this issue: we had updated |
Upgraded to Liquibase 4.23.1, still having the issue: Starting Liquibase at 19:28:00 (version 4.23.1 #12042 built at 2023-08-10 13:48+0000)
|
@rafaelsms - your problem may be related to #4957 . |
@filipelautert Thanks for the update. I can confirm it is fixed. |
Environment
Liquibase Version:
old: v3.5.3
new: v4.17.2
Liquibase Integration & Version: <Pick one: CLI, maven, gradle, spring boot, servlet, etc.>
CLI
Liquibase Extension(s) & Version:
Database Vendor & Version:
Oracle 19c
Operating System Type & Version:
Linux
Infrastructure Type/Provider: <AWC, GCS, Azure, VM, etc>
On-Prem
Description
A customer is updating from a v3.5.3 "self-supported" Liquibase solution to our v4.17.2 "officially-supported" Liquibase solution.
Using the same changelogs and database/schema:
In v3.5.3, the initial "Reading from databasechangelog" step is taking 1 second.
In v4.17.2 the initial "Reading from databasechangelog" step is taking 10 minutes, and consistently takes this long. I monitored in the database and the actual query is taking < 1 second, so I believe the additional time is spent in Liquibase code.
I also had then purge the databasechangelog table of v.3.5.3 records, and run v4.17.2 "changelog-sync" to repopulate, didn't help.
Steps To Reproduce
Actual Behavior
Expected/Desired Behavior
The "Reading from databasechangelog" should be approximately the same between v3.5.3 and v4.17.2
Screenshots (if appropriate)
v3.5.3 output:
INFO 2/9/23 10:39 AM: liquibase: Reading from TPPONPREMDEV.DATABASECHANGELOG
DEBUG 2/9/23 10:39 AM: liquibase: Executing QUERY database command: SELECT * FROM TPPONPREMDEV.DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
DEBUG 2/9/23 10:39 AM: liquibase: master.xml: session-start/metadata.xml::alter_session_start::Ebix: Computed checksum for inputStream as d2a9c9002a66f9fe4e8c4aa41810b63c
v4.17.2 output:
[2023-02-14 22:01:01] INFO [liquibase.lockservice] Successfully acquired change log lock
[2023-02-14 22:01:08] INFO [liquibase.changelog] Reading from TPPONPREMDEV.DATABASECHANGELOG
[2023-02-14 22:11:17] INFO [liquibase.lockservice] Successfully released change log lock
Liquibase command 'update' was executed successfully.
Additional Context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: