Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-865

Timestamp rounding issues on Microsoft SQL Server

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • 7.0.0.DR10
    • 7.0.0.DR9
    • EJB
    • None

    Description

      The DATETIME datatype in SQL Server has a precision of ~0.003 seconds.
      It sometimes can happen that an EJB timer gets scheduled to a timestamp which will get rounded after its insertion into the database, because the timestamps are generated with precision to miliseconds.
      After that, the timer service will be unable to locate this row, because it attempts to select using WHERE NEXT_DATE=$timestamp, where $timestamp is the original unrounded java.sql.Timestamp, and this condition no longer holds true.

      After a timer is scheduled to go off at such unfortunate timestamp, it will never go off again.

      The solution is to either truncate the milisecond part, or to use the newer DATETIME2 datatype, which has an accuracy of 100 nanoseconds (https://msdn.microsoft.com/en-us/library/bb677335.aspx). DATETIME2 is supported on SQL Server 2008+.

      Attachments

        Issue Links

          Activity

            People

              jmartisk@redhat.com Jan Martiska
              jmartisk@redhat.com Jan Martiska
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: