Skip to content

Commit

Permalink
updating scuttle id changes branch with recent code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rasamala83 committed Feb 5, 2024
2 parents 28d5795 + 192e0e8 commit 78d0801
Show file tree
Hide file tree
Showing 134 changed files with 2,362 additions and 803 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/allcov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: allCov
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
odbTest:
runs-on: ubuntu-latest
services:
mysql:
image: mysql
env:
MYSQL_ROOT_PASSWORD: 1-testDb
MYSQL_DATABASE: heratestdb
ports:
- 3306:3306
steps:
- uses: actions/checkout@v3
- name: Baseline for later scripted manual setup of go1.20
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: allCovSh
run: tests/unittest/allcover.sh
- uses: actions/upload-artifact@v3
with:
name: coverage web page
path: /home/runner/go/allcover.htm
52 changes: 31 additions & 21 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,29 @@ name: Go Build

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15

- name: Build
run: go build -v ./...
- name: Test
run: go test -v github.com/paypal/hera/worker/mysqlworker github.com/paypal/hera/utility/encoding/netstring github.com/paypal/hera/lib github.com/paypal/hera/common github.com/paypal/hera/cal
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18.2
- name: Install GO Modules
run: |
go mod tidy
go mod download github.com/godror/godror
- name: Build
run: go build -v ./...
- name: Test
run: go test -v github.com/paypal/hera/worker/mysqlworker github.com/paypal/hera/utility/encoding/netstring github.com/paypal/hera/lib github.com/paypal/hera/common github.com/paypal/hera/cal
container-job:
runs-on: ubuntu-latest
services:
Expand All @@ -33,13 +36,20 @@ jobs:
ports:
- 3306:3306
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: Build worker
run: go install github.com/paypal/hera/worker/mysqlworker
- name: System Test
run: tests/unittest/testall.sh
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18.2
- name: Install GO Modules
run: |
go mod tidy
go mod download github.com/godror/godror
- name: Build worker
run: go install github.com/paypal/hera/worker/mysqlworker
- name: System Test
run: |
export GOPATH="/home/runner/go"
echo $GOPATH
tests/unittest/testall.sh
26 changes: 26 additions & 0 deletions .github/workflows/gv-oracle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: gvenzl oracle
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
odbTest:
runs-on: ubuntu-latest

services:
odb3:
image: gvenzl/oracle-xe:21-slim-faststart
env:
ORACLE_PASSWORD: 1.2.8MomOfferExpand
ports:
- 1521:1521
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.15
- name: System Test
run: tests/unittest3/testall.sh
12 changes: 6 additions & 6 deletions .github/workflows/jdbc-ci-maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ name: Java CI with Maven

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.15
go-version: 1.19

- name: whereami
run: pwd

- name: Set up JDK 8
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/manual-ft.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: Manual functionaltest
on:
workflow_dispatch:

push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
funcTest:
runs-on: ubuntu-latest
Expand All @@ -15,10 +18,10 @@ jobs:
ports:
- 3306:3306
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.15
go-version: 1.19
- name: System Test
run: tests/functionaltest/runall.sh
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ The following sections explain the process for manually building mux without Doc
2. Install [MySQL](http://dev.mysql.com/downloads/mysql), [Oracle](https://www.oracle.com/index.html) or [PostgresSQL](https://www.postgresql.org/download/).
3. Install the [MySQL driver](https://github.com/go-sql-driver/mysql), [Oracle driver](https://github.com/go-goracle/goracle) and the [PostgreSQL driver](https://github.com/lib/pq)
4. Install Oracle instant client.
5. Install GCC.

### Build Binaries

Expand All @@ -89,7 +90,7 @@ The following sections explain the process for manually building mux without Doc
Clone the source code from [github](https://github.com/paypal/hera)
```
git clone git@github.com:paypal/hera src/github.com/paypal/hera
git clone https://github.com/paypal/hera src/github.com/paypal/hera
```
Option 2
Expand All @@ -101,6 +102,7 @@ The following sections explain the process for manually building mux without Doc
```
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
Expand Down
32 changes: 32 additions & 0 deletions client/gosqldriver/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,35 @@ func (c *heraConnection) SetClientInfo(poolName string, host string)(error){
}
return nil
}

func (c *heraConnection) SetClientInfoWithPoolStack(poolName string, host string, poolStack string)(error){
if len(poolName) <= 0 && len(host) <= 0 && len(poolStack) <= 0 {
return nil
}

pid := os.Getpid()
data := fmt.Sprintf("PID: %d, HOST: %s, Poolname: %s, PoolStack: %s, Command: SetClientInfo,", pid, host, poolName, poolStack)
c.clientinfo = netstring.NewNetstringFrom(common.CmdClientInfo, []byte(string(data)))
if logger.GetLogger().V(logger.Verbose) {
logger.GetLogger().Log(logger.Verbose, "SetClientInfo", c.clientinfo.Serialized)
}

_, err := c.conn.Write(c.clientinfo.Serialized)
if err != nil {
if logger.GetLogger().V(logger.Warning) {
logger.GetLogger().Log(logger.Warning, "Failed to send client info")
}
return errors.New("Failed custom auth, failed to send client info")
}
ns, err := c.reader.ReadNext()
if err != nil {
if logger.GetLogger().V(logger.Warning) {
logger.GetLogger().Log(logger.Warning, "Failed to read server info")
}
return errors.New("Failed to read server info")
}
if logger.GetLogger().V(logger.Debug) {
logger.GetLogger().Log(logger.Debug, "Server info:", string(ns.Payload))
}
return nil
}
2 changes: 2 additions & 0 deletions client/gosqldriver/ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ type HeraConn interface {
SetCalCorrID(corrID string)

SetClientInfo(poolname string, host string) error

SetClientInfoWithPoolStack(poolName string, host string, poolStack string) error
}

// HeraStmt is an API extension for *sql.Stmt
Expand Down
6 changes: 3 additions & 3 deletions docker_build_and_run/HeraDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.14.3
FROM golang:1.21.5

# Before doing a docker build, copy over the repo into this directory
# tests/devdocker$ mkdir -p src/github.com/paypal/hera
Expand All @@ -25,8 +25,8 @@ ADD src /go/src
ADD srv /srv

RUN git config --global http.sslverify false
RUN go get github.com/go-sql-driver/mysql
RUN go install github.com/paypal/hera/mux github.com/paypal/hera/worker/mysqlworker
RUN ( cd src/github.com/paypal/hera ; go get github.com/go-sql-driver/mysql )
RUN ( cd src/github.com/paypal/hera ; go install github.com/paypal/hera/mux github.com/paypal/hera/worker/mysqlworker )

CMD ["/srv/start.sh"]

9 changes: 7 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
module github.com/paypal/hera

go 1.12
go 1.18

require (
github.com/go-sql-driver/mysql v1.4.1
github.com/go-sql-driver/mysql v1.7.1
github.com/godror/godror v0.26.3
github.com/lib/pq v1.10.3
)

require (
github.com/go-logfmt/logfmt v0.5.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect
)
40 changes: 27 additions & 13 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
github.com/go-goracle/goracle v2.1.14+incompatible h1:uw4p4j6b6/ustNb/Yqd2rXIrBEJCGPh9ZCNFl00I9E0=
github.com/go-goracle/goracle v2.1.14+incompatible/go.mod h1:+EZ+XI0XYe/t96DSQbwEA8wvYxlyJftRDsjUhw/EVI8=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
gopkg.in/goracle.v2 v2.12.3 h1:LnNrOqNF9xj6suiuenVcOTd00S9/4aneyHarj84EaT4=
gopkg.in/goracle.v2 v2.12.3/go.mod h1:QhfGFGWSfZKBnBWnAkjd5GreYK1tan9ikkA7BMirttE=
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/godror/godror v0.26.3 h1:V+z+Q/OBGgmmYzuAwyJzpcn4LsPF4Ev0xHAea68V00c=
github.com/godror/godror v0.26.3/go.mod h1:1QCn6oXh3r+IlB3DLE8V6qkHXLSHd18a3Hw7szQ9/3Y=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/lib/pq v1.10.3 h1:v9QZf2Sn6AmjXtQeFpdoq/eaNtYP6IN+7lcrygsIAtg=
github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
5 changes: 5 additions & 0 deletions lib/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ type Config struct {
//
StateLogInterval int

// flag to enable CLIENT_INFO to worker
EnableCmdClientInfoToWorker bool

// if TAF is enabled
EnableTAF bool
// Timeout for a query to run on the primary, before fallback to secondary
Expand Down Expand Up @@ -341,6 +344,8 @@ func InitConfig() error {

gAppConfig.HostnamePrefix = parseMapStrStr(cdb.GetOrDefaultString("hostname_prefix", ""))

gAppConfig.EnableCmdClientInfoToWorker = cdb.GetOrDefaultBool("enable_client_info_to_worker", false)

gAppConfig.CfgFromTns = cdb.GetOrDefaultBool("cfg_from_tns", true)
gAppConfig.CfgFromTnsOverrideNumShards = cdb.GetOrDefaultInt("cfg_from_tns_override_num_shards", -1)
gAppConfig.CfgFromTnsOverrideTaf = cdb.GetOrDefaultInt("cfg_from_tns_override_taf", -1)
Expand Down
Loading

0 comments on commit 78d0801

Please sign in to comment.