Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.

Commit b21c8ce

Browse files
authored
APPENG-1218: Ignore show databases queries from table access statistics (#49)
* APPENG-1218: Ignore show databases queries from table access statistics * APPENG-1218: Update outdated github actions
1 parent 58ea514 commit b21c8ce

File tree

5 files changed

+22
-24
lines changed

5 files changed

+22
-24
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,40 +32,30 @@ jobs:
3232
MYSQL_DATABASE: mydb
3333
steps:
3434
- name: Checkout repository
35-
uses: actions/checkout@v3
35+
uses: actions/checkout@v4
3636
- name: Set up JDK 17
37-
uses: actions/setup-java@v3
37+
uses: actions/setup-java@v4
3838
with:
3939
java-version: '17'
4040
distribution: 'zulu'
4141
- name: Setup Gradle
42-
uses: gradle/gradle-build-action@v2
42+
uses: gradle/actions/setup-gradle@v4
4343
with:
4444
gradle-home-cache-cleanup: true
4545
# Comment out when you are upgrading gradle in a branch and doing tons of commits you would need to test.
4646
# cache-read-only: false
4747
- name: "Assemble jar"
48-
uses: gradle/gradle-build-action@v2
49-
with:
50-
arguments: assemble --console=plain --info --stacktrace --parallel
48+
run: ./gradlew assemble --console=plain --info --stacktrace --parallel
5149
- name: "Compile tests"
52-
uses: gradle/gradle-build-action@v2
53-
with:
54-
arguments: compileTest --console=plain --info --stacktrace --parallel
50+
run: ./gradlew compileTest --console=plain --info --stacktrace --parallel
5551
- name: "Run checks"
56-
uses: gradle/gradle-build-action@v2
57-
with:
58-
arguments: check -x test --console=plain --stacktrace
52+
run: ./gradlew check -x test --console=plain --stacktrace
5953
- name: "Run tests"
60-
uses: gradle/gradle-build-action@v2
61-
with:
62-
arguments: -Dspring.profiles.include=continuous-integration test --console=plain --info --stacktrace
54+
run: ./gradlew -Dspring.profiles.include=continuous-integration test --console=plain --info --stacktrace
6355
- name: "Test if publishing works"
64-
uses: gradle/gradle-build-action@v2
65-
with:
66-
arguments: publishToMavenLocal --console=plain --info --stacktrace
56+
run: ./gradlew publishToMavenLocal --console=plain --info --stacktrace
6757
- name: "Publish Test Report"
68-
uses: mikepenz/action-junit-report@v3
58+
uses: mikepenz/action-junit-report@v5
6959
if: always()
7060
with:
7161
check_name: Test Report-(${{ matrix.spring_boot_version }})
@@ -89,7 +79,7 @@ jobs:
8979
tar -zcvf all-test-reports-${{ matrix.spring_boot_version }}.tar.gz **/build/reports
9080
if: always()
9181
- name: "Store test results"
92-
uses: actions/upload-artifact@v3
82+
uses: actions/upload-artifact@v4
9383
if: always()
9484
with:
9585
name: all-test-reports-${{ matrix.spring_boot_version }}
@@ -109,9 +99,9 @@ jobs:
10999
if: ${{ needs.matrix_build.result != 'success' }}
110100
run: exit 1
111101
- name: Checkout repository
112-
uses: actions/checkout@v3
102+
uses: actions/checkout@v4
113103
- name: Setup Gradle
114-
uses: gradle/gradle-build-action@v2
104+
uses: gradle/actions/setup-gradle@v4
115105
with:
116106
gradle-home-cache-cleanup: true
117107
# Comment out when you are upgrading gradle in a branch and doing tons of commits you would need to test.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
66
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.16.5] - 2025-05-08
9+
10+
### Changed
11+
12+
* Ignore "SHOW DATABASES ..." queries, which are generated by flyway-mysql 10.15.1+ and fail to be parsed by JSQLParser
13+
814
## [2.16.4] - 2024-12-06
915

1016
### Added

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=2.16.4
1+
version=2.16.5

tw-entrypoints/src/main/java/com/transferwise/common/entrypoints/tableaccessstatistics/DefaultTasQueryParsingInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
public class DefaultTasQueryParsingInterceptor implements TasQueryParsingInterceptor {
77

8-
private static final Pattern PG_SET_PATTERN = Pattern.compile("(?is)SET\\s+[a-z_]*\\s+TO\\s+.*|EXPLAIN\\s+.*");
8+
private static final Pattern PG_SET_PATTERN = Pattern.compile("(?is)SET\\s+[a-z_]*\\s+TO\\s+.*|EXPLAIN\\s+.*|SHOW DATABASES\\s+.*");
99

1010
@Override
1111
public InterceptResult intercept(String sql) {

tw-entrypoints/src/test/java/com/transferwise/common/entrypoints/tableaccessstatistics/SqlParserUtilsTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ void testJSqlParser() {
5050
testCases.add(new TestCase("explain (FORMAT JSON) select * from fx.request where id = 1",
5151
List.of()));
5252

53+
testCases.add(new TestCase("SHOW DATABASES LIKE 'RDSAdmin'", List.of()));
54+
5355
testCases.add(new TestCase("insert into fin_unique_tw_task_key(task_id,key_hash,key) values(?, ?, ?) on conflict (key_hash, key) do nothing",
5456
List.of("fin_unique_tw_task_key")));
5557

0 commit comments

Comments
 (0)