Uploaded image for project: 'Agroal'
  1. Agroal
  2. AG-218

Connection validator is always empty if properties being read from file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.3
    • None
    • None
    • None
    • False
    • None
    • False

      Repro

      prop file like

       

      org.infinispan.agroal.minSize=2
      org.infinispan.agroal.maxSize=8
      org.infinispan.agroal.initialSize=2
      org.infinispan.agroal.acquisitionTimeout=PT5S
      org.infinispan.agroal.validationTimeout=PT10S
      org.infinispan.agroal.reapTimeout=PT5M
      org.infinispan.agroal.jdbcUrl=jdbc:postgresql://postgres:5432/infinispan
      org.infinispan.agroal.providerClassName=org.postgresql.Driver
      org.infinispan.agroal.principal=postgres
      org.infinispan.agroal.credential=postgres

      then read properties from the props file (this is how Infinispan reads them)

      dataSource = AgroalDataSource.from(new AgroalPropertiesReader(PROPERTIES_PREFIX).readProperties(propsFile));

      Expected

      validation occurs and WORKS on invalid connections 

      Actual

      validation occurs and ALWAYS succeeds even for faulted connections as the validator defaults to "empty" which always returns `isValid = true` and failed connections never leave the pool.

      Workaround

      Instead of validationTimeout, set up maxLifetime.

      That way connections will be forcefully deleted from the pool regardless the fact they are closed or not, but at least there won't be an outage.

      Proposal

      Add the ability to parse validator from props, e.g.

      org.infinispan.agroal.validator=default

       

            lbarreiro-1 Luis Barreiro
            ayrat.hudaygulov@thriveglobal.com Ayrat Hudaygulov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: