Skip to content

Commit 03f56f1

Browse files
dantengskysundy-li
andauthored
chore: (backport) enable overflow-checks in ci profile (#16895) (#16931)
* chore: sync ci workflow & actions * chore(ci): enable overflow-checks in ci profile (#16895) * chore(ci): enable overflow-checks in ci profile * update * update * update * update * update * update * update * update * chore: remove bench (not supported on br v1.2.636-rc5) --------- Co-authored-by: sundyli <[email protected]>
1 parent a856f11 commit 03f56f1

File tree

11 files changed

+87
-115
lines changed

11 files changed

+87
-115
lines changed

.cargo/audit.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,6 @@ ignore = [
4949
"RUSTSEC-2024-0371",
5050
# Remotely exploitable Denial of Service in Tonic, ignored temporarily
5151
"RUSTSEC-2024-0376",
52+
#rustls network-reachable panic in `Acceptor::accept`
53+
"RUSTSEC-2024-0399",
5254
]

.github/actions/build_linux/action.yml

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ runs:
3030
uses: ./.github/actions/setup_build_tool
3131
with:
3232
target: ${{ inputs.target }}
33-
bypass_env_vars: RUSTFLAGS,RUST_LOG
33+
bypass_env_vars: RUSTFLAGS,RUST_LOG,DATABEND_ENTERPRISE_LICENSE_PUBLIC_KEY
3434

3535
- name: Cross setup
3636
if: startsWith(inputs.target, 'aarch64-')
@@ -58,53 +58,31 @@ runs:
5858
flags=""
5959
;;
6060
esac
61-
echo "RUSTFLAGS=${flags} -C link-arg=-Wl,--compress-debug-sections=zlib" >> $GITHUB_ENV
61+
if [[ ! -z "${flags}" ]]; then
62+
echo "RUSTFLAGS=${flags}" >> $GITHUB_ENV
63+
fi
6264
target=${{ inputs.target }}
6365
echo "BUILD_ARCH=${target/-unknown-linux-*}" >> $GITHUB_ENV
6466
65-
# build all binaries for debug
66-
- name: Build Debug
67-
if: env.BUILD_PROFILE == 'debug' && inputs.artifacts == 'all'
68-
shell: bash
69-
run: |
70-
artifacts="meta,metactl,metabench,query,sqllogictests"
71-
for artifact in ${artifacts//,/ }; do
72-
echo "==> building databend-$artifact ..."
73-
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin databend-$artifact
74-
done
75-
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }}
76-
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-*
77-
78-
- name: Build Debug for specific artifacts
79-
if: env.BUILD_PROFILE == 'debug' && inputs.artifacts != 'all'
80-
shell: bash
81-
run: |
82-
artifacts="${{ inputs.artifacts }}"
83-
for artifact in ${artifacts//,/ }; do
84-
echo "==> building databend-$artifact ..."
85-
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin databend-$artifact
86-
done
87-
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-$artifact
88-
8967
- name: Build Release
90-
if: env.BUILD_PROFILE == 'release' && inputs.artifacts == 'all'
68+
if: inputs.artifacts == 'all'
9169
shell: bash
9270
run: |
9371
artifacts="meta,metactl,metabench,query,sqllogictests"
9472
for artifact in ${artifacts//,/ }; do
9573
echo "==> building databend-$artifact ..."
96-
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --release --bin databend-$artifact
74+
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --profile ${{ env.BUILD_PROFILE }} --bin databend-$artifact
9775
done
9876
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-$artifact
9977
10078
- name: Build Release for specific artifacts
101-
if: env.BUILD_PROFILE == 'release' && inputs.artifacts != 'all'
79+
if: inputs.artifacts != 'all'
10280
shell: bash
10381
run: |
10482
artifacts="${{ inputs.artifacts }}"
10583
for artifact in ${artifacts//,/ }; do
10684
echo "==> building databend-$artifact ..."
107-
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --release --bin databend-$artifact
85+
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --profile ${{ env.BUILD_PROFILE }} --bin databend-$artifact
10886
done
10987
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-$artifact
11088

.github/workflows/dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
uses: ./.github/workflows/reuse.linux.yml
5151
secrets: inherit
5252
with:
53-
build_profile: debug
53+
build_profile: ci
5454
runner_provider: aws
5555
license_type: trial
5656

@@ -60,7 +60,7 @@ jobs:
6060
uses: ./.github/workflows/reuse.linux.hive.yml
6161
secrets: inherit
6262
with:
63-
build_profile: debug
63+
build_profile: ci
6464
runner_provider: aws
6565

6666
ready:

.github/workflows/reuse.linux.yml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ env:
2525

2626
jobs:
2727
check:
28-
runs-on: [self-hosted, X64, Linux, 8c32g, "${{ inputs.runner_provider }}"]
28+
runs-on: [ self-hosted, X64, Linux, 8c32g, "${{ inputs.runner_provider }}" ]
2929
steps:
3030
- uses: actions/checkout@v4
3131
with:
@@ -115,7 +115,7 @@ jobs:
115115
# artifacts: query
116116

117117
test_unit:
118-
runs-on: [self-hosted, X64, Linux, 8c32g, "${{ inputs.runner_provider }}"]
118+
runs-on: [ self-hosted, X64, Linux, 8c32g, "${{ inputs.runner_provider }}" ]
119119
steps:
120120
- uses: actions/checkout@v4
121121
with:
@@ -125,64 +125,64 @@ jobs:
125125
timeout-minutes: 60
126126

127127
test_metactl:
128-
runs-on: [self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}"]
129-
needs: [build, check]
128+
runs-on: [ self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}" ]
129+
needs: [ build, check ]
130130
steps:
131131
- uses: actions/checkout@v4
132132
- uses: ./.github/actions/test_metactl
133133
timeout-minutes: 10
134134

135135
test_compat_meta_query:
136-
runs-on: [self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}"]
137-
needs: [build, check]
136+
runs-on: [ self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}" ]
137+
needs: [ build, check ]
138138
steps:
139139
- uses: actions/checkout@v4
140140
- uses: ./.github/actions/test_compat_meta_query
141141
timeout-minutes: 10
142142

143143
test_compat_fuse:
144-
runs-on: [self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}"]
145-
needs: [build, check]
144+
runs-on: [ self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}" ]
145+
needs: [ build, check ]
146146
steps:
147147
- uses: actions/checkout@v4
148148
- uses: ./.github/actions/test_compat_fuse
149-
timeout-minutes: 20
149+
timeout-minutes: 10
150150

151151
test_compat_meta_meta:
152-
runs-on: [self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}"]
153-
needs: [build, check]
152+
runs-on: [ self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}" ]
153+
needs: [ build, check ]
154154
steps:
155155
- uses: actions/checkout@v4
156156
- uses: ./.github/actions/test_compat_meta_meta
157157
timeout-minutes: 20
158158

159159
test_logs:
160-
runs-on: [self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}"]
161-
needs: [build, check]
160+
runs-on: [ self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}" ]
161+
needs: [ build, check ]
162162
steps:
163163
- uses: actions/checkout@v4
164164
- uses: ./.github/actions/test_logs
165165
timeout-minutes: 20
166166

167167
test_meta_cluster:
168-
runs-on: [self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}"]
169-
needs: [build, check]
168+
runs-on: [ self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}" ]
169+
needs: [ build, check ]
170170
steps:
171171
- uses: actions/checkout@v4
172172
- uses: ./.github/actions/test_meta_cluster
173173
timeout-minutes: 10
174174

175175
test_stateless_standalone:
176-
runs-on: [self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}"]
177-
needs: [build, check]
176+
runs-on: [ self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}" ]
177+
needs: [ build, check ]
178178
steps:
179179
- uses: actions/checkout@v4
180180
- uses: ./.github/actions/test_stateless_standalone_linux
181181
timeout-minutes: 15
182182

183183
test_stateless_cluster:
184-
runs-on: [self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}"]
185-
needs: [build, check]
184+
runs-on: [ self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}" ]
185+
needs: [ build, check ]
186186
steps:
187187
- uses: actions/checkout@v4
188188
- uses: ./.github/actions/setup_license
@@ -193,8 +193,8 @@ jobs:
193193
timeout-minutes: 15
194194

195195
test_stateful_standalone:
196-
runs-on: [self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}"]
197-
needs: [build, check]
196+
runs-on: [ self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}" ]
197+
needs: [ build, check ]
198198
steps:
199199
- uses: actions/checkout@v4
200200
- uses: ./.github/actions/test_stateful_standalone_linux
@@ -206,8 +206,8 @@ jobs:
206206
name: test-stateful-standalone-linux
207207

208208
test_stateful_cluster:
209-
runs-on: [self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}"]
210-
needs: [build, check]
209+
runs-on: [ self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}" ]
210+
needs: [ build, check ]
211211
steps:
212212
- uses: actions/checkout@v4
213213
- uses: ./.github/actions/setup_license
@@ -224,16 +224,16 @@ jobs:
224224

225225
test_stateful_large_data:
226226
if: contains(github.event.pull_request.labels.*.name, 'ci-largedata')
227-
runs-on: [self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}"]
228-
needs: [build, check]
227+
runs-on: [ self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}" ]
228+
needs: [ build, check ]
229229
steps:
230230
- uses: actions/checkout@v4
231231
- uses: ./.github/actions/test_stateful_large_data
232232
timeout-minutes: 60
233233

234234
test_stateful_iceberg_rest:
235-
runs-on: [self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}"]
236-
needs: [build, check]
235+
runs-on: [ self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}" ]
236+
needs: [ build, check ]
237237
steps:
238238
- uses: actions/checkout@v4
239239
- uses: ./.github/actions/test_stateful_iceberg_rest_standalone
@@ -254,8 +254,8 @@ jobs:
254254
# continue-on-error: true
255255

256256
test_ee_standalone:
257-
needs: [build, check]
258-
runs-on: [self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}"]
257+
needs: [ build, check ]
258+
runs-on: [ self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}" ]
259259
steps:
260260
- uses: actions/checkout@v4
261261
- uses: ./.github/actions/setup_license
@@ -271,8 +271,8 @@ jobs:
271271
name: test-stateful-standalone-linux
272272

273273
test_ee_standalone_background:
274-
needs: [build, check]
275-
runs-on: [self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}"]
274+
needs: [ build, check ]
275+
runs-on: [ self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}" ]
276276
steps:
277277
- uses: actions/checkout@v4
278278
- uses: ./.github/actions/setup_bendsql
@@ -311,8 +311,8 @@ jobs:
311311
# name: test-stateful-standalone-fake-time-linux
312312

313313
test_ee_management_mode:
314-
needs: [build, check]
315-
runs-on: [self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}"]
314+
needs: [ build, check ]
315+
runs-on: [ self-hosted, X64, Linux, 2c8g, "${{ inputs.runner_provider }}" ]
316316
steps:
317317
- uses: actions/checkout@v4
318318
- uses: ./.github/actions/setup_bendsql
@@ -329,7 +329,7 @@ jobs:
329329
name: test-ee-management-mode-linux
330330

331331
sqllogic:
332-
needs: [build, check]
332+
needs: [ build, check ]
333333
uses: ./.github/workflows/reuse.sqllogic.yml
334334
secrets: inherit
335335
with:

Cargo.toml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -353,22 +353,24 @@ result_large_err = "allow"
353353
debug = 1
354354
lto = "thin"
355355
overflow-checks = false
356-
incremental = false
357-
opt-level = "s"
356+
opt-level = "s" ## defaults to be 3
357+
incremental = true
358358

359-
# codegen-units = 1 # Reduce number of codegen units to increase optimizations.
359+
[profile.ci]
360+
inherits = "release"
361+
overflow-checks = true
362+
incremental = false
363+
debug-assertions = true
360364

361365
# [profile.release.package]
362-
# arrow2 = { codegen-units = 4 }
363-
# common-functions = { codegen-units = 16 }
364366
# databend-query = { codegen-units = 4 }
365367
# databend-binaries = { codegen-units = 4 }
366368

367369
[profile.dev]
368370
split-debuginfo = "unpacked"
369-
overflow-checks = false
370-
# wait until https://github.com/rust-lang/rust/issues/100142 fixed
371-
incremental = false
371+
overflow-checks = true
372+
# Report to https://github.com/rust-lang/rust/issues/100142 if incremental works well
373+
incremental = true
372374

373375
[profile.dev.package]
374376
addr2line = { opt-level = 3 }

src/common/arrow/src/arrow/buffer/iterator.rs

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ use crate::arrow::trusted_len::TrustedLen;
1919
/// This crates' equivalent of [`std::vec::IntoIter`] for [`Buffer`].
2020
#[derive(Debug, Clone)]
2121
pub struct IntoIter<T: Copy> {
22-
values: Buffer<T>,
23-
index: usize,
24-
end: usize,
22+
buffer: Buffer<T>,
23+
current: *const T,
24+
end: *const T,
2525
}
2626

2727
impl<T: Copy> IntoIter<T> {
28-
/// Creates a new [`Buffer`]
2928
#[inline]
30-
pub fn new(values: Buffer<T>) -> Self {
31-
let end = values.len();
29+
pub fn new(buffer: Buffer<T>) -> Self {
30+
let ptr = buffer.as_ptr();
31+
let len = buffer.len();
3232
Self {
33-
values,
34-
index: 0,
35-
end,
33+
current: ptr,
34+
end: unsafe { ptr.add(len) },
35+
buffer,
3636
}
3737
}
3838
}
@@ -42,40 +42,30 @@ impl<T: Copy> Iterator for IntoIter<T> {
4242

4343
#[inline]
4444
fn next(&mut self) -> Option<Self::Item> {
45-
if self.index == self.end {
46-
return None;
45+
if self.current == self.end {
46+
None
47+
} else {
48+
let value = unsafe { *self.current };
49+
self.current = unsafe { self.current.add(1) };
50+
Some(value)
4751
}
48-
let old = self.index;
49-
self.index += 1;
50-
Some(*unsafe { self.values.get_unchecked(old) })
5152
}
5253

5354
#[inline]
5455
fn size_hint(&self) -> (usize, Option<usize>) {
55-
(self.end - self.index, Some(self.end - self.index))
56-
}
57-
58-
#[inline]
59-
fn nth(&mut self, n: usize) -> Option<Self::Item> {
60-
let new_index = self.index + n;
61-
if new_index > self.end {
62-
self.index = self.end;
63-
None
64-
} else {
65-
self.index = new_index;
66-
self.next()
67-
}
56+
let len = unsafe { self.end.offset_from(self.current) } as usize;
57+
(len, Some(len))
6858
}
6959
}
7060

7161
impl<T: Copy> DoubleEndedIterator for IntoIter<T> {
7262
#[inline]
7363
fn next_back(&mut self) -> Option<Self::Item> {
74-
if self.index == self.end {
64+
if self.current == self.end {
7565
None
7666
} else {
77-
self.end -= 1;
78-
Some(*unsafe { self.values.get_unchecked(self.end) })
67+
self.end = unsafe { self.end.sub(1) };
68+
Some(unsafe { *self.end })
7969
}
8070
}
8171
}

0 commit comments

Comments
 (0)