Skip to content
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

Liquibase update fails for Cassandra DataStax Astra. #73

Open
sync-by-unito bot opened this issue Apr 28, 2021 · 3 comments
Open

Liquibase update fails for Cassandra DataStax Astra. #73

sync-by-unito bot opened this issue Apr 28, 2021 · 3 comments

Comments

@sync-by-unito
Copy link

sync-by-unito bot commented Apr 28, 2021

Executing a Liquibase update to an Astra Cassandra instance fails. Although the keyspace is passed in the JDBC connection, Liquibase is not using it when attempting to create the databasechangelog/lock tables. The error returned is:

Update Error

{NOFORMAT}
Unexpected error running Liquibase: [Simba]CassandraJDBCDriver ERROR Invalid query: CREATE TABLE IF NOT EXISTS databasechangeloglock (ID INT, LOCKED BOOLEAN, LOCKGRANTED timestamp, LOCKEDBY TEXT, PRIMARY KEY (ID)), Cause: com.simba.cassandra.shaded.datastax.driver.core.exceptions.InvalidQueryException: No keyspace has been specified. USE a keyspace, or explicitly specify keyspace.tablename. [Failed SQL: (500211) CREATE TABLE IF NOT EXISTS databasechangeloglock (ID INT, LOCKED BOOLEAN, LOCKGRANTED timestamp, LOCKEDBY TEXT, PRIMARY KEY (ID))]
For more information, please use the --logLevel flag
{NOFORMAT}

Stack Trace

{NOFORMAT}
Caused by: com.simba.cassandra.support.exceptions.GeneralException: [Simba]CassandraJDBCDriver ERROR Invalid query: CREATE TABLE IF NOT EXISTS databasechangeloglock (ID INT, LOCKED BOOLEAN, LOCKGRANTED timestamp, LOCKEDBY TEXT, PRIMARY KEY (ID)), Cause: com.simba.cassandra.shaded.datastax.driver.core.exceptions.InvalidQueryException: No keyspace has been specified. USE a keyspace, or explicitly specify keyspace.tablename.
... 30 more
Caused by: com.simba.cassandra.shaded.datastax.driver.core.exceptions.InvalidQueryException: No keyspace has been specified. USE a keyspace, or explicitly specify keyspace.tablename
at com.simba.cassandra.shaded.datastax.driver.core.Responses$Error.asException(Responses.java:181)
at com.simba.cassandra.shaded.datastax.driver.core.DefaultResultSetFuture.onSet(DefaultResultSetFuture.java:215)
at com.simba.cassandra.shaded.datastax.driver.core.RequestHandler.setFinalResult(RequestHandler.java:235)
at com.simba.cassandra.shaded.datastax.driver.core.RequestHandler.access$2600(RequestHandler.java:61)
at com.simba.cassandra.shaded.datastax.driver.core.RequestHandler$SpeculativeExecution.setFinalResult(RequestHandler.java:1005)
at com.simba.cassandra.shaded.datastax.driver.core.RequestHandler$SpeculativeExecution.onSet(RequestHandler.java:808)
at com.simba.cassandra.shaded.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:1262)
at com.simba.cassandra.shaded.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:1180)
at com.simba.cassandra.shaded.io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335)
at com.simba.cassandra.shaded.io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335)
at com.simba.cassandra.shaded.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335)
at com.simba.cassandra.shaded.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:312)
at com.simba.cassandra.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:286)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335)
at com.simba.cassandra.shaded.io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
at com.simba.cassandra.shaded.datastax.driver.core.InboundTrafficMeter.channelRead(InboundTrafficMeter.java:38)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335)
at com.simba.cassandra.shaded.io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1337)
at com.simba.cassandra.shaded.io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1108)
at com.simba.cassandra.shaded.io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1151)
at com.simba.cassandra.shaded.io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:491)
at com.simba.cassandra.shaded.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:430)
at com.simba.cassandra.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335)
at com.simba.cassandra.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1304)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356)
at com.simba.cassandra.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
at com.simba.cassandra.shaded.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:921)
at com.simba.cassandra.shaded.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:135)
at com.simba.cassandra.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:646)
at com.simba.cassandra.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581)
at com.simba.cassandra.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498)
at com.simba.cassandra.shaded.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460)
at com.simba.cassandra.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131)
at com.simba.cassandra.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
{NOFORMAT}

Steps to Reproduce

  1. Ensure you have a Cassandra database running on Datastax Astra.
  • Follow the Datastax Astra instructions to get the Java driver security bundle.
  • Follow the Datastax Astra instructions on how to generate an access token; username and password are no longer sufficient to connect to the Astra instance.
  • Download the Cassandra JDBC driver and put it in the liquibase/lib directory.
  • Download the latest version of liquibase-cassandra and put it in the liquibase/lib directory.
  1. Create a keyspace on your Astra instance OR get the name of an existing keyspace to use in the test.
  2. Update the Liquibase properties file to include the driver class and connection URL. For example,
    {CODE}
    driver: com.simba.cassandra.jdbc42.Driver
    url:jdbc:cassandra://hostnameOfAstraInstance:portOfAstraInstance/;AuthMech=2;UID=;PWD=;SecureConnectionBundlePath=secure-connect-erzcassandra01.zip;TunableConsistency=6
    {CODE}
  3. Execute a Liquibase update. For example:
    {NOFORMAT}
    liquibase --logLevel=FINE --logFile=27IV21.txt --changeLogFile=cassandra_simple_changelog.xml update
    {NOFORMAT}

Expected Results

The update succeeds without error.

Actual Results

The update fails with the error message above.

┆Issue is synchronized with this Jira Bug by Unito

@sync-by-unito
Copy link
Author

sync-by-unito bot commented Apr 28, 2021

➤ Oleh Kushniryk commented:

Erzsebet Carmean URL syntax for cassandra extension should be different, docs need to be apdated
https://datical.atlassian.net/browse/PD-1585 ( https://datical.atlassian.net/browse/PD-1585|smart-link )

@sync-by-unito
Copy link
Author

sync-by-unito bot commented Apr 28, 2021

➤ Erzsebet Carmean commented:

Oleh Kushniryk, thank you! I tried adding DefaultKeyspace to the URL prior to writing up this bug. I tried again after seeing your comment but I get the same error.

Here is my URL:
{CODE}
url:jdbc:cassandra://cassandra.db.astra.datastax.com:PORT/DefaultKeyspace=posts_db;AuthMech=2;UID=clientKey;PWD=clientSecret;SecureConnectionBundlePath=secure-connect-erzcassandra01.zip;TunableConsistency=6
{CODE}

Do you see a mistake in the structure of that connection string?

@sync-by-unito
Copy link
Author

sync-by-unito bot commented Apr 28, 2021

➤ Oleh Kushniryk commented:

semicolon instead of slash after port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants