Skip to content

Commit 256e194

Browse files
committed
Merge branch 'fix/limit_with_cluster' of github.com:zhang2014/datafuse into fix/limit_with_cluster
2 parents 80a9d0a + 0a20830 commit 256e194

File tree

153 files changed

+10125
-6304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+10125
-6304
lines changed

.github/actions/test_sqllogic_cluster_linux/action.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ runs:
2323
sha: ${{ github.sha }}
2424
target: ${{ inputs.target }}
2525

26-
- name: Test setup
27-
shell: bash
28-
run: |
29-
bash ./scripts/setup/dev_setup.sh -yd
30-
3126
- name: Run sqllogic Tests with Cluster mode
3227
shell: bash
3328
run: |
34-
bash ./scripts/ci/ci-run-sqllogic-tests-cluster.sh ${{ inputs.dirs }}
29+
docker run --rm --tty --net=host \
30+
--user $(id -u):$(id -g) \
31+
--volume "${PWD}:/workspace" \
32+
--workdir "/workspace" \
33+
datafuselabs/build-tool:sqllogic \
34+
bash ./scripts/ci/ci-run-sqllogic-tests-cluster.sh \
35+
${{ inputs.dirs }}

.github/actions/test_sqllogic_standalone_linux/action.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,13 @@ runs:
2323
sha: ${{ github.sha }}
2424
target: ${{ inputs.target }}
2525

26-
- name: Test setup
27-
shell: bash
28-
run: |
29-
bash ./scripts/setup/dev_setup.sh -yd
30-
3126
- name: Run sqllogic Tests with Standalone mode with embedded meta-store
3227
shell: bash
3328
run: |
34-
bash ./scripts/ci/ci-run-sqllogic-tests.sh ${{ inputs.dirs }}
35-
36-
# - name: Upload failure
37-
# if: failure()
38-
# uses: ./.github/actions/artifact_failure
39-
# with:
40-
# name: test-sqllogic-standalone-linux
29+
docker run --rm --tty --net=host \
30+
--user $(id -u):$(id -g) \
31+
--volume "${PWD}:/workspace" \
32+
--workdir "/workspace" \
33+
datafuselabs/build-tool:sqllogic \
34+
bash ./scripts/ci/ci-run-sqllogic-tests.sh \
35+
${{ inputs.dirs }}

.github/workflows/build-sqllogic.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build Sqllogic Test Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "tests/logictest/**"
9+
10+
permissions:
11+
id-token: write
12+
contents: read
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- uses: ./.github/actions/setup_docker
21+
id: login
22+
with:
23+
repo: build-tool
24+
ecr_role_arn: ${{ secrets.ECR_ROLE_ARN }}
25+
dockerhub_user: ${{ secrets.DOCKERHUB_USERNAME }}
26+
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
27+
28+
- name: Build and push
29+
id: docker_build
30+
uses: docker/build-push-action@v3
31+
with:
32+
push: true
33+
tags: |
34+
${{ steps.login.outputs.dockerhub_repo }}:sqllogic
35+
${{ steps.login.outputs.ecr_repo }}:sqllogic
36+
platforms: linux/amd64
37+
context: ./tests/logictest/
38+
file: ./tests/logictest/Dockerfile

.github/workflows/databend-release.yml

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,24 @@ jobs:
191191
target: ${{ steps.target.outputs.target }}
192192
repo_role_arn: ${{ secrets.REPO_ROLE_ARN }}
193193

194+
publish_sqllogic_testsuites:
195+
name: sqllogic testsuites
196+
runs-on: ubuntu-latest
197+
needs: [create_release]
198+
steps:
199+
- name: Checkout
200+
uses: actions/checkout@v3
201+
- name: Get the version
202+
id: get_version
203+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
204+
- name: Upload to github release
205+
env:
206+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
207+
run: |
208+
version=${{ needs.create_release.outputs.version }}
209+
tar -C ./tests/logictest -czvf testsuites-${version}.tar.gz suites
210+
gh release upload ${version} testsuites-${version}.tar.gz --clobber
211+
194212
release_docker_combined:
195213
name: docker image combined
196214
runs-on: ubuntu-latest
@@ -305,34 +323,3 @@ jobs:
305323
context: .
306324
file: ./docker/${{ matrix.distro }}/${{ matrix.service }}.Dockerfile
307325
build-args: VERSION=${{ needs.create_release.outputs.version }}
308-
309-
release_logic_test_docker_image:
310-
name: release logic test docker image
311-
runs-on: ubuntu-latest
312-
needs: [create_release]
313-
steps:
314-
- name: Checkout
315-
uses: actions/checkout@v3
316-
317-
- uses: ./.github/actions/setup_docker
318-
id: login
319-
with:
320-
repo: sqllogictest
321-
ecr_role_arn: ${{ secrets.ECR_ROLE_ARN }}
322-
dockerhub_user: ${{ secrets.DOCKERHUB_USERNAME }}
323-
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
324-
325-
- name: Build and push
326-
id: docker_build
327-
uses: docker/build-push-action@v3
328-
with:
329-
push: true
330-
tags: |
331-
${{ steps.login.outputs.dockerhub_repo }}:latest
332-
${{ steps.login.outputs.dockerhub_repo }}:${{ needs.create_release.outputs.version }}
333-
${{ steps.login.outputs.ecr_repo }}:latest
334-
${{ steps.login.outputs.ecr_repo }}:${{ needs.create_release.outputs.version }}
335-
platforms: linux/amd64
336-
context: ./tests/logictest/
337-
file: ./tests/logictest/Dockerfile
338-
build-args: VERSION=${{ needs.create_release.outputs.version }}

Cargo.lock

Lines changed: 43 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: Idempotent Copy
3+
description: Avoid duplicating when copy stage files into a table
4+
---
5+
6+
- Tracking Issue: https://github.com/datafuselabs/databend/issues/6338
7+
8+
## Summary
9+
10+
When streaming copy stage files into a table, there is a chance that some files have already been copied, So it needs some ways to avoid duplicate copying files, make it an `idempotent` operation.
11+
12+
## Save copy into table stage files meta information in meta service
13+
14+
Whenever copy stage files into a table, save the stage file meta information into the meta service:
15+
16+
- key: combined with `(tenant, database, table, file name)`.
17+
- value: value MUST includes all the meta of a stage file, such as `content-length`,`etag`,`last modified`.
18+
19+
20+
21+
![](/img/rfc/20220909-idempotent-copy/stage-file-meta.png)
22+
23+
24+
25+
The expiration time of the stage file meta information is 64 days by default.
26+
27+
## Avoiding duplicates when copy stage files into a table
28+
29+
Using the stage file meta information, whenever copy stage files into a table, follow these steps:
30+
31+
* First, get all the table file meta information of the copy stage files that want to copy into the table(if any).
32+
* Second, get all the stage file meta information.
33+
* Third, compare the table file meta information with stage file meta information:
34+
* If they matched, this file is just ignored without copying.
35+
* Else, copy the stage file and up-insert into the table stage file meta.
36+
37+
38+
39+
![](/img/rfc/20220909-idempotent-copy/example.png)
40+
41+
42+
43+
Take the image above as an example:
44+
45+
* Client make a request to copy thress files (file1, file2, file3) into table.
46+
47+
* Get the table stage file meta of (file1, file2, file3).
48+
49+
* In the meta service, only found (file1,file3) stage file information.
50+
51+
* Compare the table stage file information with stage file information, and found that file1 has not been changed, so file1 will be ignored in this copy operation, and (file2,file3) will be copied.
52+
53+
* After copying new files, (file2, file3) stage file information will be saved into table file information.
54+
55+
56+
Loading
Loading

src/binaries/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ common-grpc = { path = "../common/grpc" }
3333
common-macros = { path = "../common/macros" }
3434
common-meta-api = { path = "../meta/api" }
3535
common-meta-app = { path = "../meta/app" }
36+
common-meta-client = { path = "../meta/client" }
3637
common-meta-embedded = { path = "../meta/embedded" }
37-
common-meta-grpc = { path = "../meta/grpc" }
3838
common-meta-raft-store = { path = "../meta/raft-store" }
3939
common-meta-sled-store = { path = "../meta/sled-store" }
4040
common-meta-store = { path = "../meta/store" }

0 commit comments

Comments
 (0)