From e58b57c718196614c8835db7accb0e6dc64c1654 Mon Sep 17 00:00:00 2001 From: Vivek Dhiman Date: Mon, 15 Sep 2025 03:28:24 -0700 Subject: [PATCH 1/8] Created deep-test.yml --- .github/workflows/deep-test.yml | 74 +++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/deep-test.yml diff --git a/.github/workflows/deep-test.yml b/.github/workflows/deep-test.yml new file mode 100644 index 000000000000..8f066057dd90 --- /dev/null +++ b/.github/workflows/deep-test.yml @@ -0,0 +1,74 @@ +name: "Deepbi Unit & Integration Tests Workflow" + +on: + workflow_dispatch: + +jobs: + unit-tests: + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + java: [ 11, 17 ] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ matrix.java }} + cache: maven + + - name: Run unit tests + run: | + echo ">>> Running unit tests on JDK ${{ matrix.java }}" + mvn -B -ff -q test + + - name: Upload unit test reports + if: always() + uses: actions/upload-artifact@v4 + with: + name: unit-test-reports-jdk-${{ matrix.java }} + path: | + **/target/surefire-reports/*.xml + **/target/surefire-reports/*.txt + **/target/surefire-reports/*.dump + **/target/surefire-reports/*.out + + integration-tests: + runs-on: ubuntu-latest + needs: unit-tests + strategy: + fail-fast: true + matrix: + java: [ 11, 17 ] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ matrix.java }} + cache: maven + + - name: Run integration tests + run: | + echo ">>> Running integration tests on JDK ${{ matrix.java }}" + mvn -B -ff -q verify -P integration-tests + + - name: Upload integration test reports + if: always() + uses: actions/upload-artifact@v4 + with: + name: integration-test-reports-jdk-${{ matrix.java }} + path: | + **/target/failsafe-reports/*.xml + **/target/failsafe-reports/*.txt + **/target/failsafe-reports/*.dump + **/target/failsafe-reports/*.out From 93f3450473f81682940dcbe07019f2c10c436ecc Mon Sep 17 00:00:00 2001 From: Vivek Dhiman Date: Wed, 17 Sep 2025 21:49:37 -0700 Subject: [PATCH 2/8] Create deepbi-integration-test.yml --- .github/workflows/deepbi-integration-test.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/workflows/deepbi-integration-test.yml diff --git a/.github/workflows/deepbi-integration-test.yml b/.github/workflows/deepbi-integration-test.yml new file mode 100644 index 000000000000..30067162fa42 --- /dev/null +++ b/.github/workflows/deepbi-integration-test.yml @@ -0,0 +1,8 @@ +name: "Deepbi Integration Tests Workflow" + +on: + workflow_dispatch: + +jobs: + call-existing: + uses: ./.github/workflows/unit-and-integration-tests-unified.yml From de4083234d47c30d9b9bf827fc0a34b054bcc418 Mon Sep 17 00:00:00 2001 From: Vivek Dhiman Date: Sat, 20 Sep 2025 20:32:47 -0700 Subject: [PATCH 3/8] Created deep-release.yml --- .github/workflows/deep-release.yml | 57 ++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/deep-release.yml diff --git a/.github/workflows/deep-release.yml b/.github/workflows/deep-release.yml new file mode 100644 index 000000000000..3eb18e3a592e --- /dev/null +++ b/.github/workflows/deep-release.yml @@ -0,0 +1,57 @@ +name: "Deepbi Release Workflow" + +on: + workflow_dispatch: + +jobs: + build-and-release: + runs-on: ubuntu-latest + permissions: write-all + + steps: + - name: Release Branch Name Validation + run: | + if [[ ! "$GITHUB_REF" =~ ^refs/heads/deep/.*$ ]]; then + echo "Release workflow only valid for deep/x branches" + exit 1 + fi + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '11' + cache: 'maven' + + - name: Build Druid + run: mvn clean install -Papache-release,dist -DskipTests -Dgpg.skip=true -Dcheckstyle.skip -Ddependency-check.skip=true -B + + - name: Get version from pom.xml + id: get-version + run: | + version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + echo "Project version: $version" + echo "content=$version" >> $GITHUB_OUTPUT + + - name: List Artifacts + id: list-artifacts + run: | + echo "Listing all files in distribution/target:" + echo Version: ${{ steps.get-version.outputs.content }} + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.get-version.outputs.content }} + name: "Release ${{ steps.get-version.outputs.content }}" + draft: true + prerelease: true + files: | + distribution/target/apache-druid-${{ steps.get-version.outputs.content }}-bin.tar.gz + distribution/target/apache-druid-${{ steps.get-version.outputs.content }}-bin.tar.gz.sha512 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 3d7f809d97579debcaa6b58575bfb183a1822a25 Mon Sep 17 00:00:00 2001 From: Misha Date: Thu, 27 Nov 2025 13:08:48 +0100 Subject: [PATCH 4/8] Replaced Release Workflow in master with a placeholder --- .github/workflows/deep-release.yml | 53 +++--------------------------- 1 file changed, 5 insertions(+), 48 deletions(-) diff --git a/.github/workflows/deep-release.yml b/.github/workflows/deep-release.yml index 3eb18e3a592e..ee6e14afe979 100644 --- a/.github/workflows/deep-release.yml +++ b/.github/workflows/deep-release.yml @@ -1,57 +1,14 @@ +# placeholder so that release workflow can be triggered name: "Deepbi Release Workflow" on: workflow_dispatch: jobs: - build-and-release: + disabled-on-master: runs-on: ubuntu-latest - permissions: write-all - steps: - - name: Release Branch Name Validation + - name: Disabled on master run: | - if [[ ! "$GITHUB_REF" =~ ^refs/heads/deep/.*$ ]]; then - echo "Release workflow only valid for deep/x branches" - exit 1 - fi - - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up JDK 11 - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '11' - cache: 'maven' - - - name: Build Druid - run: mvn clean install -Papache-release,dist -DskipTests -Dgpg.skip=true -Dcheckstyle.skip -Ddependency-check.skip=true -B - - - name: Get version from pom.xml - id: get-version - run: | - version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) - echo "Project version: $version" - echo "content=$version" >> $GITHUB_OUTPUT - - - name: List Artifacts - id: list-artifacts - run: | - echo "Listing all files in distribution/target:" - echo Version: ${{ steps.get-version.outputs.content }} - - - name: Create Release - id: create_release - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ steps.get-version.outputs.content }} - name: "Release ${{ steps.get-version.outputs.content }}" - draft: true - prerelease: true - files: | - distribution/target/apache-druid-${{ steps.get-version.outputs.content }}-bin.tar.gz - distribution/target/apache-druid-${{ steps.get-version.outputs.content }}-bin.tar.gz.sha512 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + echo "::error::This workflow is a placeholder on master. Use the deep/* release branches." + exit 1 \ No newline at end of file From 57df8d33fe0ff2baa70ebca66ced2a27953f38e2 Mon Sep 17 00:00:00 2001 From: Misha Date: Thu, 27 Nov 2025 14:39:28 +0100 Subject: [PATCH 5/8] Licence added to a workflows --- .github/workflows/deep-release.yml | 15 ++++ .github/workflows/deep-test.yml | 74 ------------------- .github/workflows/deepbi-integration-test.yml | 15 ++++ 3 files changed, 30 insertions(+), 74 deletions(-) delete mode 100644 .github/workflows/deep-test.yml diff --git a/.github/workflows/deep-release.yml b/.github/workflows/deep-release.yml index ee6e14afe979..fac40205c178 100644 --- a/.github/workflows/deep-release.yml +++ b/.github/workflows/deep-release.yml @@ -1,3 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # placeholder so that release workflow can be triggered name: "Deepbi Release Workflow" diff --git a/.github/workflows/deep-test.yml b/.github/workflows/deep-test.yml deleted file mode 100644 index 8f066057dd90..000000000000 --- a/.github/workflows/deep-test.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: "Deepbi Unit & Integration Tests Workflow" - -on: - workflow_dispatch: - -jobs: - unit-tests: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - java: [ 11, 17 ] - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: ${{ matrix.java }} - cache: maven - - - name: Run unit tests - run: | - echo ">>> Running unit tests on JDK ${{ matrix.java }}" - mvn -B -ff -q test - - - name: Upload unit test reports - if: always() - uses: actions/upload-artifact@v4 - with: - name: unit-test-reports-jdk-${{ matrix.java }} - path: | - **/target/surefire-reports/*.xml - **/target/surefire-reports/*.txt - **/target/surefire-reports/*.dump - **/target/surefire-reports/*.out - - integration-tests: - runs-on: ubuntu-latest - needs: unit-tests - strategy: - fail-fast: true - matrix: - java: [ 11, 17 ] - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: ${{ matrix.java }} - cache: maven - - - name: Run integration tests - run: | - echo ">>> Running integration tests on JDK ${{ matrix.java }}" - mvn -B -ff -q verify -P integration-tests - - - name: Upload integration test reports - if: always() - uses: actions/upload-artifact@v4 - with: - name: integration-test-reports-jdk-${{ matrix.java }} - path: | - **/target/failsafe-reports/*.xml - **/target/failsafe-reports/*.txt - **/target/failsafe-reports/*.dump - **/target/failsafe-reports/*.out diff --git a/.github/workflows/deepbi-integration-test.yml b/.github/workflows/deepbi-integration-test.yml index 30067162fa42..740649181207 100644 --- a/.github/workflows/deepbi-integration-test.yml +++ b/.github/workflows/deepbi-integration-test.yml @@ -1,3 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: "Deepbi Integration Tests Workflow" on: From 128b3e9bf3c4b1550c186184efdae086170109ce Mon Sep 17 00:00:00 2001 From: Misha Date: Thu, 27 Nov 2025 15:13:38 +0100 Subject: [PATCH 6/8] renamed release flowfile for consistency --- .github/workflows/{deep-release.yml => deepbi-release.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{deep-release.yml => deepbi-release.yml} (100%) diff --git a/.github/workflows/deep-release.yml b/.github/workflows/deepbi-release.yml similarity index 100% rename from .github/workflows/deep-release.yml rename to .github/workflows/deepbi-release.yml From 81c97736fce3c1f78ca5c2eeb1eb7b48337072c5 Mon Sep 17 00:00:00 2001 From: Vivek Dhiman Date: Fri, 19 Jun 2026 16:32:53 +0530 Subject: [PATCH 7/8] Fix invalid clock comparison --- .github/workflows/deepbi-integration-test.yml | 23 --------------- .github/workflows/deepbi-release.yml | 29 ------------------- .../metadata/SqlSegmentsMetadataManager.java | 2 +- 3 files changed, 1 insertion(+), 53 deletions(-) delete mode 100644 .github/workflows/deepbi-integration-test.yml delete mode 100644 .github/workflows/deepbi-release.yml diff --git a/.github/workflows/deepbi-integration-test.yml b/.github/workflows/deepbi-integration-test.yml deleted file mode 100644 index 740649181207..000000000000 --- a/.github/workflows/deepbi-integration-test.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: "Deepbi Integration Tests Workflow" - -on: - workflow_dispatch: - -jobs: - call-existing: - uses: ./.github/workflows/unit-and-integration-tests-unified.yml diff --git a/.github/workflows/deepbi-release.yml b/.github/workflows/deepbi-release.yml deleted file mode 100644 index fac40205c178..000000000000 --- a/.github/workflows/deepbi-release.yml +++ /dev/null @@ -1,29 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# placeholder so that release workflow can be triggered -name: "Deepbi Release Workflow" - -on: - workflow_dispatch: - -jobs: - disabled-on-master: - runs-on: ubuntu-latest - steps: - - name: Disabled on master - run: | - echo "::error::This workflow is a placeholder on master. Use the deep/* release branches." - exit 1 \ No newline at end of file diff --git a/server/src/main/java/org/apache/druid/metadata/SqlSegmentsMetadataManager.java b/server/src/main/java/org/apache/druid/metadata/SqlSegmentsMetadataManager.java index d18ad5a0b2a2..557611004823 100644 --- a/server/src/main/java/org/apache/druid/metadata/SqlSegmentsMetadataManager.java +++ b/server/src/main/java/org/apache/druid/metadata/SqlSegmentsMetadataManager.java @@ -557,6 +557,7 @@ boolean useLatestSnapshotIfWithinDelay() void forceOrWaitOngoingDatabasePoll() { long checkStartTime = System.currentTimeMillis(); + long checkStartTimeNanos = System.nanoTime(); ReentrantReadWriteLock.WriteLock lock = startStopPollLock.writeLock(); lock.lock(); try { @@ -569,7 +570,6 @@ void forceOrWaitOngoingDatabasePoll() } // Verify if there was a on-demand poll completed while we were waiting for the lock if (latestDatabasePoll instanceof OnDemandDatabasePoll) { - long checkStartTimeNanos = TimeUnit.MILLISECONDS.toNanos(checkStartTime); OnDemandDatabasePoll latestOnDemandPoll = (OnDemandDatabasePoll) latestDatabasePoll; if (latestOnDemandPoll.initiationTimeNanos > checkStartTimeNanos) { return; From 49b75359e02704f74a2e88508f383cd145ff7b4a Mon Sep 17 00:00:00 2001 From: Vivek Dhiman Date: Mon, 22 Jun 2026 12:01:09 +0530 Subject: [PATCH 8/8] Address review comment Signed-off-by: Vivek Dhiman --- .../druid/metadata/SqlSegmentsMetadataManager.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/main/java/org/apache/druid/metadata/SqlSegmentsMetadataManager.java b/server/src/main/java/org/apache/druid/metadata/SqlSegmentsMetadataManager.java index 557611004823..b2d4e67d8f55 100644 --- a/server/src/main/java/org/apache/druid/metadata/SqlSegmentsMetadataManager.java +++ b/server/src/main/java/org/apache/druid/metadata/SqlSegmentsMetadataManager.java @@ -90,7 +90,7 @@ static class PeriodicDatabasePoll implements DatabasePoll * leadership changes. */ final CompletableFuture firstPollCompletionFuture = new CompletableFuture<>(); - long lastPollStartTimestampInMs = -1; + long lastPollStartTimestampInNanos = -1; } /** @@ -429,7 +429,7 @@ private Runnable createPollTaskForStartOrder(long startOrder, PeriodicDatabasePo lock.lock(); try { if (startOrder == currentStartPollingOrder) { - periodicDatabasePoll.lastPollStartTimestampInMs = System.currentTimeMillis(); + periodicDatabasePoll.lastPollStartTimestampInNanos = System.nanoTime(); poll(); periodicDatabasePoll.firstPollCompletionFuture.complete(null); latestDatabasePoll = periodicDatabasePoll; @@ -556,7 +556,6 @@ boolean useLatestSnapshotIfWithinDelay() @VisibleForTesting void forceOrWaitOngoingDatabasePoll() { - long checkStartTime = System.currentTimeMillis(); long checkStartTimeNanos = System.nanoTime(); ReentrantReadWriteLock.WriteLock lock = startStopPollLock.writeLock(); lock.lock(); @@ -565,13 +564,14 @@ void forceOrWaitOngoingDatabasePoll() try { //Verify if there was a periodic poll completed while we were waiting for the lock if (latestDatabasePoll instanceof PeriodicDatabasePoll - && ((PeriodicDatabasePoll) latestDatabasePoll).lastPollStartTimestampInMs > checkStartTime) { + && ((PeriodicDatabasePoll) latestDatabasePoll).lastPollStartTimestampInNanos > checkStartTimeNanos) { return; } - // Verify if there was a on-demand poll completed while we were waiting for the lock + // Verify if there was an on-demand poll completed while we were waiting for the lock if (latestDatabasePoll instanceof OnDemandDatabasePoll) { OnDemandDatabasePoll latestOnDemandPoll = (OnDemandDatabasePoll) latestDatabasePoll; if (latestOnDemandPoll.initiationTimeNanos > checkStartTimeNanos) { + Futures.getUnchecked(latestOnDemandPoll.pollCompletionFuture); return; } }