GithubHelp home page GithubHelp logo

paypal / hera Goto Github PK

View Code? Open in Web Editor NEW
282.0 17.0 80.0 16.1 MB

High Efficiency Reliable Access to data stores

License: Apache License 2.0

Go 38.71% Java 33.48% Dockerfile 0.05% Shell 0.91% Makefile 0.05% C++ 20.98% C 1.74% Lua 3.56% Python 0.53%
mysql scalability databases mux oracle

hera's Introduction

Go Build Java CI with Maven License

Hera - High Efficiency Reliable Access to data stores

Hera multiplexes connections for MySQL, Oracle and PostgreSQL databases. It supports sharding the databases for horizontal scaling.

What is Hera

Hera is Data Access Gateway that helps to enable scaling and improving the availability of databases.

  • Protects the database from resource exhaustion by evicting poorly performing queries
  • Intelligently routes read/write traffic appropriately for better load balancing
  • Improves tolerance to database outages
  • Provides high performance secured connections between applications and Hera
  • Provides domain agnostic database sharding for horizontal database scaling
  • Automatic transaction application failover between replica databases
  • And many more site resiliency features

Getting Started

You can build mux using either Docker or manual build.

Docker Build

For development, the following docker commands for the appropriate environment can help get started

Linux

git clone https://github.com/paypal/hera.git
docker run --network host --name mysql-11 -e MYSQL_ROOT_PASSWORD=62-AntHill -d mysql:latest
cd hera/tests/devdocker
docker exec -i mysql-11 mysql -u root -h 127.0.0.1 -p62-AntHill -t < sample.sql
mkdir -p src/github.com/paypal/hera
rsync -av --exclude tests/devdocker ../.. src/github.com/paypal/hera
docker build -t hera-oss .
docker run -it --rm --name testRunHeraOss --network host -e password=62-AntHill hera-oss

Mac

git clone https://github.com/paypal/hera.git
docker network create my-network
docker run --network my-network --name mysql-11 -e MYSQL_ROOT_PASSWORD=62-AntHill -d mysql:latest
cd hera/tests/devdocker
docker exec -i mysql-11 mysql -u root -h 127.0.0.1 -p62-AntHill -t < sample.sql
mkdir -p src/github.com/paypal/hera
rsync -av --exclude tests/devdocker ../.. src/github.com/paypal/hera
sed -i.bak -e 's/127.0.0.1/mysql-11/g' srv/start.sh
docker build -t hera-oss .
docker run -it --rm --name testRunHeraOss --network my-network -p 10101:10101 -e password=62-AntHill hera-oss

To test it, in a separate terminal:

docker exec -it testRunHeraOss /bin/bash
cd /go/src
go run github.com/paypal/hera/client/gosqldriver/tls/example/sample_main.go

Manual Build

The following sections explain the process for manually building mux without Docker. We only tested on RedHat and Ubuntu.

Install Dependencies

  1. Install Go 1.10+.
  2. Install MySQL, Oracle or PostgresSQL.
  3. Install the MySQL driver, Oracle driver and the PostgreSQL driver
  4. Install Oracle instant client.
  5. Install GCC.

Build Binaries

  1. Navigate to the working directory.

    cd $WORKSPACE
    export GOPATH=$WORKSPACE
    
  2. Option 1

    Clone the source code from github

    git clone https://github.com/paypal/hera src/github.com/paypal/hera
    

    Option 2

    (a) GO 1.12 is prerequisite

    (b) export GO111MODULE=on ( to enable the go mod feature)

    go get github.com/paypal/hera
    
  3. Install the dependencies: MySQL, Oracle and PostgreSQL driver

    cd src/github.com/paypal/hera
    go get github.com/go-sql-driver/mysql
    go get github.com/godror/godror
    go get github.com/lib/pq
    
  4. Build server binaries

    go install github.com/paypal/hera/mux github.com/paypal/hera/worker/mysqlworker github.com/paypal/hera/worker/oracleworker github.com/paypal/hera/worker/postgresworker
    
  5. Build Go test client

    go install github.com/paypal/hera/tests/e2e/client
    
  6. Build Java test client under the client/java directory

  7. Build the C++ oracleworker

    cd worker/cppworker/worker
    make -f ../build/makefile19
    

Running the server

To run mux there is minimal configuration required. Please see examples for running with MySQL or Oracle. The main configuration file is hera.txt, which must contain the TCP port where the server listens and the number of workers. The user name, password and the data source are passed via environment parameters.

    # the proxy executable
    ln -s $GOPATH/bin/mux .
    # the MySQL worker
    ln -s $GOPATH/bin/mysqlworker mysqlworker
    # to use the Oracle worker use oracleworker instead of mysqlworker

    # create the configuration file with the required configuration
    echo 'bind_ip=127.0.0.1' > hera.txt
    echo 'bind_port=11111' >> hera.txt
    echo 'opscfg.hera.server.max_connections=2' >> hera.txt
    # if using mysql run this
    # echo 'database_type=mysql' >> hera.txt
    # if using postgres run this
    # echo 'database_type=postgres' >> hera.txt

    # create minimal CAL configuration, needed by ops config
    echo 'cal_pool_name=stage_hera' > cal_client.txt

    # the database user name
    export username='user'
    # the database password
    export password='pass'
    # the data source
    export TWO_TASK='tcp(127.0.0.1:3306)/myschema'
    # for Oracle the datasource can be like '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=hostname)
    #    (PORT=12345)))(CONNECT_DATA=(SERVICE_NAME=sn)))'.
    # for Oracle only add to LD_LIBRARY_PATH environment variable the path to the shared libraries of the
    #    Oracle instant client
    # for postgress format can be like : export TWO_TASK='127.0.0.1:5432/user?connect_timeout=60'

    # start
    ./mux --name hera-test
    
    # to validate HERA is running fine tail 'state-log' file and check 2 connections in 'acpt' state.
    # 01/07/2022 18:28:39: -----------  init  acpt  wait  busy  schd  fnsh  quce  asgn  idle  bklg  strd
    # 01/07/2022 18:28:39: hera            0     2     0     0     0     0     0     0     0     0     0
    
    # incase connections are not in accept state, check the hera.log file for errors

For details about the parameters see configuration

Running the client

There is a Java client implemented as JDBC driver. Please see the documentation for how to install and use it.

There is also a Go client implemented as SQL driver. Please see the example.

License

Hera is licensed under Apache 2.0.

hera's People

Contributors

0xflotus avatar aditya-kapadiya avatar ajlin179 avatar allcentury avatar brianwang1217 avatar dependabot[bot] avatar jessichenpp avatar makii42 avatar manupatteri avatar modetchfill avatar nikhil2406 avatar pvoicu avatar rasamala83 avatar rohanmannem avatar rsh-yam avatar satyakamala03 avatar shtiencode avatar sssinghsyr avatar stephanievu avatar sur5an avatar varunitgithub avatar varuntechie avatar venkatsridhar95 avatar voicup avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hera's Issues

Binding name should be treated case-insensitive

What I Did
My codes:
stmt, _ := tx.PrepareContext(ctx, "/cmd/insert into test_simple_table_2 (accountID, Name, Status) VALUES(:accountID, :Name, :Status)")
_, err = stmt.Exec(sql.Named("accountID", "12345"), sql.Named("Name", "Steve"), sql.Named("status", "done"))

What I Expected
The above codes have ":Status" in PrepareContext and "status" (lower case) in stmt.Exec
I expect Hera to do case-insensitive matching check for binding name, query should be executed successfully

What I Saw Instead
Error: bindname not found in query: :status - processing 2 8:2 status,

Here is log:
14:22:33.483756 verbose: [WORKER shd3 0 workerservice.go:169] worker_sp0 : occworker read <<< 11:2 accountID,
14:22:33.483759 debug: [WORKER shd0 0 cmdprocessor.go:541] query result 236
14:22:33.483786 debug: [WORKER shd3 0 cmdprocessor.go:173] process command 11:2 accountID,
14:22:33.483826 verbose: [WORKER shd3 0 workerservice.go:169] worker_sp0 : occworker read <<< 7:3 12345,
14:22:33.483825 debug: [WORKER shd0 0 cmdprocessor.go:541] query result 1
14:22:33.483843 debug: [WORKER shd3 0 cmdprocessor.go:173] process command 7:3 12345,
14:22:33.483875 debug: [WORKER shd0 0 cmdprocessor.go:541] query result Y
14:22:33.483901 debug: [WORKER shd0 0 cmdprocessor.go:541] query result Y
14:22:33.483903 verbose: [WORKER shd3 0 cmdprocessor.go:313] BindValue: :accountID : 0 : {12345 true}
14:22:33.483921 verbose: [WORKER shd3 0 workerservice.go:169] worker_sp0 : occworker read <<< 6:2 Name,
14:22:33.483929 debug: [WORKER shd0 0 cmdprocessor.go:541] query result 237
14:22:33.483933 debug: [WORKER shd3 0 cmdprocessor.go:173] process command 6:2 Name,
14:22:33.483949 verbose: [WORKER shd3 0 workerservice.go:169] worker_sp0 : occworker read <<< 7:3 Steve,
14:22:33.483954 debug: [WORKER shd0 0 cmdprocessor.go:541] query result 2
14:22:33.483962 debug: [WORKER shd3 0 cmdprocessor.go:173] process command 7:3 Steve,
14:22:33.483978 debug: [WORKER shd0 0 cmdprocessor.go:541] query result Y
14:22:33.483998 verbose: [WORKER shd3 0 cmdprocessor.go:313] BindValue: :Name : 0 : {Steve true}
14:22:33.484002 debug: [WORKER shd0 0 cmdprocessor.go:541] query result Y
14:22:33.484015 verbose: [WORKER shd3 0 workerservice.go:169] worker_sp0 : occworker read <<< 8:2 status,
14:22:33.484028 debug: [WORKER shd3 0 cmdprocessor.go:173] process command 8:2 status,
14:22:33.484029 debug: [WORKER shd0 0 cmdprocessor.go:541] query result 238
14:22:33.484063 warn: [WORKER shd3 0 cmdprocessor.go:253] nonexisting bindname :status
14:22:33.484067 debug: [WORKER shd0 0 cmdprocessor.go:541] query result 3
14:22:33.484117 warn: [WORKER shd3 0 workerservice.go:181] Error: bindname not found in query: :status - processing 2 8:2 status,
14:22:33.484124 debug: [WORKER shd0 0 cmdprocessor.go:541] query result Y

Or when changing case for binding name from :accountID to AccountID, I get this error:
14:55:15.571877 debug: [WORKER shd3 0 cmdprocessor.go:173] process command 11:2 AccountID,
14:55:15.571915 warn: [WORKER shd3 0 cmdprocessor.go:253] nonexisting bindname :AccountID
14:55:15.571947 warn: [WORKER shd3 0 workerservice.go:181] Error: bindname not found in query: :AccountID - processing 2 11:2 AccountID,

Backlog eviction leaks goroutine

What I did
Using clients doing select-for-update on a locked, I created an overload and caused backlog evictions.

What I expect
The clients should timeout and get backlog eviction. The server should continue to run.

What I saw
The CalEvent GO stat shows increasing goroutines and rss memory usage.

Go client cannot "start transaction"

When I try to run a transaction with the go client, I expect it to open a db transaction.

I get a mysql error that the sql cannot be prepared.

Getting Started Docker Broken

What I Did

I tried following the Docker instructions in README.md

What I Expected

I wanted the container to startup Hera

What I Saw Instead

I couldn't get the path to the Dockerfile

Potential Solutions

The paths and other parts need to be fixed.

CLIENT_INFO in CAL log has status "unset"

What I Did
I send requests to server

What I See
unset is not expected as a "status" of CLIENT_INFO
17:06:54.75 CLIENT_INFO unset 0 mux&PoolStack=stvu.pg_occ:CalThreadId=0TopLevelTxnStartTime=TopLevelTxn not set*Host=hyperlvs19&corr_id=NotSet

What I Expect
unset should not be there, status of 0, or 1 or 2...should be seen

Update statement that doesn't changes anything fails for MySQL + Hibernate.

What I Did
Perform an entity update that internally fires an update statement. There were no changes to the entity, the operation then fails with this exception Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)

What I Expected
update should work even if there are no changes to the underlying record.

What I See
Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) : [com.kumbay.model.entity.Merchant#5976]
at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:2414)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3216)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3090)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3491)
at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:145)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:600)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:474)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:337)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1437)
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:494)
at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3245)
at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2451)
at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:473)
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:156)
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$100(JdbcResourceLocalTransactionCoordinatorImpl.java:38)
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:231)
at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:68)
at org.springframework.orm.hibernate5.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:582)

MySQL: worker restart on fatal errors

Upon receiving the following error code considered as fatal, restarting the workers.
Error| State | Description
1153 | 08S01 | ER_NET_PACKET_TOO_LARGE | Got a packet bigger than 'max_allowed_packet'
1154 | 08S01 | ER_NET_READ_ERROR_FROM_PIPE | Got a read error from the connection pipe
1155 | 08S01 | ER_NET_FCNTL_ERROR | Got an error from fcntl()
1156 | 08S01 | ER_NET_PACKETS_OUT_OF_ORDER | Got packets out of order
1157 | 08S01 | ER_NET_UNCOMPRESS_ERROR | Couldn't uncompress communication packet
1158 | 08S01 | ER_NET_READ_ERROR | Got an error reading communication packets
1159 | 08S01 | ER_NET_READ_INTERRUPTED | Got timeout reading communication packets
1160 | 08S01 | ER_NET_ERROR_ON_WRITE | Got an error writing communication packets
1161 | 08S01 | ER_NET_WRITE_INTERRUPTED | Got timeout writing communication packets
1317 | 70100 | ER_QUERY_INTERRUPTED | Query execution was interrupted
1836 | HY000 | ER_READ_ONLY_MODE | Running in read-only mode
1874 | HY000 | ER_INNODB_READ_ONLY | InnoDB is in read only mode
1878 | HY000 | ER_TEMP_FILE_WRITE_FAILURE | Temporary file write failure.

Race Condition causes error in client when Hera server is under capacity

What I Did
I ran longevity test with all MySQL operations (Select, Insert, update, delele) repeatedly with 10 threads
On Hera server side, I have 5 workers to serve the requests

What I Expected
Because Hera server was under capacity, I got lots of errors from client such as backlog timeout, saturation kill, soft eviction which is expected

What I Saw Instead
Beside errors such as backlog timeout, saturation kill, soft eviction, client also gets eror “Unknown Error cmd=5” when there is "multiple_client_req" is seen

Error in log:
21:38:42.926064 warn: [PROXY coordinator.go:775] doSession: multiple client req worker (type0,inst0,id2) 12942 1:9, reqns=360:0 16:2006 CorrId=null,183:25 insert /* EmployeeDao_insert_8_425075257 */ into EMPLOYEE...edate,2:3 ,5:2 job,9:3 B_17656,5:2 mgr,4:3 55,5:2 sal,8:3 8000.0,7:2 empno,7:3 17656,1:4,, reqcorrid=16:2006 CorrId=null,

Race Condition causes error in clients when server is running with enough capacity

What I Did
I ran longevity test with all MySQL operations (Select, Insert, update, delele) repeatedly with 10 threads
On Hera server side, I have 12 workers to serve the requests

What I Expected
The Client should not get any error except timeout error occasionally

What I Saw Instead
Client got error “Unknown Error cmd=5” when "multiple_client_req" events were seen

Error in log:
07:14:03.150861 warn: [PROXY coordinator.go:775] doSession: multiple client req worker (type0,inst0,id9) 18012 196:0 24:2006 CorrId=156968004271,100:25 INSERT INTO /* EmployeeDDRMap.INSERTPK.-2 / DALC... NAME) VALUES (:id, :name) ,4:2 id,8:3 892864,6:2 name,22:3 employee_ddr_2892864,1:4,1:8,, reqns=196:0 24:2006 CorrId=156968004276,100:25 INSERT INTO / EmployeeDDRMap.INSERTPK.-2 / DALC... NAME) VALUES (:id, :name) ,4:2 id,8:3 892860,6:2 name,22:3 employee_ddr_2892860,1:4,1:8,, reqcorrid=24:2006 CorrId=156968004276,
07:30:34.176502 warn: [PROXY coordinator.go:775] doSession: multiple client req worker (type0,inst0,id7) 26203 143:0 24:2006 CorrId=156968103477,83:25 DELETE FROM /
EmployeeDDRMap.DELETEPK.-1 / DALCERT_EMPLOYEE_DDR WHERE ID = :id,4:2 id,8:3 921317,1:4,1:8,, reqns=196:0 24:2006 CorrId=156968103376,100:25 INSERT INTO / EmployeeDDRMap.INSERTPK.-2 */ DALC... NAME) VALUES (:id, :name) ,4:2 id,8:3 921312,6:2 name,22:3 employee_ddr_3921312,1:4,1:8,, reqcorrid=24:2006 CorrId=156968103376,

Allow Failover Configuration

What I Did

I setup a basic MySQL DB and a standby read replica.

What I See

I can configure Hera to use the active DB, but I can't configure an automatic failover.

What I Expect

Some sort of failover from the active DB to the standby read replica that reduce the amount of reconfiguration and restarts needed.

Use socketpair for mux to worker oob communication

Currently mux is using signal SIGHUP to free up a worker. We want to be able to also pass additional parameters. We should use another socket for any out-of-band communication to be able to pass parameters.

CAL API CLIENT_SESSION duration is incorrect (always 0)

What I Did:
I send requests with big payload (insert, select) to server

What I Expected
The below line should report the execution time of query. It should be > 0 line below
T13:46:06.75 API CLIENT_SESSION 1 corr_id_=&log_id_=&session_id_=

What I Saw Instead
The query takes 1 second to complete, but CAL always reports 0 second duration -
T13:46:06.75 API CLIENT_SESSION 0 corr_id_=&log_id_=&session_id_=

Full log:
t13:46:05.65 API CLIENT_SESSION
A13:46:05.65 EXEC 1472831036 0
H13:46:06.38 STATE occ 0 init=0&acpt=1&wait=1&busy=0&schd=0&fnsh=0&quce=0&asgn=1&idle=0&bklg=0&strd=0&req=1&resp=1
H13:46:06.38 STATE occ.taf 0 init=0&acpt=2&wait=0&busy=0&schd=0&fnsh=0&quce=0&asgn=1&idle=0&bklg=0&strd=0&req=0&resp=0
A13:46:05.76 FETCH 1472831036 0
T13:46:06.75 API CLIENT_SESSION 0 corr_id_=&log_id_=&session_id_=
E13:46:06.76 OCCMUX large_payload_out 0 len=11116497

String Shard Key Values

What I Did

I made a table with a string shard key value.

What I saw

The string data type work for sharding.

What I expect

I'd like to use string shard key values.

Registration of the driver doesnt happen automatically ?

In one of my legacy app, if I try to use HeraDriver without loading the class first with Class.forName, I get an error like below.

	try {
		Class.forName("com.paypal.hera.jdbc.HeraDriver");
	}
	catch (ClassNotFoundException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

Caused by: java.lang.RuntimeException: Failed to get driver instance for jdbcUrl=jdbc:hera:1:127.0.0.1:11111 at com.availity.aries.core.storage.ConnectionDataSource.<init>(ConnectionDataSource.java:38) at com.availity.aries.core.storage.DataSourceDefinition.build(DataSourceDefinition.java:67) at com.availity.aries.core.storage.DataSourceDefinition.init(DataSourceDefinition.java:44) ... 58 more Caused by: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:315) at com.availity.aries.core.storage.ConnectionDataSource.<init>(ConnectionDataSource.java:35)

Mock MySQL test server

What I did
Package implements a simple server that follows MySQL protocol, located in hera/tests/mocksqlsrv. Run with hera/tests/unittest/coordinator_basic or other tests. Usage instructions in README. (Was only tested on coordinator_basic.)

What I see
Users can enter a failure probability, which is the probability that the server will crash and close the connection. coordinator_basic sometimes segfaults at p=0.5. Further investigation will be conducted later.

What I expect
Compatible with golang's database/sql package; good to go with go-sql-driver. Can be used to simulate server crashes and find edge cases.

Oracle UCP not working in the client with hera

Probably it's expected, but anyway I'll mention it.

I have a legacy app that currently is using Oracle UCP. I get the errors below when trying to use it with hera.

16:25:40.821 [main] ERROR c.a.a.h.OracleUCPConnectionProvider - Shuttting down due to database outage java.sql.SQLException: Unable to start the Universal Connection Pool: oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from Datasource: java.sql.SQLException: Invalid Oracle URL specified at oracle.ucp.util.UCPErrorHandler.newSQLException(UCPErrorHandler.java:488) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at oracle.ucp.util.UCPErrorHandler.throwSQLException(UCPErrorHandler.java:163) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java:690) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:1034) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:985) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.java:966) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at com.availity.aries.hibernate.OracleUCPConnectionProvider.getConnectionSafe(OracleUCPConnectionProvider.java:183) [bin/:na] at com.availity.aries.hibernate.OracleUCPConnectionProvider.getConnectionAndShutdownIfFailed(OracleUCPConnectionProvider.java:198) [bin/:na] at com.availity.aries.hibernate.OracleUCPConnectionProvider.getConnection(OracleUCPConnectionProvider.java:177) [bin/:na] at org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:279) [hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:124) [hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111) [hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234) [hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206) [hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887) [hibernate-core-4.3.7.Final.jar:4.3.7.Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845) [hibernate-core-4.3.7.Final.jar:4.3.7.Final] etc Caused by: oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from Datasource: java.sql.SQLException: Invalid Oracle URL specified at oracle.ucp.util.UCPErrorHandler.newUniversalConnectionPoolException(UCPErrorHandler.java:368) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at oracle.ucp.util.UCPErrorHandler.throwUniversalConnectionPoolException(UCPErrorHandler.java:49) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at oracle.ucp.util.UCPErrorHandler.throwUniversalConnectionPoolException(UCPErrorHandler.java:80) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at oracle.ucp.jdbc.DataSourceConnectionFactoryAdapter.createConnection(DataSourceConnectionFactoryAdapter.java:102) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at oracle.ucp.common.UniversalConnectionPoolImpl$UniversalConnectionPoolInternal.createOnePooledConnectionInternal(UniversalConnectionPoolImpl.java:1776) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at oracle.ucp.common.UniversalConnectionPoolImpl$UniversalConnectionPoolInternal.access$600(UniversalConnectionPoolImpl.java:1612) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at oracle.ucp.common.UniversalConnectionPoolImpl.createOnePooledConnection(UniversalConnectionPoolImpl.java:588) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at oracle.ucp.common.UniversalConnectionPoolImpl.addNewConnections(UniversalConnectionPoolImpl.java:1115) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at oracle.ucp.common.UniversalConnectionPoolBase.getInitialConnections(UniversalConnectionPoolBase.java:550) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at oracle.ucp.common.UniversalConnectionPoolBase.start(UniversalConnectionPoolBase.java:662) ~[ucp-12.1.0.1.jar:12.1.0.0.0] at oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java:684) ~[ucp-12.1.0.1.jar:12.1.0.0.0] ... 20 common frames omitted

Tracing Logs

We are starting with github.com/paypal/hera/cal which can time areas of code and also log events. In hera, we direct this to a file. In PayPal, we direct it to reporting infrastructure which gives graphs for duration, error, and count. We found it useful for monitoring.

In the future, we'd like to add our monitoring and scaling tools to open source hera. We will be investigating various tools and code interfaces to make a successful change. We would expect any replacement to have significant backward compatibility.

Fix Maintenance Queries

What I Did

I ran the Hera and wanted to trigger the db-hera workers to recycle.

What I Expect

I would like the workers to recycle at the designated time

Error "Can't create more than max_prepared_stmt_count"

What I Did
I ran longevity test with operations delete/insert/update/select repeatedly

What I See:
At first, things worked fine. After couple mins, I saw the error " Can't create more than max_prepared_stmt_count statements" and all subsequent requests thew same error

11:50:59.321508 debug: [WORKER 2 cmdprocessor.go:186] process command 123:25 SELECT /* EmployeeDDRMap._PrimaryKeyLookup.-2 */ D.ID, D.NAME FROM DALCERT_EMPLOYEE_DDR D WHERE D.ID = :id AND ((1 = 1)),
11:50:59.333237 debug: [WORKER 6 cmdprocessor.go:186] process command 4:2 id,
11:50:59.333273 debug: [WORKER 6 cmdprocessor.go:186] process command 6:3 2059,
11:50:59.333282 debug: [WORKER 8 cmdprocessor.go:186] process command 4:2 id,
11:50:59.333293 debug: [WORKER 6 cmdprocessor.go:186] process command 1:4,
11:50:59.333311 debug: [WORKER 8 cmdprocessor.go:186] process command 6:3 2090,
11:50:59.333316 debug: [WORKER 6 cmdprocessor.go:377] Executing false
11:50:59.333329 debug: [WORKER 8 cmdprocessor.go:186] process command 1:4,
11:50:59.333340 debug: [WORKER 6 cmdprocessor.go:378] BINDS [{2059 true}]
11:50:59.333352 debug: [WORKER 8 cmdprocessor.go:377] Executing false
11:50:59.333376 debug: [WORKER 8 cmdprocessor.go:378] BINDS [{2090 true}]
11:50:59.334294 warn: [WORKER 3 adapter.go:184] mysql ProcessError Error 1461: Can't create more than max_prepared_stmt_count statements (current value: 16382) sqlHash:2098623610 Cmd: errno:1461

What I Expect
My Longevity should run fine

Add scatter-gather

What I Did

I would like to query all shards. This is expensive, but we need to do this sometimes.

What I See

I get a shard key not found error.

What I Expect

I expect a select query to be sent to all the shards and the results returned. I would add /* hint-allow-scatter-gather */ to the query text to indicate that the programmer knows that the query is expensive.

Polish contributing document

What I Did

I tried the contributing instructions, and we didn't have a dev branch and the [ISSUE-10] tag didn't hyperlink.

What I Saw

It's useful to have the issue all the way in the git commit message. The pull request number is in the same sequence as the issue, which can get a little confusing.

What I Expect

I'd like to have things link together. The git commit link does work, but also mentioning it in the pull request comment or issue links the github pages together.

Mysql Worker panic when bind value is not provided for bind parameter

What I Did
The code below does not provide bind value for 2nd bind parameter
String bitustr = "update JAVA2OCC_2 set helix_bit = ?, helix_char = ? where ID = 5";
PreparedStatement pstu2 = oc.prepareStatement(bitustr);
pstu2.setBoolean(1, true);
pstu2.execute();
oc.commit();

What I Expected
I would get error from hera server

What I Saw Instead
Worker panic with error in log
17:10:13.365878 debug: [WORKER 1 cmdprocessor.go:186] process command 86:25 update JAVA2OCC_2 set helix_bit = :helix_bit, helix_char = :helix_char where ID = 5,
17:10:13.365929 verbose: [WORKER 1 cmdprocessor.go:214] Preparing: update JAVA2OCC_2 set helix_bit = ?, helix_char = ? where ID = 5
17:10:13.384405 verbose: [WORKER 1 workerservice.go:199] worker_sp0 : worker read <<< 11:2 helix_bit,
17:10:13.384431 debug: [WORKER 1 cmdprocessor.go:186] process command 11:2 helix_bit,
17:10:13.384458 verbose: [WORKER 1 workerservice.go:199] worker_sp0 : worker read <<< 3:3 ^A,
17:10:13.384472 debug: [WORKER 1 cmdprocessor.go:186] process command 3:3 ^A,
17:10:13.384515 verbose: [WORKER 1 cmdprocessor.go:325] BindValue: :helix_bit : 0 : {^A true}
17:10:13.384536 verbose: [WORKER 1 workerservice.go:199] worker_sp0 : worker read <<< 1:4,
17:10:13.384549 debug: [WORKER 1 cmdprocessor.go:186] process command 1:4,
17:10:13.384570 debug: [WORKER 1 cmdprocessor.go:381] Executing true
17:10:13.384593 debug: [WORKER 1 cmdprocessor.go:382] BINDS [{^A true}]
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
main.(*mysqlAdapter).ProcessError(0x9c4e80, 0x69d280, 0xc42007a9f0, 0xc4200f6980, 0xc4200f6960)
/x/hudson/workspace/occmux_with_go_bin_build64/gomux/src/github.com/paypal/hera/worker/mysqlworker/adapter.go:181 +0x65f
github.com/paypal/hera/worker/shared.(*CmdProcessor).ProcessCmd(0xc4200f6840, 0xc420094280, 0xc42012e150, 0x3)
/x/hudson/workspace/occmux_with_go_bin_build64/gomux/src/github.com/paypal/hera/worker/shared/cmdprocessor.go:401 +0x1c0c
github.com/paypal/hera/worker/shared.runworker(0xc42000e080, 0xc4200f6840, 0xc420085da8)
/x/hudson/workspace/occmux_with_go_bin_build64/gomux/src/github.com/paypal/hera/worker/shared/workerservice.go:204 +0x6f6
github.com/paypal/hera/worker/shared.Start(0x69fa00, 0x9c4e80)
/x/hudson/workspace/occmux_with_go_bin_build64/gomux/src/github.com/paypal/hera/worker/shared/workerservice.go:130 +0x73b
main.main()
/x/hudson/workspace/occmux_with_go_bin_build64/gomux/src/github.com/paypal/hera/worker/mysqlworker/main.go:62 +0x61b
17:10:13.387799 warn: [PROXY workerclient.go:758] workerclient pid= 1421 read error: EOF

Worker stays in "Quce" status and does not rertun to "acpt" after executing certain queries

What I Did
I ran Hibernate test suite against server with MySQL workers

What I See:
Test cases with workers stayed in "QUCE" status:

  1. Test case testWhereClause() in BasicHibernateAnnotationsTest Class (package org.hibernate.test.annotations.entity) caused the worker to stay in "quce" state and never recovered
  2. test2ndLevelSubClass() in package org.hibernate.test.annotations.inheritance;

Here is state.log
05/20/2019 11:41:29: ----------- init acpt wait busy schd fnsh quce asgn idle bklg strd
05/20/2019 11:41:29: occ 0 19 0 0 0 0 1 0 0 0 0
05/20/2019 11:41:30: occ 0 19 0 0 0 0 1 0 0 0 0
05/20/2019 11:41:31: occ 0 19 0 0 0 0 1 0 0 0 0

What I Expect
Worker should not stay in "quce". It should recover and go to "accept" state

Log files are attached
occ.log
state.log

For test case test2ndLevelSubClass(), logs are below
76354.txt
76358.txt
state.log

Read workers fail to connect to mysql server

What I Did

  1. Rear & Write workers were configured to point to same DB:
    bash-3.2$ env | grep TWO_TASK
    TWO_TASK_READ=tcp(127.0.0.1:3306)/world?timeout=10s
    TWO_TASK=tcp(127.0.0.1:3306)/world?timeout=10s

  2. I set readonly_children_pct=50 in hera.txt

What I Expected
When starting server, I expected all read & write workers to start successfully

What I Saw Instead
Hera Read workers fail to start
state.log:
08/08/2019 17:35:58: hera.w 0 2 0 0 0 0 0 0 0 0 0
08/08/2019 17:35:58: hera.r 2 0 0 0 0 0 0 0 0 0 0
08/08/2019 17:35:59: hera.w 0 2 0 0 0 0 0 0 0 0 0
08/08/2019 17:35:59: hera.r 2 0 0 0 0 0 0 0 0 0 0
08/08/2019 17:36:00: hera.w 0 2 0 0 0 0 0 0 0 0 0

Error in log:
10:52:51.876367 info: [R-WORKER 6 workerservice.go:103] DB heartbeat interval: 2m0s
10:52:51.876722 info: [R-WORKER 6 cmdprocessor.go:713] setup db connection.
10:52:51.932530 warn: [R-WORKER 5 adapter.go:75] recycling, got read-only conn
10:52:51.932706 warn: [R-WORKER 5 cmdprocessor.go:719] driver error cannot use read-only conn tcp(10.244.64.202:3306)/world
10:52:51.932728 warn: [R-WORKER 5 workerservice.go:117] Can't connect to DB: cannot use read-only conn tcp(10.244.64.202:3306)/world

Worker log level is not based on what is set in opcfg

What I Did
I turned on opscfg.default.server.log_level->5

What I Expected
Worker's activity should be logged as 'verbose' mode

What I Saw Instead
Workers activity was still logged with 'warning' mode. Looks like log_level config in opscfg is ignored, Worker codes use log_level in hera.txt

For bklg_eviction(timeout) & taf send sql and correlation id to cal-logs

What I Did

We had a database incident where the Hera server got backlogged with requests and started to backlog timeout.

What I Expected

We expect to be able to see on the Hera server, the clients that got impacted by the backlog timeout.

We expect the correlation id on TAF events as well.

What I See

In the CAL log, I see bkg_eviction(timeout) but no way to track down the SQL or client correlation id.

Configurable state log name

What I Did
I ran the hera server and looked at the state log.

What I Saw
The state log lines had "hera"

05/22/2019 13:39:33: -----------  init  acpt  wait  busy  schd  fnsh  quce  asgn  idle  bklg  strd
05/22/2019 13:39:33: hera           10     0     0     0     0     0     0     0     0     0     0

What I Expect
I would like to reconfigure the state log line to be able to match older PayPal lines with "occ"

05/21/2019 21:01:24: -----------  init  acpt  wait  busy  schd  fnsh  quce  asgn  idle  bklg  strd
05/21/2019 21:01:24: occ             0     8     0     0     0     0     0     0     0     0     0

Info to trace data_late

During testing, we saw messages in the cal log
E15:28:34.85 MUX data_late 0 ;
E15:31:01.94 MUX data_late 0 cmd = 0, payloadLen = 12; cmd = 0, payloadLen = 33; ;

More information is needed to associate a worker and its usage before we get the data_late log message.

Getting error when retrieving value of a column of type DateTime (MySql server)

What I Did
I have a table in MySql database server with DateTime type, column 'time_val'
Aftter inserting "2019-09-19 13:59:48" to time_val column, I'm unable to retrieve it. I got error
ResultSet rs = st.executeQuery("select id, int_val, str_val, date_val, time_val, TIMESTAMP_VAL from jdbc_occ_test where id=" + _id);
rs.next();
System.out.println ("Time: " + rs.getTimestamp(5));

What I Expected
I should be able to get date/time successfully

What I See
com.paypal.infra.occ.ex.OccSQLException: Failed to parse Timestamp
at com.paypal.infra.occ.jdbc.OccResultSet.getTimestamp(OccResultSet.java:445)
at com.paypal.infra.qa.java2occ.PrepareExecuteTest.test_DateTime(PrepareExecuteTest.java:1185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at junit.framework.TestCase.runTest(TestCase.java:176)
at junit.framework.TestCase.runBare(TestCase.java:141)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:252)
at junit.framework.TestSuite.run(TestSuite.java:247)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.text.ParseException: Unparseable date: "2019-09-19 13:59:48"
at java.text.DateFormat.parse(DateFormat.java:366)
at com.paypal.infra.occ.util.OccJdbcConverter.occ2timestamp(OccJdbcConverter.java:99)
at com.paypal.infra.occ.jdbc.OccResultSet.getTimestamp(OccResultSet.java:443)
... 20 more

configuration value set on backlog_pct in occ.txt is not considered

Although backlog_pct=0. hera allows many requests in bklg queue.
grep backlog occ.txt
backlog_pct = 0
request_backlog_timeout = 60000

State.log:
05/01/2019 17:01:22: ----------- init acpt wait busy schd fnsh quce asgn idle bklg strd
05/01/2019 17:01:22: occ 0 0 0 0 0 0 1 0 0 9 0
05/01/2019 17:01:23: occ 0 0 0 0 0 0 1 0 0 9 0
05/01/2019 17:01:24: occ 0 0 0 0 0 0 1 0 0 9 0

Error saving a boolean value to column of type bit(1)

What I Did
My MySQL schema has a table with a column of data type boolean_col bit(1)
Trying to update the column value using prepared statement setBoolean results in the following error.
Caused by: com.paypal.infra.occ.ex.OccClientException: SQL error: Error 1406: Data too long for column 'boolean_col' at row 1

What I Expected
I should be able to write to the bit column successfully.

What I See
Caused by: com.paypal.infra.occ.ex.OccClientException: SQL error: Error 1406: Data too long for column 'boolean_col' at row 1

MySQL: java setObject() to set time does not work

This works fine with Oracle DB but does not work with MySQL DB. After setting time with setObject(), I get back time of 00:00:00

What I Did
Java codes:
Statement st = dbConn.createStatement();
PreparedStatement pst = dbConn.prepareStatement(
"insert into jdbc_occ_test (id, int_val, str_val, char_val, float_val, raw_val, blob_val, clob_val, date_val, "

  • "time_val, timestamp_val, timestamp_tz_val) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
    ......
    pst.setObject(10, new Time(now).toString(), Types.TIME);
    pst.executeUpdate();
    ....

ResultSet rs = st.executeQuery( "select id, int_val, str_val, char_val, float_val, raw_val, blob_val, " +
"clob_val, date_val, time_val, timestamp_val from jdbc_occ_test where id=" + iID_START);
rs.next();
System.out.println ("Time is " + rs.getTime(10).toString());

What I Expected
Results:
Inserted time: 10:49:32
Time getting back: 10:49:32

What I Saw Instead
Results:
Inserted time: 10:49:32
Time getting back: 00:00:00

Rac Maint Test Broken

What I Did
I ran the tests/unittest/rac_maint against a MySQL db.

What I See
Test failed. The second part that was expecting to recycle the worker (that connects to the db) failed its check.

What I Expect
The worker should recycle.

Request C++ Client

Some development shops aren't on GoLang and would benefit from a C++ client.

If you are interested, please comment or get in touch so we can plan appropriately.

Implement the isValid method in HeraConnection

The method is not implemented. We get errors when trying to use it with a connection pool that uses the method.

Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: HeraConnection.isValid is not implemented
at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:576)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:555)
at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:115)
at com.zaxxer.hikari.HikariDataSource.(HikariDataSource.java:81)
etc
Caused by: java.sql.SQLFeatureNotSupportedException: HeraConnection.isValid is not implemented
at com.paypal.hera.jdbc.HeraConnection.isValid(HeraConnection.java:451)
at com.zaxxer.hikari.pool.PoolBase.checkDriverSupport(PoolBase.java:454)
at com.zaxxer.hikari.pool.PoolBase.setupConnection(PoolBase.java:421)
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:374)
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:198)
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:467)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:541)

When saturation happens, no SOFT/HARD_EVICTION events seen in CAL log

What I Did:
Using MySQL, Hera service is run with 3 workers, request_backlog_timeout is set to 6000, saturation feature is ON

Server config:
request_backlog_timeout=6000
opscfg.occ.server.saturation_recover_throttle_rate=80
opscfg.default.server.max_connections=3

Test Performed:

  • I set autocommit=0 and send a DML to insert a row to a table without commit
  • At the same time, I send 5 select queries to update same table using 5 threads
  • Since DML is not committed, 4 of update queries go to backlog, some of them will get killed by hera service due to saturation feature

What I Expected:
I expected to see HARD_EVICTION in Hera CAL log:
[calmsg] E17:42:29.49 HARD_EVICTION 782947879 0 ^M

What I Saw Instead:
CAL log does not have HARD_EVICTION events. I see SOFT_EVICTION events
t16:14:27.95 API CLIENT_SESSION
E16:14:27.95 STRANDED RECOVERING_SATURATION_RECOVERED 0 chld_pid=21626&worker_id=0&fwk=golang&raddr=10.244.70.71:59987&laddr=10.57.210.114:10101
E16:14:27.95 CLOSE 10.244.70.71 0 fwk=occmuxgo&raddr=10.244.70.71:59987&laddr=10.57.210.114:10101
E16:14:28.04 CLOSE 10.244.70.71 0 fwk=occmuxgo&raddr=10.244.70.71:59992&laddr=10.57.210.114:10101
A16:14:27.95 EXEC 1753867003 0
E16:14:28.05 OCCWORKER recoverworker 0
T16:14:28.06 API CLIENT_SESSION 0 corr_id_=&log_id_=&session_id_=

Autocomit unhappy path broken

To reproduce:
with the JBDC client, setAutoCommit(true) and execute two inserts where the first would succeed and the second will fail with unique key constraint violation

Multiple clients (threads) cannot insert rows into same table using Transaction

What I Did
I ran test to do insert in same table with multiple threads using Transaction

What I Expected
I should not get any error, insertion should work fine for multiple threads

What I Saw Instead
Insert operation fails with error:
16:23:15.290132 warn: [WORKER 4 adapter.go:184] mysql ProcessError Error 1205: Lock wait timeout exceeded; try restarting transaction sqlHash:3295891924 Cmd:4 errno:1205
16:23:15.290508 warn: [WORKER 4 cmdprocessor.go:404] Execute error: Error 1205: Lock wait timeout exceeded; try restarting transaction

Note that if I don't use transaction, the test works fine

BadInstrumentattion log is seen in CAL for TAF

What I Did
I have below configuration in server. I then send some queries. Since taf_timeout_ms=1 (too small), 1 or more queries will time out and fail over
enable_taf = true
taf_timeout_ms = 1

What I See
Log have BadInstrumentation line
t14:50:59.22 API CLIENT_SESSION_TAF
t14:50:59.21 EXEC 1753867003
E14:50:59.24 OCCWORKER recoverworker 0
E14:50:59.24 CDTGName##%%&&** BadInstrumentation
BadInstrumentation CompletingParentWithUncompletedChild 1&ParentType=API&ParentName=CLIENT_SESSION&ChildType=EXEC&ChildName=1753867003

T14:50:59.24 EXEC 1753867003 0
T14:50:59.24 API CLIENT_SESSION 0 corr_id_=&log_id_=&session_id_=

What I Expect
I should not see the below line in log:
E14:50:59.24 CDTGName##%%&&** BadInstrumentation
BadInstrumentation CompletingParentWithUncompletedChild 1&ParentType=API&ParentName=CLIENT_SESSION&ChildType=EXEC&ChildName=1753867003

Request Id counting error

To reproduce: issue repeatedly a select query where the table is missing followed by an insert where there is a bad column
We see HERAMUX/multiple_client_req followed by crqId_error.

Insert operation that uses auto increment for primary key fails

Configuration
MySQL + Hibernate. The primary key for an entity is defined as 'id' bigint(20) NOT NULL AUTO_INCREMENT.
Entity definition for same in hbm.xml file is defined as below

<id name="id" column="id">
  <generator class="identity"/>
</id>

What I Did
With the above configuration do a save for the entity.

What I Expected
Entity should be saved and a new record created in the table, where the primary key is computed by MySql.

What I See

11:15:17.941 [DefaultThreadPool-1] DEBUG org.hibernate.engine.jdbc.spi.SqlExceptionHelper:124 could not prepare statement [.........]
java.sql.SQLFeatureNotSupportedException: Not supported on Occ connection
    at com.ebay.kernel.cal.util.StackTrace.getStackTrace(StackTrace.java:45)
    at com.ebay.kernel.cal.api.internal.InternalCalEventHelper.writeLogImpl(InternalCalEventHelper.java:171)
    at com.ebay.kernel.cal.api.internal.InternalCalEventHelper.writeLogImpl(InternalCalEventHelper.java:102)
    at com.ebay.kernel.cal.api.internal.InternalCalEventHelper.writeLogImpl(InternalCalEventHelper.java:85)
    at com.ebay.kernel.cal.api.internal.InternalCalEventHelper.writeLog(InternalCalEventHelper.java:70)
    at com.ebay.kernel.cal.api.sync.CalEventHelper.writeLog(CalEventHelper.java:142)
    at com.ebay.kernel.calwrapper.CalEventHelper.writeLog(CalEventHelper.java:140)
    at com.ebay.kernel.calwrapper.CalEventHelper.writeLog(CalEventHelper.java:124)
    at com.ebay.kernel.calwrapper.CalEventHelper.writeException(CalEventHelper.java:96)
    at com.ebay.integ.dal.cal.rt.CalConnectionWrapper.logSQLException(CalConnectionWrapper.java:235)
    at com.ebay.integ.dal.cal.rt.CalConnectionWrapper.handleSQLException(CalConnectionWrapper.java:254)
    at com.ebay.integ.dal.cal.rt.CalConnectionWrapper.prepareStatement(CalConnectionWrapper.java:501)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$2.doPrepare(StatementPreparerImpl.java:105)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:171)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:107)
    at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:42)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2933)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3524)
    at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:81)
    at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:637)
    at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:282)
    at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:263)
    at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:317)
    at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:318)
    at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:275)
    at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:182)
    at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:113)
    at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192)
    at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38)
    at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:177)
    at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32)
    at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73)
    at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:692)
    at org.hibernate.internal.SessionImpl.save(SessionImpl.java:684)
    at org.hibernate.internal.SessionImpl.save(SessionImpl.java:679)

What I found based on my analysis
OCC doesn't support auto increment/auto generated keys. For the above use case, code path hits prepareStatement(String sql, int autoGeneratedKeys) throws SQLException on OCC connection, which is not supported.

Use Client Certs

What I Did

I was reading through gomuxdriver/muxtls/example/sample_main.go to setup TLS mutual authentication.

What I See

I don't see client certificates.

What I Expect

I would like some example to have client certificates set and verified on the server.

Mysql: executing PL/SQL store procedure through jmux-jdbc throws "syntax error"

What I Did
I tried to execute a store procedure through jmux-jdbc and got "syntax error":
Note that I could execute successfully when connecting directly to mysql with this command:
call DALCERT_INSERT_EMPLOYEE()
This is what I inserted to Mysql db:
DELIMITER //
CREATE PROCEDURE DALCERT_INSERT_EMPLOYEE()
BEGIN INSERT INTO DALCERT_EMPLOYEE_ADHOC(ID, NAME) VALUES(2, 'employee_adhoc_sp');
END//
DELIMITER ;

My test:
String query = "{ call DALCERT_INSERT_EMPLOYEE() }";
CallableStatement cst = oc.prepareCall(query);
cst.executeUpdate();

What I Expected
PL/SQL should executed successfully

What I Saw Instead
I got "Syntax Error"
Server log:
12:36:17.544199 debug: [WORKER 0 cmdprocessor.go:172] process command 32:2006 CorrId=None&PoolStack: None,
12:36:17.544214 verbose: [WORKER 0 workerservice.go:169] worker_sp0 : occworker read <<< 41:25 BEGIN DALCERT_INSERT_EMPLOYEE() ; END;,
12:36:17.544226 debug: [WORKER 0 cmdprocessor.go:172] process command 41:25 BEGIN DALCERT_INSERT_EMPLOYEE() ; END;,
12:36:17.544265 verbose: [WORKER 0 cmdprocessor.go:197] Preparing: BEGIN DALCERT_INSERT_EMPLOYEE() ; END;
12:36:17.588457 verbose: [WORKER 0 workerservice.go:169] worker_sp0 : occworker read <<< 1:4,
12:36:17.588479 debug: [WORKER 0 cmdprocessor.go:172] process command 1:4,
12:36:17.588538 verbose: [WORKER 0 common.go:36] worker writing to mux >>> 201:502 0191:1 Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DALCERT_INSERT_EMPLOYEE() ; END' at li
12:36:17.588567 verbose: [PROXY workerclient.go:763] workerclient (<<< pid = 14388 ): EOR code: 0 , data: 191:1 Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DALCERT_INSERT_EMPLOYEE() ; END' at line 1,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.