Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: merge 3.1 to 3.0 #286

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 140 additions & 0 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: compatibility

on:
pull_request:
branches:
- '3.1'

jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
td_version: [ 'main', '3.0' ]
name: Build ${{ matrix.td_version }}
outputs:
commit_id: ${{ steps.get_commit_id.outputs.commit_id }}
steps:
- name: checkout TDengine by pr
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
with:
repository: 'taosdata/TDengine'
path: 'TDengine'
ref: ${{ matrix.td_version }}

- name: get_commit_id
id: get_commit_id
run: |
cd TDengine
echo "commit_id=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT


- name: Cache server by pr
if: github.event_name == 'pull_request'
id: cache-server-pr
uses: actions/cache@v3
with:
path: server.tar.gz
key: ${{ runner.os }}-build-${{ matrix.td_version }}-${{ steps.get_commit_id.outputs.commit_id }}

- name: prepare install
if: >
(github.event_name == 'pull_request' && steps.cache-server-pr.outputs.cache-hit != 'true')
run: sudo apt install -y libgeos-dev

- name: install TDengine
if: >
(github.event_name == 'pull_request' && steps.cache-server-pr.outputs.cache-hit != 'true')
run: |
cd TDengine
mkdir debug
cd debug
cmake .. -DBUILD_TEST=off -DBUILD_HTTP=false -DVERNUMBER=3.9.9.9
make -j 4

- name: package
if: >
(github.event_name == 'pull_request' && steps.cache-server-pr.outputs.cache-hit != 'true')
run: |
mkdir -p ./release
cp ./TDengine/debug/build/bin/taos ./release/
cp ./TDengine/debug/build/bin/taosd ./release/
cp ./TDengine/tools/taosadapter/taosadapter ./release/
cp ./TDengine/debug/build/lib/libtaos.so.3.9.9.9 ./release/
cp ./TDengine/debug/build/lib/librocksdb.so.8.1.1 ./release/ ||:
cp ./TDengine/include/client/taos.h ./release/
cat >./release/install.sh<<EOF
chmod +x ./taos
chmod +x ./taosd
chmod +x ./taosadapter
cp ./taos /bin/
cp ./taosd /bin/
cp ./taosadapter /bin/
cp ./libtaos.so.3.9.9.9 /usr/lib
cp ./librocksdb.so.8.1.1 /usr/lib ||:
ln -sf /usr/lib/libtaos.so.3.9.9.9 /usr/lib/libtaos.so.1
ln -sf /usr/lib/libtaos.so.1 /usr/lib/libtaos.so
ln -sf /usr/lib/librocksdb.so.8.1.1 /usr/lib/librocksdb.so.8 ||:
ln -sf /usr/lib/librocksdb.so.8 /usr/lib/librocksdb.so ||:
cp ./taos.h /usr/include
EOF
tar -zcvf server.tar.gz ./release

test:
runs-on: ubuntu-22.04
needs: build
strategy:
matrix:
go: [ '1.14', 'stable' ]
td_version: [ 'main', '3.0' ]
name: Go ${{ matrix.td_version }} ${{ matrix.go }}
steps:
- name: get cache server by pr
if: github.event_name == 'pull_request'
id: get-cache-server-pr
uses: actions/cache@v3
with:
path: server.tar.gz
key: ${{ runner.os }}-build-${{ matrix.td_version }}-${{ needs.build.outputs.commit_id }}
restore-keys: |
${{ runner.os }}-build-${{ matrix.td_version }}-


- name: prepare install
run: sudo apt install -y libgeos-dev

- name: install
run: |
tar -zxvf server.tar.gz
cd release && sudo sh install.sh

- name: checkout
uses: actions/checkout@v3

- name: copy taos cfg
run: |
sudo mkdir -p /etc/taos
sudo cp ./.github/workflows/taos.cfg /etc/taos/taos.cfg
sudo cp ./.github/workflows/taosadapter.toml /etc/taos/taosadapter.toml

- name: shell
run: |
cat >start.sh<<EOF
ulimit -n 65535 && TAOS_SUPPORT_VNODES=256 taosd
EOF

- name: taosd
run: nohup sudo sh ./start.sh &

- name: start taosadapter
run: sudo taosadapter &

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
cache-dependency-path: go.sum

- name: Test
run: sudo go test -v --count=1 -coverprofile=coverage.txt -covermode=atomic ./...
1 change: 1 addition & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- 'main'
- '3.0'
- '3.1'
workflow_dispatch:
inputs:
tbBranch:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- 'main'
- '3.0'
- '3.1'


jobs:
Expand Down
27 changes: 16 additions & 11 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@

v2 与 v3 版本不兼容,与 TDengine 版本对应如下:

| **driver-go 版本** | **TDengine 版本** | **主要功能** |
|------------------|----------------------|--------------------------------|
| v3.5.1 | 3.2.1.0+ / 3.1.1.13+ | 原生 stmt 查询和 geometry 类型支持 |
| v3.5.0 | 3.0.5.0+ | 获取消费进度及按照指定进度开始消费 |
| v3.3.1 | 3.0.4.1+ | 基于 websocket 的 schemaless 协议写入 |
| v3.1.0 | 3.0.2.2+ | 提供贴近 kafka 的订阅 api |
| v3.0.4 | 3.0.2.2+ | 新增 request id 相关接口 |
| v3.0.3 | 3.0.1.5+ | 基于 websocket 的 statement 写入 |
| v3.0.2 | 3.0.1.5+ | 基于 websocket 的数据查询和写入 |
| v3.0.1 | 3.0.0.0+ | 基于 websocket 的消息订阅 |
| v3.0.0 | 3.0.0.0+ | 适配 TDengine 3.0 查询和写入 |
| **driver-go 版本** | **TDengine 版本** | **主要功能** |
|------------------|----------------------|----------------------------------|
| v3.5.5 | 3.2.3.0+ / 3.1.1.27+ | restful 支持跳过 ssl 证书检查 |
| v3.5.4 | 3.2.3.0+ / 3.1.1.27+ | 兼容 TDengine 3.3.0.0 tmq raw data |
| v3.5.3 | 3.2.3.0+ / 3.1.1.27+ | 重构 taosWS |
| v3.5.2 | 3.2.3.0+ / 3.1.1.27+ | websocket 压缩和优化消息订阅性能 |
| v3.5.1 | 3.2.1.0+ / 3.1.1.13+ | 原生 stmt 查询和 geometry 类型支持 |
| v3.5.0 | 3.0.5.0+ | 获取消费进度及按照指定进度开始消费 |
| v3.3.1 | 3.0.4.1+ | 基于 websocket 的 schemaless 协议写入 |
| v3.1.0 | 3.0.2.2+ | 提供贴近 kafka 的订阅 api |
| v3.0.4 | 3.0.2.2+ | 新增 request id 相关接口 |
| v3.0.3 | 3.0.1.5+ | 基于 websocket 的 statement 写入 |
| v3.0.2 | 3.0.1.5+ | 基于 websocket 的数据查询和写入 |
| v3.0.1 | 3.0.0.0+ | 基于 websocket 的消息订阅 |
| v3.0.0 | 3.0.0.0+ | 适配 TDengine 3.0 查询和写入 |

## 安装

Expand Down Expand Up @@ -350,6 +354,7 @@ DSN 格式为:

- `disableCompression` 是否接受压缩数据,默认为 `true` 不接受压缩数据,如果传输数据使用 gzip 压缩设置为 `false`。
- `readBufferSize` 读取数据的缓存区大小默认为 4K (4096),当查询结果数据量多时可以适当调大该值。
- `skipVerify` 是否跳过 ssl 证书检查,默认为 `false` 不跳过,如果使用 https 连接可以设置为 `true`。

### 使用限制

Expand Down
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,22 @@ English | [简体中文](README-CN.md)

v2 is not compatible with v3 version and corresponds to the TDengine version as follows:

| **driver-go version** | **TDengine version** | **major features** |
|-----------------------|----------------------|----------------------------------------|
| v3.5.1 | 3.2.1.0+ / 3.1.1.13+ | native stmt query and geometry support |
| v3.5.0 | 3.0.5.0+ | tmq: get assignment and seek offset |
| v3.3.1 | 3.0.4.1+ | schemaless insert over websocket |
| v3.1.0 | 3.0.2.2+ | provide tmq apis close to kafka |
| v3.0.4 | 3.0.2.2+ | add request id |
| v3.0.3 | 3.0.1.5+ | statement insert over websocket |
| v3.0.2 | 3.0.1.5+ | bulk pulling over websocket |
| v3.0.1 | 3.0.0.0+ | tmq over websocket |
| v3.0.0 | 3.0.0.0+ | adapt to TDengine 3.0 query and insert |
| **driver-go version** | **TDengine version** | **major features** |
|-----------------------|----------------------|-----------------------------------------------|
| v3.5.6 | 3.3.2.0+ / 3.1.2.0+ | WebSocket performance improvements |
| v3.5.5 | 3.2.3.0+ / 3.1.1.27+ | support skip http ssl check |
| v3.5.4 | 3.2.3.0+ / 3.1.1.27+ | compatible with TDengine 3.3.0.0 tmq raw data |
| v3.5.3 | 3.2.3.0+ / 3.1.1.27+ | refactor taosWS |
| v3.5.2 | 3.2.3.0+ / 3.1.1.27+ | websocket compression and optimize tmq poll |
| v3.5.1 | 3.2.1.0+ / 3.1.1.13+ | native stmt query and geometry support |
| v3.5.0 | 3.0.5.0+ | tmq: get assignment and seek offset |
| v3.3.1 | 3.0.4.1+ | schemaless insert over websocket |
| v3.1.0 | 3.0.2.2+ | provide tmq apis close to kafka |
| v3.0.4 | 3.0.2.2+ | add request id |
| v3.0.3 | 3.0.1.5+ | statement insert over websocket |
| v3.0.2 | 3.0.1.5+ | bulk pulling over websocket |
| v3.0.1 | 3.0.0.0+ | tmq over websocket |
| v3.0.0 | 3.0.0.0+ | adapt to TDengine 3.0 query and insert |

## Install

Expand Down Expand Up @@ -349,6 +354,8 @@ Parameters:

- `disableCompression` Whether to accept compressed data, default is `true` Do not accept compressed data, set to `false` if the transferred data is compressed using gzip.
- `readBufferSize` The default size of the buffer for reading data is 4K (4096), which can be adjusted upwards when there is a lot of data in the query result.
- `skipVerify` Whether to skip the verification of the server certificate, the default is `false`, and the server
certificate is verified by default. If the server certificate is not verified, set to `true`.

### Usage restrictions

Expand Down
29 changes: 18 additions & 11 deletions taosRestful/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package taosRestful
import (
"compress/gzip"
"context"
"crypto/tls"
"database/sql/driver"
"encoding/base64"
"errors"
Expand Down Expand Up @@ -36,18 +37,24 @@ func newTaosConn(cfg *config) (*taosConn, error) {
readBufferSize = 4 << 10
}
tc := &taosConn{cfg: cfg, readBufferSize: readBufferSize}
transport := &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
DisableCompression: cfg.disableCompression,
}
if cfg.skipVerify {
transport.TLSClientConfig = &tls.Config{
InsecureSkipVerify: true,
}
}
tc.client = &http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
DisableCompression: cfg.disableCompression,
},
Transport: transport,
}
path := "/rest/sql"
if len(cfg.dbName) != 0 {
Expand Down
Loading
Loading