You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/04/21 16:44:00 UTC

[jira] [Work logged] (ARTEMIS-2729) JdbcLeaseLock won't work on SQL Server

     [ https://issues.apache.org/jira/browse/ARTEMIS-2729?focusedWorklogId=425754&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-425754 ]

ASF GitHub Bot logged work on ARTEMIS-2729:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 21/Apr/20 16:43
            Start Date: 21/Apr/20 16:43
    Worklog Time Spent: 10m 
      Work Description: franz1981 opened a new pull request #3097:
URL: https://github.com/apache/activemq-artemis/pull/3097


   Interestingly TIMESTAMP is not a proper MSSQL data type for instants, but is used for table versioning instead: MSSQL should use DATATIME type instead.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 425754)
    Remaining Estimate: 0h
            Time Spent: 10m

> JdbcLeaseLock won't work on SQL Server
> --------------------------------------
>
>                 Key: ARTEMIS-2729
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2729
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 2.12.0
>            Reporter: Francesco Nigro
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When using JDBC on SQL server with HA; the broker fails during the initialization.
> {code:bash}
> $ ./artemis run
>      _        _               _
>     / \  ____| |_  ___ __  __(_) _____
>    / _ \|  _ \ __|/ _ \  \/  | |/  __/
>   / ___ \ | \/ |_/  __/ |\/| | |\___ \
>  /_/   \_\|   \__\____|_|  |_|_|/___ /
>  Apache ActiveMQ Artemis 2.13.0-SNAPSHOT
> 2020-04-21 15:02:30,058 INFO  [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting ActiveMQ Artemis Server
> 2020-04-21 15:02:32,607 INFO  [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,jdbcDriverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver,jdbcConnectionUrl=jdbc:sqlserver://localhost:1433;databaseName=amq,messageTableName=MESSAGE_TABLE,bindingsTableName=BINDINGS_TABLE,largeMessageTableName=LARGE_MESSAGES_TABLE,pageStoreTableName=PAGE_TABLE,)
> 2020-04-21 15:02:32,617 INFO  [org.apache.activemq.artemis.core.server] AMQ221006: Waiting to obtain live lock
> 2020-04-21 15:02:32,966 INFO  [org.apache.activemq.artemis.core.server] AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max size (-Xmx). being defined as 1,073,741,824
> 2020-04-21 15:02:33,113 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
> 2020-04-21 15:02:33,118 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
> 2020-04-21 15:02:33,121 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
> 2020-04-21 15:02:33,124 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT
> 2020-04-21 15:02:33,126 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support for: OPENWIRE
> 2020-04-21 15:02:33,128 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
> 2020-04-21 15:02:33,858 ERROR [org.apache.activemq.artemis.core.server] AMQ224000: Failure in initialisation: java.lang.IllegalStateException: com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from timestamp to TIMESTAMP is unsupported.
>         at org.apache.activemq.artemis.core.server.impl.jdbc.JdbcLeaseLock.checkValidHolderId(JdbcLeaseLock.java:262) [artemis-server-2.13.0-SNAPSHOT.jar:2.13.0-SNAPSHOT]
>         at org.apache.activemq.artemis.core.server.impl.jdbc.JdbcLeaseLock.isHeld(JdbcLeaseLock.java:216) [artemis-server-2.13.0-SNAPSHOT.jar:2.13.0-SNAPSHOT]
>         at org.apache.activemq.artemis.core.server.impl.jdbc.JdbcNodeManager.isBackupLive(JdbcNodeManager.java:270) [artemis-server-2.13.0-SNAPSHOT.jar:2.13.0-SNAPSHOT]
>         at org.apache.activemq.artemis.core.server.impl.SharedStoreLiveActivation.run(SharedStoreLiveActivation.java:58) [artemis-server-2.13.0-SNAPSHOT.jar:2.13.0-SNAPSHOT]
>         at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.internalStart(ActiveMQServerImpl.java:599) [artemis-server-2.13.0-SNAPSHOT.jar:2.13.0-SNAPSHOT]
>         at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.start(ActiveMQServerImpl.java:526) [artemis-server-2.13.0-SNAPSHOT.jar:2.13.0-SNAPSHOT]
>         at org.apache.activemq.artemis.integration.FileBroker.start(FileBroker.java:70) [artemis-cli-2.13.0-SNAPSHOT.jar:2.13.0-SNAPSHOT]
>         at org.apache.activemq.artemis.cli.commands.Run.execute(Run.java:84) [artemis-cli-2.13.0-SNAPSHOT.jar:2.13.0-SNAPSHOT]
>         at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:150) [artemis-cli-2.13.0-SNAPSHOT.jar:2.13.0-SNAPSHOT]
>         at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:98) [artemis-cli-2.13.0-SNAPSHOT.jar:2.13.0-SNAPSHOT]
>         at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:125) [artemis-cli-2.13.0-SNAPSHOT.jar:2.13.0-SNAPSHOT]
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_232]
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_232]
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_232]
>         at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_232]
>         at org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:129) [artemis-boot.jar:2.13.0-SNAPSHOT]
>         at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:49) [artemis-boot.jar:2.13.0-SNAPSHOT]
> Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from timestamp to TIMESTAMP is unsupported.
>         at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:234) [mssql-jdbc-8.2.2.jre8.jar:]
>         at com.microsoft.sqlserver.jdbc.DataTypes.throwConversionError(DataTypes.java:1112) [mssql-jdbc-8.2.2.jre8.jar:]
>         at com.microsoft.sqlserver.jdbc.ServerDTVImpl.getValue(dtv.java:3704) [mssql-jdbc-8.2.2.jre8.jar:]
>         at com.microsoft.sqlserver.jdbc.DTV.getValue(dtv.java:247) [mssql-jdbc-8.2.2.jre8.jar:]
>         at com.microsoft.sqlserver.jdbc.Column.getValue(Column.java:190) [mssql-jdbc-8.2.2.jre8.jar:]
>         at com.microsoft.sqlserver.jdbc.SQLServerResultSet.getValue(SQLServerResultSet.java:2053) [mssql-jdbc-8.2.2.jre8.jar:]
>         at com.microsoft.sqlserver.jdbc.SQLServerResultSet.getValue(SQLServerResultSet.java:2039) [mssql-jdbc-8.2.2.jre8.jar:]
>         at com.microsoft.sqlserver.jdbc.SQLServerResultSet.getTimestamp(SQLServerResultSet.java:2598) [mssql-jdbc-8.2.2.jre8.jar:]
>         at org.apache.activemq.artemis.core.server.impl.jdbc.JdbcLeaseLock.checkValidHolderId(JdbcLeaseLock.java:239) [artemis-server-2.13.0-SNAPSHOT.jar:2.13.0-SNAPSHOT]
>         ... 16 more
> {code}
> *+Steps to reproducer:+*
> 1. Create a SQL Server instance using podman
> {code:bash}
> #pull the sql server from docker hub
> podman pull mcr.microsoft.com/mssql/server:2017-latest
> #pull the sql server from docker hub
> podman run --name amq-mssql -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-latest
>  
> #Create database 'amq'
> podman exec -it amq-mssql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'yourStrong(!)Password'
> # Create amq db using sqlcmd
> 1> CREATE DATABASE amq
> 2> go
> # verify the amq db is created using sqlcmd
> 1> SELECT Name from sys.Databases
> 2> go
> {code}
> 2. using broker.xml.single, this works.
> {code:xml}
>     <store>
>        <database-store>
>           <jdbc-connection-url>jdbc:sqlserver://localhost:1433;databaseName=amq</jdbc-connection-url>
>           <jdbc-user>sa</jdbc-user>
>           <jdbc-password>yourStrong(!)Password</jdbc-password>
>           <bindings-table-name>BINDINGS_TABLE</bindings-table-name>
>           <message-table-name>MESSAGE_TABLE</message-table-name>
>           <large-message-table-name>LARGE_MESSAGES_TABLE</large-message-table-name>
>           <page-store-table-name>PAGE_TABLE</page-store-table-name>
>           <node-manager-store-table-name>NODE_MANAGER_TABLE</node-manager-store-table-name>
>           <jdbc-driver-class-name>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc-driver-class-name>
>           <jdbc-network-timeout>10000</jdbc-network-timeout>
>           <jdbc-lock-renew-period>2000</jdbc-lock-renew-period>
>           <jdbc-lock-expiration>15000</jdbc-lock-expiration>
>           <jdbc-journal-sync-period>5</jdbc-journal-sync-period>
>        </database-store>
>     </store>
> {code}
> 3. using broker.xml.ha, this fails
>      
> {code:xml}
> <ha-policy>
>             <shared-store>
>                 <master>
> 			<failover-on-shutdown>true</failover-on-shutdown>
>                 </master>
>             </shared-store>
>         </ha-policy>
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)