4 Replies Latest reply on Apr 20, 2012 2:41 PM by Steven Hawkins

    can we get org.teiid.translator.ExecutionContext.getRequestIdentifier() value similar to Statement.getWarnings()

    Vineela Gampa Novice

      Hi Steve,

       

      we need access to requestIdentifier from executionContext similar to warnings. I saw there exists a method org.teiid.jdbc.TeiidStatement.getRequestIdentifier() but when i looked at the implementation it basically starts with a value of 0 and increments everytiem you execute a query.

       

      Is there a way we get to have the value of requestIdenfier of executionContext in TeiidStatement ?

        • 1. Re: can we get org.teiid.translator.ExecutionContext.getRequestIdentifier() value similar to Statement.getWarnings()
          Steven Hawkins Master

          Vineela,

           

          The requestId is a combination of the session id and the execution id.  You can get the session id from "SELECT session_id()" or by unWrapping the Connection to a org.teiid.jdbc.ConnectionImpl and calling getConnectionId().  It would be useful though to add a method that provides that information easily, can you log a JIRA?

           

          Steve

          • 3. Re: can we get org.teiid.translator.ExecutionContext.getRequestIdentifier() value similar to Statement.getWarnings()
            Vineela Gampa Novice

            Hi Steve,

             

            I didnt see them matching. Below is what i got :

            ConenctionId is obtained as below :

             

            if (statement instanceof Statement && statement.isWrapperFor(TeiidStatement.class))

                {

                    final TeiidStatement st = statement.unwrap(TeiidStatement.class);

                    final Connection stCon = st.getConnection();

                    if (stCon.isWrapperFor(org.teiid.jdbc.ConnectionImpl.class))

                    {

                        final org.teiid.jdbc.ConnectionImpl conImpl =

                                stCon.unwrap(org.teiid.jdbc.ConnectionImpl.class);

                        System.err.println("ConnectionId ::" + conImpl.getConnectionId());

             

                    }

                    System.err.println("DB Executor requestIDentifier ::" + st != null

                                                                                      ? st.getRequestIdentifier()

                                                                                      : "");

                }

                                           

            connectionID values i got during exeuction

                                           

            ConnectionId ::ROOlZ7a9VZGo

            ConnectionId ::ZIuV9ovTTH2+

            ConnectionId ::OGvUciVZX66A

                                           

            Iam logging the below from executionContext :

             

            System.err.println("getRequestIdentifier::" + context.getRequestIdentifier());

            System.err.println("getPartIdentifier ::" + context.getPartIdentifier());

            System.err.println("getConnectionIdentifier ::" + context.getConnectorIdentifier());

            System.err.println("getConnectionIdentifier ::" + context.getConnectionIdentifier());

            System.err.println("getExecutionCountIdentifier ::" + context.getExecutionCountIdentifier());

             

            [10:45:56.465][info][talledLocalContainer] 20 Apr 2012 10:45:56,465 PDT INFO  [CleanupActivity] alerts.maxlimit is set to 500

            [10:47:13.725][info][talledLocalContainer] 20 Apr 2012 10:47:13,725 PDT ERROR [STDERR] getRequestIdentifier::54wcIGV33vF7.0

            [10:47:13.725][info][talledLocalContainer] 20 Apr 2012 10:47:13,725 PDT ERROR [STDERR] getPartIdentifier ::4

            [10:47:13.726][info][talledLocalContainer] 20 Apr 2012 10:47:13,726 PDT ERROR [STDERR] getConnectionIdentifier ::demo

            [10:47:13.726][info][talledLocalContainer] 20 Apr 2012 10:47:13,726 PDT ERROR [STDERR] getConnectionIdentifier ::54wcIGV33vF7

            [10:47:13.726][info][talledLocalContainer] 20 Apr 2012 10:47:13,726 PDT ERROR [STDERR] getExecutionCountIdentifier ::78

            [10:47:14.165][info][talledLocalContainer] 20 Apr 2012 10:47:14,165 PDT ERROR [STDERR] getRequestIdentifier::54wcIGV33vF7.0

            [10:47:14.165][info][talledLocalContainer] 20 Apr 2012 10:47:14,165 PDT ERROR [STDERR] getPartIdentifier ::4

            [10:47:14.165][info][talledLocalContainer] 20 Apr 2012 10:47:14,165 PDT ERROR [STDERR] getConnectionIdentifier ::demo

            [10:47:14.165][info][talledLocalContainer] 20 Apr 2012 10:47:14,165 PDT ERROR [STDERR] getConnectionIdentifier ::54wcIGV33vF7

            [10:47:14.165][info][talledLocalContainer] 20 Apr 2012 10:47:14,165 PDT ERROR [STDERR] getExecutionCountIdentifier ::78

            [10:47:14.344][info][talledLocalContainer] 20 Apr 2012 10:47:14,344 PDT ERROR [STDERR] getRequestIdentifier::54wcIGV33vF7.0

            [10:47:14.344][info][talledLocalContainer] 20 Apr 2012 10:47:14,344 PDT ERROR [STDERR] getPartIdentifier ::4

            [10:47:14.345][info][talledLocalContainer] 20 Apr 2012 10:47:14,344 PDT ERROR [STDERR] getConnectionIdentifier ::demo

            [10:47:14.345][info][talledLocalContainer] 20 Apr 2012 10:47:14,345 PDT ERROR [STDERR] getConnectionIdentifier ::54wcIGV33vF7

            [10:47:14.345][info][talledLocalContainer] 20 Apr 2012 10:47:14,345 PDT ERROR [STDERR] getExecutionCountIdentifier ::78

            [10:47:15.045][info][talledLocalContainer] 20 Apr 2012 10:47:15,045 PDT ERROR [STDERR] getRequestIdentifier::zujZEpnUA+f8.0

            [10:47:15.045][info][talledLocalContainer] 20 Apr 2012 10:47:15,045 PDT ERROR [STDERR] getPartIdentifier ::3

            [10:47:15.045][info][talledLocalContainer] 20 Apr 2012 10:47:15,045 PDT ERROR [STDERR] getConnectionIdentifier ::demo

            [10:47:15.045][info][talledLocalContainer] 20 Apr 2012 10:47:15,045 PDT ERROR [STDERR] getConnectionIdentifier ::zujZEpnUA+f8

            [10:47:15.046][info][talledLocalContainer] 20 Apr 2012 10:47:15,045 PDT ERROR [STDERR] getExecutionCountIdentifier ::80

            [10:47:15.248][info][talledLocalContainer] 20 Apr 2012 10:47:15,248 PDT ERROR [STDERR] getRequestIdentifier::zujZEpnUA+f8.0

            [10:47:15.248][info][talledLocalContainer] 20 Apr 2012 10:47:15,248 PDT ERROR [STDERR] getPartIdentifier ::3

            [10:47:15.248][info][talledLocalContainer] 20 Apr 2012 10:47:15,248 PDT ERROR [STDERR] getConnectionIdentifier ::demo

            [10:47:15.248][info][talledLocalContainer] 20 Apr 2012 10:47:15,248 PDT ERROR [STDERR] getConnectionIdentifier ::zujZEpnUA+f8

            [10:47:15.248][info][talledLocalContainer] 20 Apr 2012 10:47:15,248 PDT ERROR [STDERR] getExecutionCountIdentifier ::80

            [10:47:15.283][info][talledLocalContainer] 20 Apr 2012 10:47:15,283 PDT ERROR [STDERR] getRequestIdentifier::zujZEpnUA+f8.0

            [10:47:15.283][info][talledLocalContainer] 20 Apr 2012 10:47:15,283 PDT ERROR [STDERR] getPartIdentifier ::3

            [10:47:15.283][info][talledLocalContainer] 20 Apr 2012 10:47:15,283 PDT ERROR [STDERR] getConnectionIdentifier ::demo

            [10:47:15.284][info][talledLocalContainer] 20 Apr 2012 10:47:15,284 PDT ERROR [STDERR] getConnectionIdentifier ::zujZEpnUA+f8

            [10:47:15.284][info][talledLocalContainer] 20 Apr 2012 10:47:15,284 PDT ERROR [STDERR] getExecutionCountIdentifier ::80

            • 4. Re: can we get org.teiid.translator.ExecutionContext.getRequestIdentifier() value similar to Statement.getWarnings()
              Steven Hawkins Master

              On the client you are showing 3 sessions.  And on the source you are showing 2 different sessions.  If this is from a recursive translator case, then you may have to correlate the sessions through an intermediate session.

               

              Also be sure to consult the ExecutionContext javadocs for what the methods return.  You have misidentified getConnectorIdentifier as getConnectionIdentifier.  Also getExecutionConutIdentifier is unique to each source execution and the part identifier corrleates the to plan.

               

              Steve