Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-912

Pass URL connection properties to avatica server


    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.0-incubating
    • Fix Version/s: 1.5.0
    • Component/s: avatica
    • Labels:
    • Flags:


      This ticket proposes the ability to pass connection-creation-time properties (the "info") from the remote avatica driver to the avatica server.

      Use cases:

      • Phoenix properties like CurrentSCN and TenantId (and similar use-cases for a custom driver at the company I work for)
      • user and password properties (enables authentication, cfr. CALCITE-519 and CALCITE-643)

      See also discussion on mailing list:

      Things to consider:

      • The remote driver might have its own properties (like "url") which should not be passed to the server. Remote driver is responsible for removing those.
      • The server might want to disallow setting some properties remotely, e.g. to not allow to connect to a different database.

      Currently the avatica server creates a default connection (though it is marked for removal). When using authentication, this is particularly annoying, since you need to start up the server with an url containing user and password.

      I will attach a patch, based on calcite 1.4, which adds the ability to pass properties as part of a new OpenConnectionRequest rpc call (a CreationConnetionRequest was proposed for different reasons in CALCITE-663). For the authentication reason mentioned, the default connection is also dropped. There is one JdbcMeta instance on the server side, but it manages a map of connections. Since connections were already created per client-side connection, this is not different than before, except that the connections are now created explicitly. Implicit connection creation has been dropped, we can look into auto-recreation of the connection as part of recovery (CALCITE-903).

      The somewhat hacky things in the patch are:

      • addition of AvaticaConnection.setId(): this is because I let the server decide on the connection id. This seemed more logical to me at first, though it can be easily reversed.
      • remote.Driver which creates an extra service instance to be able to do the OpenConnection request, while all other requests happen from within RemoteMeta.

      The patch also passes error messages back to the client (a simple improvement towards CALCITE-645).

      Because the calls for metadata (such as getColumns) now also have a connection id, fixing CALCITE-871 becomes easy and I have a patch ready for that as well.

      If the patch is acceptable, I can rework it for master (now it is for 1.4).


          Issue Links



              • Assignee:
                bruno Bruno Dumon
                bruno Bruno Dumon
              • Votes:
                0 Vote for this issue
                5 Start watching this issue


                • Created: