Skip to content

Commit f30601a

Browse files
authored
Merge branch 'main' into flatten-generated-modules
2 parents 9764d0c + 4860366 commit f30601a

11 files changed

Lines changed: 317 additions & 33 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,17 @@ jobs:
246246
JOB_TYPE: test
247247
JOB_NAME: units-8-runtime-${{matrix.java}}
248248
working-directory: ${{matrix.package}}
249+
required:
250+
needs: [ changes, split-units ]
251+
name: conditional-required-check
252+
if: ${{ always() }} # Always run even if any "needs" jobs fail
253+
runs-on: ubuntu-22.04
254+
steps:
255+
- name: Fail if any previous failure
256+
if: ${{ needs.changes.outputs.packages != '[]' && contains(needs.*.result, 'failure') }}
257+
run: exit 1
258+
- name: Success otherwise
259+
run: echo "Success!"
249260
windows:
250261
runs-on: windows-latest
251262
steps:
@@ -332,30 +343,3 @@ jobs:
332343
env:
333344
library_generation_image_tag: 2.68.0
334345
workspace_name: /workspace
335-
336-
# TODO: Uncomment the needed Github Actions
337-
# dependencies:
338-
# runs-on: ubuntu-latest
339-
# strategy:
340-
# matrix:
341-
# java: [8, 11, 17]
342-
# steps:
343-
# - uses: actions/checkout@v3
344-
# - uses: actions/setup-java@v3
345-
# with:
346-
# distribution: zulu
347-
# java-version: ${{matrix.java}}
348-
# - run: java -version
349-
# - run: .kokoro/dependencies.sh
350-
# clirr:
351-
# runs-on: ubuntu-latest
352-
# steps:
353-
# - uses: actions/checkout@v3
354-
# - uses: actions/setup-java@v3
355-
# with:
356-
# distribution: zulu
357-
# java-version: 8
358-
# - run: java -version
359-
# - run: .kokoro/build.sh
360-
# env:
361-
# JOB_TYPE: clirr

.github/workflows/google-auth-library-java-ci.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
filters: |
3535
library:
3636
- 'google-auth-library-java/**'
37+
- '.github/workflows/google-auth-library-java-ci.yaml'
3738
units-logging:
3839
needs: filter
3940
if: ${{ needs.filter.outputs.library == 'true' }}
@@ -54,3 +55,14 @@ jobs:
5455
BUILD_SUBDIR: google-auth-library-java
5556
JOB_TYPE: test
5657
SUREFIRE_JVM_OPT: "-P '!slf4j2x,slf4j2x-test'"
58+
required:
59+
needs: [ units-logging ]
60+
name: conditional-required-check
61+
if: ${{ always() }} # Always run even if any "needs" jobs fail
62+
runs-on: ubuntu-22.04
63+
steps:
64+
- name: Fail if any previous failure
65+
if: ${{ contains(needs.*.result, 'failure') }}
66+
run: exit 1
67+
- name: Success otherwise
68+
run: echo "Success!"

.github/workflows/hermetic-build-scripts-ci.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,14 @@ jobs:
9797
# exclude generated golden files
9898
# exclude owlbot until further refaction
9999
black --check hermetic_build --exclude "(library_generation/tests/resources/goldens)"
100+
required:
101+
needs: [ library-generation-unit-tests, library-generation-lint-shell, library-generation-lint-python ]
102+
name: conditional-required-check
103+
if: ${{ always() }} # Always run even if any "needs" jobs fail
104+
runs-on: ubuntu-22.04
105+
steps:
106+
- name: Fail if any previous failure
107+
if: ${{ contains(needs.*.result, 'failure') }}
108+
run: exit 1
109+
- name: Success otherwise
110+
run: echo "Success!"

.github/workflows/java-spanner-jdbc-ci.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
filters: |
3535
library:
3636
- 'java-spanner-jdbc/**'
37+
- '.github/workflows/java-spanner-jdbc-ci.yaml'
3738
units:
3839
needs: filter
3940
if: ${{ needs.filter.outputs.library == 'true' }}
@@ -141,3 +142,14 @@ jobs:
141142
JOB_TYPE: lint
142143
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
143144
BASE_SHA: ${{ github.event.pull_request.base.sha }}
145+
required:
146+
needs: [ units, units-java8, windows, dependencies, javadoc, lint ]
147+
name: conditional-required-check
148+
if: ${{ always() }} # Always run even if any "needs" jobs fail
149+
runs-on: ubuntu-22.04
150+
steps:
151+
- name: Fail if any previous failure
152+
if: ${{ contains(needs.*.result, 'failure') }}
153+
run: exit 1
154+
- name: Success otherwise
155+
run: echo "Success!"

.github/workflows/java-storage-nio-ci.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
filters: |
3535
library:
3636
- 'java-storage-nio/**'
37+
- '.github/workflows/java-storage-nio-ci.yaml'
3738
units:
3839
needs: filter
3940
if: ${{ needs.filter.outputs.library == 'true' }}
@@ -141,3 +142,14 @@ jobs:
141142
JOB_TYPE: lint
142143
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
143144
BASE_SHA: ${{ github.event.pull_request.base.sha }}
145+
required:
146+
needs: [ units, units-java8, windows, dependencies, javadoc, lint ]
147+
name: conditional-required-check
148+
if: ${{ always() }} # Always run even if any "needs" jobs fail
149+
runs-on: ubuntu-22.04
150+
steps:
151+
- name: Fail if any previous failure
152+
if: ${{ contains(needs.*.result, 'failure') }}
153+
run: exit 1
154+
- name: Success otherwise
155+
run: echo "Success!"

.github/workflows/sdk-platform-java-downstream.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
library:
2525
- 'sdk-platform-java/**'
2626
- .kokoro/downstream-compatibility.sh
27+
- .github/workflows/sdk-platform-java-downstream.yaml
2728
downstream-compatibility:
2829
needs: filter
2930
if: ${{ needs.filter.outputs.library == 'true' }}
@@ -71,3 +72,14 @@ jobs:
7172
sudo apt-get -y install libxml2-utils
7273
- name: Perform downstream compatibility testing
7374
run: .kokoro/downstream-compatibility-spring.sh
75+
required:
76+
needs: [ downstream-compatibility, downstream-compatibility-spring-generator ]
77+
name: conditional-required-check
78+
if: ${{ always() }} # Always run even if any "needs" jobs fail
79+
runs-on: ubuntu-22.04
80+
steps:
81+
- name: Fail if any previous failure
82+
if: ${{ contains(needs.*.result, 'failure') }}
83+
run: exit 1
84+
- name: Success otherwise
85+
run: echo "Success!"

.github/workflows/sdk-platform-java-downstream_unmanaged_dependency_check.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ on:
33
branches:
44
- main
55
pull_request:
6-
paths:
7-
- .github/workflows/sdk-platform-java-downstream_unmanaged_dependency_check.yaml
8-
- sdk-platform-java/java-shared-dependencies/**
96

107
name: sdk-platform-java Downstream Unmanaged Dependency Check
118
env:
@@ -22,7 +19,8 @@ jobs:
2219
with:
2320
filters: |
2421
library:
25-
- 'sdk-platform-java/**'
22+
- 'sdk-platform-java/java-shared-dependencies/**'
23+
- '.github/workflows/sdk-platform-java-downstream_unmanaged_dependency_check.yaml'
2624
validate:
2725
needs: filter
2826
if: ${{ needs.filter.outputs.library == 'true' }}
@@ -96,3 +94,14 @@ jobs:
9694
exit 1
9795
fi
9896
echo "Unmanaged dependency check passed"
97+
required:
98+
needs: [ validate ]
99+
name: conditional-required-check
100+
if: ${{ always() }} # Always run even if any "needs" jobs fail
101+
runs-on: ubuntu-22.04
102+
steps:
103+
- name: Fail if any previous failure
104+
if: ${{ contains(needs.*.result, 'failure') }}
105+
run: exit 1
106+
- name: Success otherwise
107+
run: echo "Success!"

gapic-libraries-bom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@
12591259
<dependency>
12601260
<groupId>com.google.cloud</groupId>
12611261
<artifactId>google-cloud-spanner-bom</artifactId>
1262-
<version>6.116.0</version><!-- {x-version-update:google-cloud-spanner:current} -->
1262+
<version>6.116.1</version><!-- {x-version-update:google-cloud-spanner:current} -->
12631263
<type>pom</type>
12641264
<scope>import</scope>
12651265
</dependency>
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* Copyright 2026 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.bigquery.jdbc;
18+
19+
import java.util.concurrent.ConcurrentHashMap;
20+
import java.util.concurrent.atomic.AtomicLong;
21+
22+
/**
23+
* Lightweight MDC implementation for the BigQuery JDBC driver using InheritableThreadLocal.
24+
* Allocates a dedicated, independent InheritableThreadLocal object per concrete BigQueryConnection
25+
* instance.
26+
*/
27+
public class BigQueryJdbcMdc {
28+
private static final AtomicLong nextId = new AtomicLong(1);
29+
private static final ConcurrentHashMap<BigQueryConnection, InheritableThreadLocal<String>>
30+
instanceLocals = new ConcurrentHashMap<>();
31+
private static final ConcurrentHashMap<BigQueryConnection, String> instanceIds =
32+
new ConcurrentHashMap<>();
33+
34+
/** Allocates an exclusive InheritableThreadLocal and registers the connection mapping. */
35+
private static final InheritableThreadLocal<String> currentConnectionId =
36+
new InheritableThreadLocal<>();
37+
38+
public static void registerInstance(BigQueryConnection connection, String id) {
39+
if (connection != null) {
40+
String cleanId =
41+
instanceIds.computeIfAbsent(
42+
connection,
43+
k -> {
44+
String suffix =
45+
(id != null && !id.isEmpty()) ? id : String.valueOf(nextId.getAndIncrement());
46+
return "JdbcConnection-" + suffix;
47+
});
48+
49+
currentConnectionId.set(cleanId);
50+
InheritableThreadLocal<String> threadLocal =
51+
instanceLocals.computeIfAbsent(connection, k -> new InheritableThreadLocal<>());
52+
threadLocal.set(cleanId);
53+
}
54+
}
55+
56+
/**
57+
* Returns the connection ID carried by any registered active connection on the current thread.
58+
*/
59+
public static String getConnectionId() {
60+
return currentConnectionId.get();
61+
}
62+
63+
/** Clears the connection ID context from all active connection contexts on the current thread. */
64+
public static void removeInstance(BigQueryConnection connection) {
65+
if (connection != null) {
66+
InheritableThreadLocal<String> local = instanceLocals.remove(connection);
67+
if (local != null) {
68+
local.remove();
69+
}
70+
instanceIds.remove(connection);
71+
}
72+
}
73+
74+
public static void clear() {
75+
currentConnectionId.remove();
76+
for (InheritableThreadLocal<String> local : instanceLocals.values()) {
77+
local.remove();
78+
}
79+
}
80+
}

0 commit comments

Comments
 (0)