question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cacheSize of createSequence is ignored

See original GitHub issue

Environment

Liquibase Version: 4.4.3

Liquibase Integration & Version: quarkus 2.3.0.Final

Liquibase Extension(s) & Version: liquibase-core only

Database Vendor & Version: MariaDB 10.6.4

Operating System Type & Version: Windows 10

Description

The Attribute cacheSize of createSequence seems to be ignored.

Steps To Reproduce

Run the following changesets:

    <changeSet id="working" author="mickroll">
        <createSequence sequenceName="SEQ_WORKING"
                            startValue="10000000"
                            incrementBy="1" />
        <sql dbms="mysql,mariadb">ALTER SEQUENCE SEQ_WORKING CACHE=5;</sql>
    </changeSet>
    <changeSet id="attribute" author="mickroll">
        <createSequence sequenceName="SEQ_SET"
                            startValue="10000000"
                            incrementBy="1"
                            cacheSize="5" />
    </changeSet>
    <changeSet id="default" author="mickroll">
        <createSequence sequenceName="SEQ_DEFAULT"
                            startValue="10000000"
                            incrementBy="1" />
    </changeSet>
  • changeset working shows the wanted end result
  • changeset attribute shows usage of createSequence cacheSize (which will be ignored)
  • changeset default shows the default value of cacheSize (as defined by the database, i guess)

Now run the following SQL on the database to extract the results (or view the created sequences in the db client of our choice):

SELECT (SELECT cache_size FROM SEQ_WORKING) AS "working",
       (SELECT cache_size FROM SEQ_SET) AS "set with attribute",
       (SELECT cache_size FROM SEQ_DEFAULT) AS "default";

Actual Behavior

  • working = 5 (as expected)
  • set with attribute = 1000 (bug)
  • default = 1000 (shows default value)

Expected/Desired Behavior

  • set with attribute = 5 (as defined by the attribute cacheSize of createSequence tag)

Screenshots (if appropriate)

grafik

Additional Context

Doesn’t work, either: <alterSequence sequenceName="SEQ_SET" cacheSize="5"/>

┆Issue is synchronized with this Jira Story by Unito

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
nvoxlandcommented, Dec 13, 2021

It may be better to have more function checks like that vs instanceof. The trouble is that there is sort of an unlimited variation in what features are supported and not supported across the databases and also we hit variations in the SQL to generate depending on the database as well.

We’re looking at some refactoring to make that all work better, but it’s a medium-term project. In the meantime, I opened a PR that handles it the current way.

0reactions
mickrollcommented, Dec 15, 2021

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

createSequence | Liquibase Docs
The createSequence changetype creates a new database sequence. ... cacheSize, Number of values to fetch per query, asany, db2, db2z, derby, h2, hsqldb, ......
Read more >
SEQUENCE Cache - Ask TOM
Now we have seen sequence contention.can we avoid it by increasing cache size to 2000 or 3000 ??? CREATE SEQUENCE SEQ_batch_inst1
Read more >
How does the CACHE option of CREATE SEQUENCE work?
This paragraph in the doc is very helpful: For an example, a new sequence is created with a starting value of 1 and...
Read more >
Cluster.Sequence.createSequence() - TIBCO Software
Creates a sequence across the cluster. If the sequence already exists, the call is ignored internally. Parameters. Name, Type, Description. sequenceName ...
Read more >
sql server - Sequence - NO CACHE vs CACHE 1
I used this code to test for no cache and cache size of 1 and 4. ... CAST(@@SPID AS NVARCHAR(max))); EXEC (@S); GO...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found