diff --git a/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy b/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy index d8c75391ae22..352fc1bdcc42 100644 --- a/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy +++ b/build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy @@ -122,7 +122,7 @@ class DependencyConstraints { // Pinning transitive dependency from spring-security-oauth2 to clean up our licenses. api(group: 'com.nimbusds', name: 'oauth2-oidc-sdk', version: '8.9') api(group: 'jakarta.activation', name: 'jakarta.activation-api', version: get('jakarta.activation.version')) - api(group: 'com.sun.istack', name: 'istack-commons-runtime', version: '4.0.1') + api(group: 'com.sun.istack', name: 'istack-commons-runtime', version: '4.1.1') api(group: 'jakarta.mail', name: 'jakarta.mail-api', version: get('jakarta.mail.version')) api(group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: get('jakarta.xml.bind.version')) api(group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '4.0.2') @@ -232,6 +232,10 @@ class DependencyConstraints { entry('jackson-datatype-jsr310') } + dependencySet(group: 'com.fasterxml.jackson.dataformat', version: get('jackson.version')) { + entry('jackson-dataformat-yaml') + } + dependencySet(group: 'com.jayway.jsonpath', version: '2.7.0') { entry('json-path-assert') entry('json-path') diff --git a/build-tools/scripts/src/main/groovy/geode-test.gradle b/build-tools/scripts/src/main/groovy/geode-test.gradle index 93488986e512..602f0b731651 100644 --- a/build-tools/scripts/src/main/groovy/geode-test.gradle +++ b/build-tools/scripts/src/main/groovy/geode-test.gradle @@ -182,7 +182,6 @@ gradle.taskGraph.whenReady({ graph -> if (project.hasProperty('testJVMVer') && testJVMVer.toInteger() >= 9) { jvmArgs += [ "--add-opens=java.base/java.io=ALL-UNNAMED", - "--add-opens=java.base/java.lang=ALL-UNNAMED", "--add-opens=java.base/java.lang.annotation=ALL-UNNAMED", "--add-opens=java.base/java.lang.module=ALL-UNNAMED", "--add-opens=java.base/java.lang.ref=ALL-UNNAMED", diff --git a/ci/docker/cache_dependencies.sh b/ci/docker/cache_dependencies.sh index 0b72de826c0d..4088a58980b5 100644 --- a/ci/docker/cache_dependencies.sh +++ b/ci/docker/cache_dependencies.sh @@ -20,7 +20,7 @@ set -e WORK_DIR=$(mktemp -d) pushd ${WORK_DIR} - git clone -b develop --depth 1 https://github.com/apache/geode.git geode + git clone -b support/2.0 --depth 1 https://github.com/apache/geode.git geode pushd geode ./gradlew --no-daemon --console=plain --info resolveDependencies diff --git a/ci/images/google-geode-builder/scripts/cache_dependencies.sh b/ci/images/google-geode-builder/scripts/cache_dependencies.sh index ef56172a9b74..e41f225230e7 100644 --- a/ci/images/google-geode-builder/scripts/cache_dependencies.sh +++ b/ci/images/google-geode-builder/scripts/cache_dependencies.sh @@ -28,7 +28,7 @@ if [ -z ${JAVA_HOME} ]; then fi pushd ${WORK_DIR} - git clone -b develop --depth 1 https://github.com/apache/geode.git geode + git clone -b support/2.0 --depth 1 https://github.com/apache/geode.git geode pushd geode ./gradlew --no-daemon --console=plain --info resolveDependencies diff --git a/dev-tools/release/README.md b/dev-tools/release/README.md index a5a51e20bb15..4bc08cde7dfb 100644 --- a/dev-tools/release/README.md +++ b/dev-tools/release/README.md @@ -1,31 +1 @@ -# geode/dev-tools/release -This directory contains scripts to help create a release of Geode and manage branches. - -Not all release steps have scripts. Please follow all instructions as documented in the wiki: [Releasing Apache Geode](https://cwiki.apache.org/confluence/display/GEODE/Releasing+Apache+Geode). - -These scripts are intended to be run from the parent directory of your geode develop checkout, e.g.: - - $ cd .. - $ geode/dev-tools/release/foo.sh - -## Overview of scripts - -**license\_review.sh** compares versions with a previous release and/or checks that all bundled dependencies are noted in appropriate LICENSE file - -**create\_support\_branches.sh** cuts support/x.y from develop for all projects and walks you through creating pipelines and setting version numbers - -**set\_copyright.sh** updates the copyright year - -**set\_versions.sh** updates files that need to contain the version number planned for the next release from this support branch - -**prepare\_rc.sh** Checks out the various geode repos, builds a release candidate, and publishes to nexus staging repo - -**commit\_rc.sh** Pushes the tags and artifacts staged by prepare\_rc.sh and then runs print\_rc\_email.sh - -**print\_rc\_email.sh** Generates an email to send to the dev list announcing a release candidate - -**promote\_rc.sh** Tags an RC as the final release, builds docker images, merges to master, uploads to mirrors, and starts the brew process - -**print\_annouce\_email.sh** Generates an email to send to all lists announcing a release - -**end\_of\_support.sh** cleans up pipelines and branches after N-2 support lifetime is reached +See [Releasing Apache Geode](https://cwiki.apache.org/confluence/display/GEODE/Releasing+Apache+Geode) diff --git a/dev-tools/release/commit_rc.sh b/dev-tools/release/commit_rc.sh deleted file mode 100755 index eb454795bf75..000000000000 --- a/dev-tools/release/commit_rc.sh +++ /dev/null @@ -1,163 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - -set -e - -usage() { - echo "Usage: commit_rc.sh -j ticket -v version_number -m maven_repo_id" - echo " -j The GEODE-nnnnn Jira identifier for this release" - echo " -v The #.#.#.RC# version number" - echo " -m The 4 digit id of the nexus maven repo" - exit 1 -} - -JIRA="" -FULL_VERSION="" -MAVEN="" - -while getopts ":j:v:m:" opt; do - case ${opt} in - j ) - JIRA=$OPTARG - ;; - v ) - FULL_VERSION=$OPTARG - ;; - m ) - MAVEN=$OPTARG - ;; - \? ) - usage - ;; - esac -done - -if [[ ${JIRA} == "" ]] || [[ ${FULL_VERSION} == "" ]] || [[ ${MAVEN} == "" ]]; then - usage -fi - -if [[ $FULL_VERSION =~ ^([0-9]+\.[0-9]+\.[0-9]+)\.(RC[0-9]+)$ ]]; then - VERSION=${BASH_REMATCH[1]} -else - echo "Malformed version number ${FULL_VERSION}. Example valid version: 1.9.0.RC1" - exit 1 -fi - -VERSION_MM=${VERSION%.*} - -set -x -WORKSPACE=$PWD/release-${VERSION}-workspace -GEODE=$WORKSPACE/geode -GEODE_EXAMPLES=$WORKSPACE/geode-examples -GEODE_NATIVE=$WORKSPACE/geode-native -GEODE_BENCHMARKS=$WORKSPACE/geode-benchmarks -SVN_DIR=$WORKSPACE/dist/dev/geode -set +x - -if [ -d "$GEODE" ] && [ -d "$GEODE_EXAMPLES" ] && [ -d "$GEODE_NATIVE" ] && [ -d "$GEODE_BENCHMARKS" ] && [ -d "$SVN_DIR" ] ; then - true -else - echo "Please run this script from the same working directory as you initially ran prepare_rc.sh" - exit 1 -fi - - -function failMsg { - errln=$1 - echo "ERROR: script did NOT complete successfully" - echo "Comment out any steps that already succeeded (approximately lines 87-$(( errln - 1 ))) and try again" -} -trap 'failMsg $LINENO' ERR - - -echo "" -echo "============================================================" -echo "Publishing artifacts to apache release location..." -echo "============================================================" -set -x -cd ${SVN_DIR} -svn commit -m "$JIRA: Release Apache Geode ${FULL_VERSION} - -Publish the source, binary, and checksum artifacts to ASF svn server, -from which they will be picked up and published within 15 minutes to -the URLs on https://geode.apache.org/releases/" -set +x - - -echo "" -echo "============================================================" -echo "Adding temporary commit for geode-examples to build against staged ${FULL_VERSION}..." -echo "============================================================" -set -x -cd ${GEODE_EXAMPLES} -set +x -sed -e 's#^geodeRepositoryUrl *=.*#geodeRepositoryUrl = https://repository.apache.org/content/repositories/orgapachegeode-'"${MAVEN}#" \ - -e 's#^geodeReleaseUrl *=.*#geodeReleaseUrl = https://dist.apache.org/repos/dist/dev/geode/'"${FULL_VERSION}#" -i.bak gradle.properties -rm gradle.properties.bak -set -x -git add gradle.properties -git diff --staged --color | cat -git commit -m "$JIRA: Set temporary staging repo - -This serves two purposes: it gives the RC pipeline a way to get the -nexus staging repo id needed for various tests, and it gives the -Jenkins server a valid configuration during the voting period." -git push -set +x - - -echo "" -echo "============================================================" -echo "Keeping -build.0 suffix" -echo "============================================================" -cd ${GEODE}/../.. -set -x -${0%/*}/set_versions.sh -j $JIRA -v ${VERSION} -s -n -w "${WORKSPACE}" -set +x - - -echo "" -echo "============================================================" -echo "Pushing copyrights, versions, and tags..." -echo "============================================================" -for DIR in ${GEODE} ${GEODE_EXAMPLES} ${GEODE_NATIVE} ${GEODE_BENCHMARKS} ; do - set -x - cd ${DIR} - git pull -r - git push -u origin - git push origin rel/v${FULL_VERSION} - set +x -done - - -echo "" -echo "============================================================" -echo "Done publishing the release candidate! Next steps:" -echo "============================================================" -cd ${GEODE}/../.. -echo "1. In a separate terminal window, ${0%/*}/deploy_rc_pipeline.sh -v ${VERSION_MM}" -echo "2. Monitor https://concourse.apachegeode-ci.info/teams/main/pipelines/apache-support-${VERSION_MM//./-}-rc until all green" -echo "3. If you haven't already, add a ${VERSION} section to https://cwiki.apache.org/confluence/display/GEODE/Release+Notes" -JIRABASE=https://issues.apache.org/jira/secure -jiraverid=$(curl -fs $JIRABASE'/ConfigureReleaseNote.jspa?projectId=12318420' | tr -d ' \n' | tr '<' '\n'| awk '/optionvalue.*'$VERSION'$/{sub(/optionvalue="/,"");sub(/">.*/,"");print}') -echo " The 'full list' link will be $JIRABASE/ReleaseNote.jspa?projectId=12318420&version=$jiraverid" -echo "4. Send the following email to announce the RC:" -echo "To: dev@geode.apache.org" -echo "Subject: [VOTE] Apache Geode ${FULL_VERSION}" -${0%/*}/print_rc_email.sh -v ${FULL_VERSION} -m ${MAVEN} -echo "" -which pbcopy >/dev/null && ${0%/*}/print_rc_email.sh -v ${FULL_VERSION} -m ${MAVEN} | pbcopy && echo "(copied to clipboard)" diff --git a/dev-tools/release/create_support_branches.sh b/dev-tools/release/create_support_branches.sh deleted file mode 100755 index c13e4111012d..000000000000 --- a/dev-tools/release/create_support_branches.sh +++ /dev/null @@ -1,292 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - -set -e - -usage() { - echo "Usage: create_support_branches.sh -j ticket -v version_number -g your_github_username" - echo " -j The GEODE-nnnnn Jira identifier for this release" - echo " -v The #.# version number of the support branch to create" - echo " -g Your github username" - exit 1 -} - -JIRA="" -VERSION_MM="" -GITHUB_USER="" - -while getopts ":j:v:g:" opt; do - case ${opt} in - j ) - JIRA=$OPTARG - ;; - v ) - VERSION_MM=$OPTARG - ;; - g ) - GITHUB_USER=$OPTARG - ;; - \? ) - usage - ;; - esac -done - -if [[ ${JIRA} == "" ]] || [[ ${VERSION_MM} == "" ]] || [[ ${GITHUB_USER} == "" ]] ; then - usage -fi - -if [[ $VERSION_MM =~ ^([0-9]+\.[0-9]+)$ ]]; then - true -else - echo "Malformed version number ${VERSION_MM}. Example valid version: 1.9" - exit 1 -fi - -MAJOR=${VERSION_MM%.*} -MINOR=${VERSION_MM#*.} - -#tip: hardcode NEWMAJOR and NEWMINOR as needed if jumping to a new major -NEWMAJOR=${MAJOR} -NEWMINOR=$((MINOR + 1)) - -NEWVERSION_MM=${NEWMAJOR}.${NEWMINOR} -NEWVERSION_MM_NODOT=${NEWVERSION_MM//./} -NEWVERSION=${NEWVERSION_MM}.0 - -set -x -WORKSPACE=$PWD/support-${VERSION_MM}-workspace -GEODE=$WORKSPACE/geode -GEODE_DEVELOP=$WORKSPACE/geode-develop -GEODE_EXAMPLES=$WORKSPACE/geode-examples -GEODE_EXAMPLES_DEVELOP=$WORKSPACE/geode-examples-develop -GEODE_NATIVE=$WORKSPACE/geode-native -GEODE_BENCHMARKS=$WORKSPACE/geode-benchmarks -set +x - - -function failMsg1 { - echo "ERROR: script did NOT complete successfully. Please try again." -} -trap failMsg1 ERR - - -echo "" -echo "============================================================" -echo "Cleaning workspace directory..." -echo "============================================================" -set -x -rm -rf $WORKSPACE -mkdir -p $WORKSPACE -set +x - - -echo "" -echo "============================================================" -echo "Cloning repositories..." -echo "============================================================" -set -x -cd ${WORKSPACE} -git clone --single-branch --branch develop git@github.com:apache/geode.git -#(cd geode; git reset --hard $desired_sha) #uncomment if latest commit is not the desired branchpoint -git clone --single-branch --branch develop git@github.com:apache/geode.git geode-develop -git clone --single-branch --branch develop git@github.com:apache/geode-examples.git -git clone --single-branch --branch develop git@github.com:apache/geode-examples.git geode-examples-develop -git clone --single-branch --branch develop git@github.com:apache/geode-native.git -git clone --single-branch --branch develop git@github.com:apache/geode-benchmarks.git -set +x - - -function failMsg2 { - errln=$1 - echo "ERROR: script did NOT complete successfully" - echo "Comment out any steps that already succeeded (approximately lines 88-$(( errln - 1 ))) and try again" -} -trap 'failMsg2 $LINENO' ERR - - -cd ${GEODE}/../.. -set -x -${0%/*}/set_copyright.sh -j $JIRA ${GEODE} ${GEODE_DEVELOP} ${GEODE_EXAMPLES} ${GEODE_EXAMPLES_DEVELOP} ${GEODE_NATIVE} ${GEODE_BENCHMARKS} -set +x - - -echo "" -echo "============================================================" -echo "Creating support/${VERSION_MM} branches" -echo "============================================================" -for DIR in ${GEODE} ${GEODE_EXAMPLES} ${GEODE_NATIVE} ${GEODE_BENCHMARKS} ; do - set -x - cd ${DIR} - git checkout -b support/${VERSION_MM} - git push -u origin support/${VERSION_MM} - git remote set-branches --add origin support/${VERSION_MM} - set +x -done - - -echo "" -echo "============================================================" -echo "Bumping version on develop to ${NEWVERSION}" -echo "============================================================" -set -x -cd ${GEODE_DEVELOP} -git pull -r -git remote add myfork git@github.com:${GITHUB_USER}/geode.git || true -git checkout -b roll-develop-to-${NEWVERSION} -set +x - -#version = 1.13.0-build.0 -sed -e "s/^version =.*/version = ${NEWVERSION}-build.0/" -i.bak gradle.properties - -# initial_version: 1.13.0-((stuff)).0 -sed -e "s/^ initial_version:[^-]*\(-[^.0-9]*\)[.0-9]*/ initial_version: ${NEWVERSION}\1.0/" -i.bak ./ci/pipelines/shared/jinja.variables.yml - -VER=geode-serialization/src/main/java/org/apache/geode/internal/serialization/KnownVersion.java -[ -r $VER ] || VER=geode-serialization/src/main/java/org/apache/geode/internal/serialization/Version.java -#add the new ordinal and KnownVersion constants and set them as current&highest -CURORD=$(cat $VER | awk '/private static final short GEODE_.*_ORDINAL/{print $NF}' | tr -d ';' | sort -n | tail -1) -NEWORD=$(( CURORD + 10 )) -sed -e "s#/. NOTE: when adding a new version#private static final short GEODE_${NEWMAJOR}_${NEWMINOR}_0_ORDINAL = ${NEWORD};\\ -\\ - @Immutable\\ - public static final KnownVersion GEODE_${NEWMAJOR}_${NEWMINOR}_0 =\\ - new KnownVersion("'"'"GEODE"'"'", "'"'"${NEWMAJOR}.${NEWMINOR}.0"'"'", (byte) ${NEWMAJOR}, (byte) ${NEWMINOR}, (byte) 0, (byte) 0,\\ - GEODE_${NEWMAJOR}_${NEWMINOR}_0_ORDINAL);\\ -\\ - /* NOTE: when adding a new version#" \ - -e "/public static final KnownVersion CURRENT/s#GEODE[0-9_]*#GEODE_${NEWMAJOR}_${NEWMINOR}_0#" \ - -e "/public static final int HIGHEST_VERSION/s# = [0-9]*# = ${NEWORD}#" \ - -i.bak $VER - -# directory: docs/guide/113 -# product_version: '1.13' -# product_version_nodot: '113' -# product_version_geode: '1.13' -# product_version_old_minor: '1.12' -sed -E \ - -e "s#docs/guide/[0-9]+#docs/guide/${NEWVERSION_MM_NODOT}#" \ - -e "s#product_version: '[0-9.]+'#product_version: '${NEWVERSION_MM}'#" \ - -e "s#version_nodot: '[0-9]+'#version_nodot: '${NEWVERSION_MM_NODOT}'#" \ - -e "s#product_version_geode: '[0-9.]+'#product_version_geode: '${NEWVERSION_MM}'#" \ - -e "s#product_version_old_minor: '[0-9.]+'#product_version_old_minor: '${VERSION_MM}'#" \ - -i.bak geode-book/config.yml - -#rewrite '/', '/docs/guide/113/about_geode.html' -#rewrite '/index.html', '/docs/guide/113/about_geode.html' -sed -E -e "s#docs/guide/[0-9]+#docs/guide/${NEWVERSION_MM_NODOT}#" -i.bak geode-book/redirects.rb - -rm gradle.properties.bak ci/pipelines/shared/jinja.variables.yml.bak geode-book/config.yml.bak geode-book/redirects.rb.bak $VER.bak* -set -x -git add . -git diff --staged --color | cat - -./gradlew updateExpectedPom - -git commit -a -m "$JIRA: Roll develop to ${NEWVERSION} - -Now that support/${VERSION_MM} has been created, develop advances." -git push -u myfork -set +x - - -echo "" -echo "============================================================" -echo "Bumping examples version on develop to ${NEWVERSION}" -echo "============================================================" -set -x -cd ${GEODE_EXAMPLES_DEVELOP} -git pull -r -set +x - -#version = 1.13.0-build.0 -#geodeVersion = 1.13.0-build+ -sed \ - -e "s/^version =.*/version = ${NEWVERSION}-build.0/" \ - -e "s/^geodeVersion =.*/geodeVersion = ${NEWVERSION_MM}.+/" \ - -i.bak gradle.properties -rm gradle.properties.bak -set -x -git add gradle.properties -git diff --staged --color | cat -git commit -m "$JIRA: Update examples version - -Now that support/${VERSION_MM} has been created, -pair develop examples with ${NEWVERSION}" -git push -u origin -set +x - - -echo "" -echo "============================================================" -echo "Removing CODEOWNERS and duplicate scripts from support/${VERSION_MM}" -echo "============================================================" -set -x -cd ${GEODE}/dev-tools/release -git pull -r -git rm *.sh -cat << EOF > README.md -See [Releasing Apache Geode](https://cwiki.apache.org/confluence/display/GEODE/Releasing+Apache+Geode) -EOF -git add README.md -cd ${GEODE} -[ ! -r CODEOWNERS ] || git rm CODEOWNERS -[ ! -r CODEWATCHERS ] || git rm CODEWATCHERS -git commit -m "$JIRA: Remove unneeded scripts - -Remove likely-to-become-outdated copies of release scripts to ensure -they are not run by accident from a branch (they should always be run -from develop). - -Also remove CODEOWNERS to avoid the confusion of GitHub showing owner -names like on develop, but codeowner reviews not actually being -required (due to lack of branch protection or minimum review count on -support branches)" -git push -u origin -set +x - - -echo "" -echo "============================================================" -echo "Setting version on support/${VERSION_MM}" -echo "============================================================" -cd ${GEODE}/../.. -set -x -${0%/*}/set_versions.sh -j $JIRA -v ${VERSION_MM}.0 -s -w "${WORKSPACE}" -set +x - - -echo "" -echo "============================================================" -echo "Logging you in to concourse" -echo "============================================================" -set -x -fly -t concourse.apachegeode-ci.info-main login --team-name main --concourse-url https://concourse.apachegeode-ci.info/ -set +x - - -echo "" -echo "============================================================" -echo "Done creating support branches" -echo "============================================================" -cd ${GEODE}/../.. -echo "Next steps:" -echo "1. Go to https://github.com/${GITHUB_USER}/geode/pull/new/roll-develop-to-${NEWVERSION} and create the pull request" -echo "2. Plus the BumpMinor job at https://concourse.apachegeode-ci.info/teams/main/pipelines/apache-develop-main?group=semver-management" -echo "3. Add ${NEWVERSION} to Jira at https://issues.apache.org/jira/projects/GEODE?selectedItem=com.atlassian.jira.jira-projects-plugin:release-page" -echo "4. (cd ${GEODE}/ci/pipelines/meta && ./deploy_meta.sh) #takes 1-2 hours. keep re-running until successful." -echo "5. That's it for now. Once all needed fixes have been proposed and cherry-picked to support/${VERSION_MM} and https://concourse.apachegeode-ci.info/teams/main/pipelines/apache-support-${VERSION_MM/./-}-main is green, come back and run ${0%/*}/prepare_rc.sh -v ${VERSION_MM}.0.RC1" diff --git a/dev-tools/release/deploy_rc_pipeline.sh b/dev-tools/release/deploy_rc_pipeline.sh deleted file mode 100755 index b257d12f7029..000000000000 --- a/dev-tools/release/deploy_rc_pipeline.sh +++ /dev/null @@ -1,655 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - -set -e - -usage() { - echo "Usage: deploy_rc_pipeline -v version_number" - echo " -v The #.# version number" - exit 1 -} - -VERSION_MM="" - -while getopts ":v:" opt; do - case ${opt} in - v ) - VERSION_MM=$OPTARG - ;; - \? ) - usage - ;; - esac -done - -if [[ ${VERSION_MM} == "" ]]; then - usage -fi - -if [[ $VERSION_MM =~ ^([0-9]+\.[0-9]+)$ ]]; then - true -else - echo "Malformed version number ${VERSION_MM}. Example valid version: 1.9" - exit 1 -fi - -if [[ $VERSION_MM =~ ^(1\.1[0-4])$ ]]; then - needscmake="" -else - needscmake="-e s/echo.skipping.latest.cmake.//" -fi - -PIPEYML=$PWD/rc-pipeline.yml -cat << "EOF" | sed -e "s//${VERSION_MM}/" $needscmake > $PIPEYML ---- - -resources: -- name: geode - type: git - source: - branch: support/ - tag_filter: rel/v.*.RC* - uri: https://github.com/apache/geode.git -- name: geode-develop - type: git - source: - branch: develop - uri: https://github.com/apache/geode.git -- name: geode-examples - type: git - source: - branch: support/ - uri: https://github.com/apache/geode-examples.git -- name: geode-native - type: git - source: - branch: support/ - tag_filter: rel/v.*.RC* - uri: https://github.com/apache/geode-native.git -- name: geode-benchmarks - type: git - source: - branch: support/ - tag_filter: rel/v.*.RC* - uri: https://github.com/apache/geode-benchmarks.git -- name: upthewaterspout-tests - type: git - source: - branch: master - uri: https://github.com/upthewaterspout/geode-release-check.git - -jobs: - - name: build-geode-from-tag - serial: true - public: true - plan: - - in_parallel: - - get: geode - trigger: true - passed: [verify-expected-files-and-keys] - - task: validate - timeout: 1h - config: - image_resource: - type: docker-image - source: - repository: bellsoft/liberica-openjdk-debian - tag: 8 - inputs: - - name: geode - platform: linux - run: - path: /bin/sh - args: - - -ecx - - | - apt update -q - apt install -qq -y --no-install-recommends unzip git - FULL_VERSION=$(cd geode && git fetch && git describe --tags | sed -e 's#^rel/v##') - VERSION=$(echo $FULL_VERSION|sed -e 's/\.RC.*//') - SHA=$(cd geode && git rev-parse HEAD) - java -version - cd geode - ./gradlew test installDist - gfsh=geode-assembly/build/install/apache-geode/bin/gfsh - $gfsh version --full | grep "^Source-Revision: ${SHA}$" - $gfsh version --full | grep "^Product-Version: ${VERSION}-build" - ! $gfsh version --full | grep Oracle - - name: build-geode-from-src-tgz - serial: true - public: true - plan: - - in_parallel: - - get: geode - trigger: true - passed: [verify-expected-files-and-keys] - - task: validate - timeout: 1h - config: - image_resource: - type: docker-image - source: - repository: bellsoft/liberica-openjdk-debian - tag: 8 - inputs: - - name: geode - platform: linux - run: - path: /bin/sh - args: - - -ecx - - | - apt update -q - apt install -qq -y --no-install-recommends unzip git - FULL_VERSION=$(cd geode && git fetch && git describe --tags | sed -e 's#^rel/v##') - VERSION=$(echo $FULL_VERSION|sed -e 's/\.RC.*//') - SHA=$(cd geode && git rev-parse HEAD) - curl -fLs https://dist.apache.org/repos/dist/dev/geode/${FULL_VERSION}/apache-geode-${VERSION}-src.tgz > src.tgz - tar xzf src.tgz - cd apache-geode-${VERSION}-src - java -version - ./gradlew test installDist - gfsh=geode-assembly/build/install/apache-geode/bin/gfsh - $gfsh version --full | grep "^Source-Revision: ${SHA}$" - $gfsh version --full | grep "^Product-Version: ${VERSION}-build" - ! $gfsh version --full | grep Oracle - - name: run-gfsh-from-tgz - serial: true - public: true - plan: - - in_parallel: - - get: geode - trigger: true - passed: [verify-expected-files-and-keys] - - task: validate - timeout: 1h - config: - image_resource: - type: docker-image - source: - repository: bellsoft/liberica-openjdk-debian - tag: 8 - inputs: - - name: geode - platform: linux - run: - path: /bin/sh - args: - - -ecx - - | - apt update -q - apt install -qq -y --no-install-recommends git - FULL_VERSION=$(cd geode && git fetch && git describe --tags | sed -e 's#^rel/v##') - VERSION=$(echo $FULL_VERSION|sed -e 's/\.RC.*//') - SHA=$(cd geode && git rev-parse HEAD) - curl -fLs https://dist.apache.org/repos/dist/dev/geode/${FULL_VERSION}/apache-geode-${VERSION}.tgz > bin.tgz - tar xzf bin.tgz - cd apache-geode-${VERSION} - java -version - gfsh=bin/gfsh - $gfsh version --full | grep "^Source-Revision: ${SHA}$" - $gfsh version --full | grep "^Product-Version: ${VERSION}$" - ! $gfsh version --full | grep Oracle - - name: run-geode-examples-jdk11 - serial: true - public: true - plan: - - in_parallel: - - get: geode-examples - trigger: true - - task: validate - timeout: 1h - config: - image_resource: - type: docker-image - source: - repository: bellsoft/liberica-openjdk-debian - tag: 11 - inputs: - - name: geode-examples - platform: linux - run: - path: /bin/sh - args: - - -ecx - - | - apt update -q - apt install -qq -y --no-install-recommends unzip - cd geode-examples - java -version - ./gradlew runAll - - name: run-geode-examples-from-src-tgz-jdk8 - serial: true - public: true - plan: - - in_parallel: - - get: geode-examples - trigger: true - - task: validate - timeout: 1h - config: - image_resource: - type: docker-image - source: - repository: bellsoft/liberica-openjdk-debian - tag: 8 - inputs: - - name: geode-examples - platform: linux - run: - path: /bin/sh - args: - - -ecx - - | - apt update -q - apt install -qq -y --no-install-recommends unzip git - FULL_VERSION=$(cd geode-examples && git fetch && git describe --tags | sed -e 's#^rel/v##' -e 's#-.*##') - VERSION=$(echo $FULL_VERSION|sed -e 's/\.RC.*//') - if [ "${FULL_VERSION}" = "${VERSION}" ] ; then - GRADLE_ARGS="" - curl -fLs https://downloads.apache.org/geode/${VERSION}/apache-geode-examples-${VERSION}-src.tgz > src.tgz - else - STAGING_MAVEN=$(cat geode-examples/gradle.properties | grep geodeRepositoryUrl | awk '{print $3}') - GRADLE_ARGS="-PgeodeReleaseUrl=https://dist.apache.org/repos/dist/dev/geode/${FULL_VERSION} -PgeodeRepositoryUrl=${STAGING_MAVEN}" - curl -fLs https://dist.apache.org/repos/dist/dev/geode/${FULL_VERSION}/apache-geode-examples-${VERSION}-src.tgz > src.tgz - fi - tar xzf src.tgz - cd apache-geode-examples-${VERSION}-src - java -version - ./gradlew ${GRADLE_ARGS} build runAll - - name: build-geode-native-from-tag - serial: true - public: true - plan: - - in_parallel: - - get: geode-native - trigger: true - - task: validate - timeout: 1h - config: - image_resource: - type: docker-image - source: - repository: adoptopenjdk/openjdk8 - tag: slim - inputs: - - name: geode-native - platform: linux - run: - path: /bin/sh - args: - - -ecx - - | - apt update -q - apt install -qq -y --no-install-recommends git - FULL_VERSION=$(cd geode-native && git fetch && git describe --tags | sed -e 's#^rel/v##') - VERSION=$(echo $FULL_VERSION|sed -e 's/\.RC.*//') - #use geode from binary dist - curl -fLs https://dist.apache.org/repos/dist/dev/geode/${FULL_VERSION}/apache-geode-${VERSION}.tgz > geode-bin.tgz - tar xzf geode-bin.tgz - apt-get update || true - DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y cmake openssl doxygen build-essential libssl-dev zlib1g-dev - - echo skipping latest cmake tmp=`mktemp` - echo skipping latest cmake curl -fo ${tmp} -v -L https://github.com/Kitware/CMake/releases/download/v3.21.2/cmake-3.21.2-linux-x86_64.sh - echo skipping latest cmake bash ${tmp} --skip-license --prefix=/usr/local - echo skipping latest cmake rm -f ${tmp} - - #cmake wrongly assumes javah wasn't removed until JDK10, but adoptopenjdk removed it in JDK8 - echo '/opt/java/openjdk/bin/javac -h "$@"' > /opt/java/openjdk/bin/javah - chmod +x /opt/java/openjdk/bin/javah - cd geode-native - mkdir build - cd build - cmake .. -DGEODE_ROOT=$PWD/../../apache-geode-${VERSION} - cmake --build . -- -j 4 - cmake --build . --target docs -- -j 4 - cmake --build . --target install -- -j 4 - - name: build-geode-native-from-src-tgz - serial: true - public: true - plan: - - in_parallel: - - get: geode-native - - get: geode - trigger: true - passed: [verify-expected-files-and-keys] - - task: validate - timeout: 1h - config: - image_resource: - type: docker-image - source: - repository: adoptopenjdk/openjdk8 - tag: slim - inputs: - - name: geode-native - - name: geode - platform: linux - run: - path: /bin/sh - args: - - -ecx - - | - apt update -q - apt install -qq -y --no-install-recommends unzip git - FULL_VERSION=$(cd geode-native && git fetch && git describe --tags | sed -e 's#^rel/v##') - VERSION=$(echo $FULL_VERSION|sed -e 's/\.RC.*//') - # build geode from source - cd geode - ./gradlew build -x test -x javadoc -x rat -x pmdMain - cd .. - apt-get update || true - DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y cmake openssl doxygen build-essential libssl-dev zlib1g-dev - - echo skipping latest cmake tmp=`mktemp` - echo skipping latest cmake curl -fo ${tmp} -v -L https://github.com/Kitware/CMake/releases/download/v3.21.2/cmake-3.21.2-linux-x86_64.sh - echo skipping latest cmake bash ${tmp} --skip-license --prefix=/usr/local - echo skipping latest cmake rm -f ${tmp} - - #cmake wrongly assumes javah wasn't removed until JDK10, but adoptopenjdk removed it in JDK8 - echo '/opt/java/openjdk/bin/javac -h "$@"' > /opt/java/openjdk/bin/javah - chmod +x /opt/java/openjdk/bin/javah - curl -fLs https://dist.apache.org/repos/dist/dev/geode/${FULL_VERSION}/apache-geode-native-${VERSION}-src.tgz > src.tgz - tar xzf src.tgz - cd apache-geode-native-${VERSION}-src - mkdir build - cd build - cmake .. -DGEODE_ROOT=$PWD/../../geode/geode-assembly/build/install/apache-geode - cmake --build . -- -j 4 - cmake --build . --target docs -- -j 4 - cmake --build . --target install -- -j 4 - - name: upthewaterspout - serial: true - public: true - plan: - - in_parallel: - - get: geode - trigger: true - passed: [verify-expected-files-and-keys] - - get: upthewaterspout-tests - - get: geode-examples - - task: validate - timeout: 2h - config: - image_resource: - type: docker-image - source: - repository: bellsoft/liberica-openjdk-debian - tag: 8 - inputs: - - name: geode - - name: upthewaterspout-tests - - name: geode-examples - platform: linux - run: - path: /bin/sh - args: - - -ecx - - | - apt update -q - apt install -qq -y --no-install-recommends unzip git gpg gpg-agent wget - FULL_VERSION=$(cd geode && git fetch && git describe --tags | sed -e 's#^rel/v##') - VERSION=$(echo $FULL_VERSION|sed -e 's/\.RC.*//') - STAGING_MAVEN=$(cat geode-examples/gradle.properties | grep geodeRepositoryUrl | awk '{print $3}') - cd upthewaterspout-tests - curl -fLs https://dist.apache.org/repos/dist/dev/geode/KEYS > KEYS - gpg --import KEYS - java -version - ./gradlew build -PmavenURL=${STAGING_MAVEN} -PdownloadURL=https://dist.apache.org/repos/dist/dev/geode/${FULL_VERSION}/ -Pversion=${FULL_VERSION} - - name: benchmarks-test - serial: true - public: true - plan: - - get: geode-benchmarks - trigger: true - - task: validate - timeout: 1h - config: - image_resource: - type: docker-image - source: - repository: bellsoft/liberica-openjdk-debian - tag: 8 - inputs: - - name: geode-benchmarks - platform: linux - run: - path: /bin/sh - args: - - -ecx - - | - apt update -q - apt install -qq -y --no-install-recommends unzip git keychain - FULL_VERSION=$(cd geode-benchmarks && git fetch && git describe --tags | sed -e 's#^rel/v##') - VERSION=$(echo $FULL_VERSION|sed -e 's/\.RC.*//') - curl -fLs https://dist.apache.org/repos/dist/dev/geode/${FULL_VERSION}/apache-geode-benchmarks-${VERSION}-src.tgz > src.tgz - tar xzf src.tgz - cd apache-geode-benchmarks-${VERSION}-src - java -version - mkdir -p ~/.ssh - ssh-keygen -m PEM -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N "" - cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys - apt-get update || true - apt-get install openssh-server --no-install-recommends -y - echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config - service ssh start - echo 'tasks.withType(JavaCompile) { options.encoding = "UTF-8" }' >> geode-benchmarks/build.gradle - ./gradlew build test - - name: verify-expected-files-and-keys - serial: true - public: true - plan: - - in_parallel: - - get: geode - trigger: true - - task: validate - timeout: 1h - config: - image_resource: - type: docker-image - source: - repository: bellsoft/liberica-openjdk-debian - tag: 8 - inputs: - - name: geode - platform: linux - run: - path: /bin/bash - args: - - -ecx - - | - apt update -q - apt install -qq -y --no-install-recommends git gpg gpg-agent - FULL_VERSION=$(cd geode && git fetch && git describe --tags | sed -e 's#^rel/v##') - VERSION=$(echo $FULL_VERSION|sed -e 's/\.RC.*//') - curl -fLs https://dist.apache.org/repos/dist/dev/geode/KEYS > KEYS - gpg --import KEYS - url=https://dist.apache.org/repos/dist/dev/geode/${FULL_VERSION} - function verifyArtifactSizeSignatureLicenseNoticeAndCopyright { - tld=$1 - file=${tld}.tgz - minfilesize=$2 - maxfilesize=$3 - echo Verifying $file... - asc=${file}.asc - sha=${file}.sha256 - sum=sha256sum - curl -fLs $url/$file > $file - actualfilesize=$(wc -c < $file) - if [ $actualfilesize -lt $minfilesize ] ; then - echo "File size of $file is only $actualfilesize bytes, expected at least $minfilesize" - return 1 - fi - if [ $actualfilesize -gt $maxfilesize ] ; then - echo "File size of $file is $actualfilesize, expected no more than $maxfilesize bytes" - return 1 - fi - curl -fLs $url/$asc > $asc - curl -fLs $url/$sha > $sha - gpg --verify $asc - $sum -c $sha - echo $file >> exp - echo $asc >> exp - echo $sha >> exp - #check that each archive contains all content below a top-level-directory with the same name as the file (sans .tgz) - ! tar tvzf $file | grep -v " ${tld}/" - #check that each archive contains LICENSE and NOTICE - tar tvzf $file | grep " ${tld}/LICENSE" - tar tvzf $file | grep " ${tld}/NOTICE" - #check that NOTICE contains current copyright year and correctly assigns copyright to ASF - tar xzf $file "${tld}/NOTICE" - year=$(date +%Y) - grep "Copyright" "${tld}/NOTICE" - grep -q "Copyright.*${year}.*Apache Software Foundation" "${tld}/NOTICE" - #check that the declared license is of the correct type - tar xzf $file "${tld}/LICENSE" - head -1 "${tld}/LICENSE" | grep -q "Apache License" - } - verifyArtifactSizeSignatureLicenseNoticeAndCopyright apache-geode-${VERSION}-src 16000000 20000000 - verifyArtifactSizeSignatureLicenseNoticeAndCopyright apache-geode-${VERSION} 120000000 137000000 - verifyArtifactSizeSignatureLicenseNoticeAndCopyright apache-geode-examples-${VERSION}-src 840000 900000 - verifyArtifactSizeSignatureLicenseNoticeAndCopyright apache-geode-native-${VERSION}-src 2400000 3200000 - verifyArtifactSizeSignatureLicenseNoticeAndCopyright apache-geode-benchmarks-${VERSION}-src 85000 125000 - curl -fLs ${url}/ | awk '/>../{gsub(/ *<[^>]*>/,"");print}' | sort > actual-file-list - sort < exp > expected-file-list - set +x - echo "" - if diff -q expected-file-list actual-file-list ; then - echo "The file list at $url matches what is expected and all signatures were verified :)" - else - echo "Expected:" - cat expected-file-list - echo "" - echo "Actual:" - cat actual-file-list - echo "" - echo "Diff:" - diff expected-file-list actual-file-list - exit 1 - fi - - name: verify-no-binaries - serial: true - public: true - plan: - - in_parallel: - - get: geode - trigger: true - passed: [verify-expected-files-and-keys] - - task: validate - timeout: 1h - config: - image_resource: - type: docker-image - source: - repository: bellsoft/liberica-openjdk-debian - tag: 8 - inputs: - - name: geode - platform: linux - run: - path: /bin/bash - args: - - -ecx - - | - apt update -q - apt install -qq -y --no-install-recommends git - FULL_VERSION=$(cd geode && git fetch && git describe --tags | sed -e 's#^rel/v##') - VERSION=$(echo $FULL_VERSION|sed -e 's/\.RC.*//') - url=https://dist.apache.org/repos/dist/dev/geode/${FULL_VERSION} - BINARY_EXTENSIONS="jar|war|class|exe|dll|o|so|obj|bin|out|pyc" - echo "Source artifacts should not contain any files ending in$(echo "|${BINARY_EXTENSIONS}"|sed 's/[^a-z]/ ./g')" - echo "" - function verifyNoBinaries { - file=$1 - echo "" - echo Checking $file... - curl -fLs $url/$file | tar tvzf - | egrep '\.('"${BINARY_EXTENSIONS}"')$' | tee -a bins - } - verifyNoBinaries apache-geode-${VERSION}-src.tgz - verifyNoBinaries apache-geode-examples-${VERSION}-src.tgz - verifyNoBinaries apache-geode-native-${VERSION}-src.tgz - verifyNoBinaries apache-geode-benchmarks-${VERSION}-src.tgz - echo "" - echo "" - if grep -q . bins ; then - echo Binary files were found! - exit 1 - else - echo All good - fi - - name: verify-license - serial: true - public: true - plan: - - in_parallel: - - get: geode - trigger: true - passed: [verify-expected-files-and-keys] - - get: geode-develop - - task: validate - timeout: 1h - config: - image_resource: - type: docker-image - source: - repository: bellsoft/liberica-openjdk-debian - tag: 8 - inputs: - - name: geode - - name: geode-develop - platform: linux - run: - path: /bin/bash - args: - - -ecx - - | - apt update -q - apt install -qq -y --no-install-recommends unzip git - FULL_VERSION=$(cd geode && git fetch && git describe --tags | sed -e 's#^rel/v##') - ./geode-develop/dev-tools/release/license_review.sh -v $FULL_VERSION - - name: all-passed - serial: true - public: true - plan: - - in_parallel: - - get: geode - trigger: true - passed: - - verify-license - - upthewaterspout - - run-gfsh-from-tgz - - verify-no-binaries - - build-geode-from-tag - - build-geode-from-src-tgz - - get: geode-examples - passed: - - run-geode-examples-jdk11 - - run-geode-examples-from-src-tgz-jdk8 - - get: geode-native - passed: - - build-geode-native-from-tag - - build-geode-native-from-src-tgz - - get: geode-benchmarks - passed: - - benchmarks-test -EOF -fly -t concourse.apachegeode-ci.info-main login --team-name main --concourse-url https://concourse.apachegeode-ci.info/ -fly -t concourse.apachegeode-ci.info-main set-pipeline -p apache-support-${VERSION_MM//./-}-rc -c $PIPEYML -fly -t concourse.apachegeode-ci.info-main unpause-pipeline -p apache-support-${VERSION_MM//./-}-rc -fly -t concourse.apachegeode-ci.info-main expose-pipeline -p apache-support-${VERSION_MM//./-}-rc -rm $PIPEYML diff --git a/dev-tools/release/end_of_support.sh b/dev-tools/release/end_of_support.sh deleted file mode 100755 index 38f69b9ace5b..000000000000 --- a/dev-tools/release/end_of_support.sh +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - -set -e - -usage() { - echo "Usage: end_of_support.sh -v version_number" - echo " -v The #.# version number of the support branch that is no longer supported" - exit 1 -} - -VERSION_MM="" - -while getopts ":v:" opt; do - case ${opt} in - v ) - VERSION_MM=$OPTARG - ;; - \? ) - usage - ;; - esac -done - -if [[ ${VERSION_MM} == "" ]] ; then - usage -fi - -if [[ $VERSION_MM =~ ^([0-9]+\.[0-9]+)$ ]]; then - true -else - echo "Malformed version number ${VERSION_MM}. Example valid version: 1.9" - exit 1 -fi - -set -x -WORKSPACE=$PWD/support-${VERSION_MM}-workspace -GEODE=$WORKSPACE/geode -GEODE_EXAMPLES=$WORKSPACE/geode-examples -GEODE_NATIVE=$WORKSPACE/geode-native -GEODE_BENCHMARKS=$WORKSPACE/geode-benchmarks -set +x - -function failMsg1 { - echo "ERROR: script did NOT complete successfully. Please try again." -} -trap failMsg1 ERR - - -echo "" -echo "============================================================" -echo "Cleaning workspace directory..." -echo "============================================================" -set -x -rm -rf $WORKSPACE -mkdir -p $WORKSPACE -cd $WORKSPACE -set +x - - -echo "" -echo "============================================================" -echo "Cloning repositories..." -echo "============================================================" -set -x -git clone --branch support/${VERSION_MM} git@github.com:apache/geode.git -git clone --branch support/${VERSION_MM} git@github.com:apache/geode-examples.git -git clone --branch support/${VERSION_MM} git@github.com:apache/geode-native.git -git clone --branch support/${VERSION_MM} git@github.com:apache/geode-benchmarks.git -set +x - - -echo "" -echo "============================================================" -echo "Confirming end of support" -echo "============================================================" -cd ${GEODE} -echo "Geode support branches should be kept for at least 9 months after initial release." -echo "Geode ${VERSION_MM}.0 was released about $(git log -1 --format=%ar rel/v${VERSION_MM}.0)" -read -p "To continue and delete support/${VERSION_MM} and all associated pipelines, type YES if you are sure: " -if [ "$REPLY" != "YES" ] ; then - echo cancelled - exit 1 -fi - - -function failMsg2 { - errln=$1 - echo "ERROR: script did NOT complete successfully" - echo "Comment out any steps that already succeeded (approximately lines 65-$(( errln - 1 ))) and try again" -} -trap 'failMsg2 $LINENO' ERR - - -echo "" -echo "============================================================" -echo "Destroying pipelines" -echo "============================================================" -set -x -cd ${0%/*}/../../ci/pipelines/meta -DEVELOP_META=$(pwd) -cd ${GEODE} -fly -t concourse.apachegeode-ci.info-main login --team-name main --concourse-url https://concourse.apachegeode-ci.info/ -${DEVELOP_META}/destroy_pipelines.sh -set +x - - -echo "" -echo "============================================================" -echo "Destroying support branches" -echo "============================================================" -for DIR in ${GEODE} ${GEODE_EXAMPLES} ${GEODE_NATIVE} ${GEODE_BENCHMARKS} ; do - set -x - cd ${DIR} - git checkout develop - git push origin --delete support/${VERSION_MM} - git branch -D support/${VERSION_MM} - set +x -done - - -echo "" -echo "============================================================" -echo "Cleaning up RC tags" -echo "============================================================" -for DIR in ${GEODE} ${GEODE_EXAMPLES} ${GEODE_NATIVE} ${GEODE_BENCHMARKS} ; do - set -x - cd ${DIR} - git tag | grep "^rel/v${VERSION_MM}.*RC" | while read RCTAG ; do - git push origin --delete "$RCTAG" - done - set +x -done - - -echo "" -echo "============================================================" -echo 'Done shutting down the support branch!' -echo "============================================================" -echo "Don't forget to remove the JIRA Release placeholder for any future ${VERSION_MM}.x" -echo "Probably also a good idea to announce on the dev list that support/${VERSION_MM} has expired" diff --git a/dev-tools/release/license_review.sh b/dev-tools/release/license_review.sh deleted file mode 100755 index 1ce58225fba3..000000000000 --- a/dev-tools/release/license_review.sh +++ /dev/null @@ -1,377 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - -set -e - -usage() { - echo "Usage: license_review.sh -v version_number_or_tgz [-p previous_version_number_or_tgz]" - echo " -v The #.#.#.RC# or #.#.# version number to review -or- a path or URL to .tgz -or- 'HEAD'" - echo " -p The #.#.#.RC# or #.#.# version number to compare against -or- a path or URL to .tgz" - echo " -n No license check (useful if you just want the version comparison)" - echo " -s No source license check (just check the binary license)" - exit 1 -} - - -while getopts ":v:p:ns" opt; do - case ${opt} in - v ) - NEW_VERSION=$OPTARG - ;; - p ) - OLD_VERSION=$OPTARG - ;; - n ) - SKIP_LICENSES=true - ;; - s ) - SKIP_SRC_LICENSE=true - ;; - \? ) - usage - ;; - esac -done - -if [ -z "${NEW_VERSION}" ] ; then - usage -fi - -WORKSPACE=$(pwd)/license_tmp -DOWNLOAD=${WORKSPACE}/download -EXTRACT=${WORKSPACE}/extracted -mkdir -p ${DOWNLOAD} -mkdir -p ${EXTRACT} -root=$0 -root=${root%/dev-tools*} - -if [ "$NEW_VERSION" = "HEAD" ] ; then - licFromWs=true - rm -Rf $root/geode-assembly/build/distributions -fi - - -function resolve() { - [ -n "$1" ] || return - spec=$1 - suffix=$2 - if [ "HEAD" = "$spec" ] ; then - [ "${suffix}" = "-src" ] && target=srcDistTar || target=distTar - (cd $root && ./gradlew ${target} 1>&2) - spec=$root/geode-assembly/build/distributions/$(cd $root/geode-assembly/build/distributions && ls -t | grep -v sha256 | grep "apache-geode-.*-build.[0-9][0-9]*${suffix}.tgz" | tail -1) - [ -r "$spec" ] || echo "Build not found: $spec" 1>&2 - [ -r "$spec" ] - fi - - if [[ $spec =~ ^([0-9]+\.[0-9]+\.[0-9]+)\.(RC[0-9]+)$ ]]; then - mmp=$(echo $spec | sed 's/.RC.*//') - #bare RC version -> RC url - spec=https://dist.apache.org/repos/dist/dev/geode/${spec}/apache-geode-${mmp}${suffix}.tgz - elif [[ $spec =~ ^([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then - #bare released version -> release url - spec=https://archive.apache.org/dist/geode/${spec}/apache-geode-${spec}${suffix}.tgz - elif echo "$spec" | grep -q '^http.*tgz$' ; then - #tgz url - echo "$spec" | grep -q -- "${suffix}.tgz$" || return - elif [ -r "$spec" ] && echo "$spec" | grep -q 'tgz$' ; then - #tgz file present locally - echo "$spec" | grep -q -- "${suffix}.tgz$" || return - else - #unsupported - return - fi - - #download if url (and not already downloaded) - if echo "$spec" | grep -q '^http.*tgz$' ; then - filename=$(echo $spec | sed 's#.*/##') - [ -r ${DOWNLOAD}/$filename ] || curl -fL "$spec" > ${DOWNLOAD}/$filename - spec=${DOWNLOAD}/$filename - fi - - #extract it (if not already extracted) - dirname=$(echo $spec | sed -e 's#.*/##' -e 's#.tgz$##') - [ "${licFromWs}" = "true" ] && rm -Rf ${EXTRACT}/$dirname || true - [ -d ${EXTRACT}/$dirname ] || tar xzf $spec -C ${EXTRACT} - [ -d ${EXTRACT}/$dirname ] && echo ${EXTRACT}/$dirname || true -} - -NEW_DIR=$(resolve $NEW_VERSION) - -if [ -z "${NEW_DIR}" ] || [ ! -d "${NEW_DIR}" ] ; then - usage -fi - -if [ "${licFromWs}" = "true" ] && ! [ "$SKIP_LICENSES" = "true" ] && ! [ "$SKIP_SRC_LICENSE" = "true" ] ; then - NEW_SRC_DIR=$(resolve $NEW_VERSION -src) -fi - -function banner() { - echo "" - echo "$@" | sed 's/./=/g' - echo "$@" - echo "$@" | sed 's/./=/g' -} - -function listJarsInWar() { - war=$1 - jar tvf $war | awk '/.jar$/{print "'"$war"'/"$8}' -} - -function extractLicense() { - [ "$SKIP_LICENSES" != "true" ] || return 0 - war=$1 - rm -Rf tmpl - mkdir tmpl - cd tmpl - jar xf ../$war META-INF/LICENSE - cd .. - cp tmpl/META-INF/LICENSE $2 - rm -Rf tmpl -} - -function generateList() { - dir=$1 - banner "Listing 3rd-party deps in ${dir##*/}" - - #also extract geode jar licenses for later checking - (cd $dir; find . -name '*.jar' | egrep '(geode|gfsh)-' | sort | sed 's#^./##' | while read geodejar ; do - extractLicense $geodejar ${geodejar%.jar}.LICENSE - done) - - echo "**** ${dir##*/} jars ****" | tr '[:lower:]-' '[:upper:] ' > $dir/report1 - (cd $dir; find . -name '*.jar' | grep -v geode- | grep -v gfsh- | sort | sed 's#^./##' | tee -a report1) - - echo "**** ${dir##*/} wars ****" | tr '[:lower:]-' '[:upper:] ' > $dir/report2 - (cd $dir; find . -name '*.war' | sort | sed 's#^./##' | while read war ; do - listJarsInWar $war | sed 's#-[v0-9][-0-9.SNAPSHOTbuild]*[.]#.#' | sort - extractLicense $war ${war%.war}.LICENSE - done | tee -a report2) -} - -generateList $NEW_DIR -if [ -n "${OLD_VERSION}" ] ; then - OLD_DIR=$(resolve $OLD_VERSION) - generateList $OLD_DIR - - banner "Diffing 3rd-party deps changes from ${OLD_DIR##*/} to ${NEW_DIR##*/}" - for REPORT in report1 report2 ; do - diff -y -W $(tput cols) $OLD_DIR/$REPORT $NEW_DIR/$REPORT | grep '[<|>]' - done -fi - -[ "$SKIP_LICENSES" = "true" ] && exit 0 - -banner "Checking that all binary licenses are identical" -sizes=$(find $NEW_DIR -name '*LICENSE' | xargs wc -c | grep -v total | awk '{print $1}' | sort -u | wc -l) -if [ $sizes -gt 1 ] ; then - echo "NOT all LICENSES are the same:" - (cd $NEW_DIR; find * -name '*LICENSE' | xargs wc -c | grep -v total | sort) - result=1 -else - echo 'All Good!' -fi - -function isApache2() { - apache="HikariCP -accessors-smart -byte-buddy -classmate -commons-beanutils -commons-codec -commons-collections -commons-digester -commons-fileupload -commons-io -commons-lang3 -commons-logging -commons-math3 -commons-modeler -commons-text -commons-validator -content-type -error_prone_annotations -failureaccess -fastutil -findbugs-annotations -geo -guava -grumpy- -httpclient -httpcore -j2objc-annotations -jackson- -jcip-annotations -jna -json-path -json-smart -jsr305 -jetty- -jgroups -jna- -joda-time -lang-tag -listenablefuture -log4j- -lucene- -mapstruct -micrometer-core -netty- -nimbus-jose-jwt -oauth2-oidc-sdk -rmiio -shiro- -snakeyaml -snappy -spring- -springdoc- -swagger-annotations -swagger-core -swagger-models -swagger-ui" - echo "$1" | egrep -q "(mx4j-remote|jaxb-api|$(echo -n "$apache" | tr '\n' '|'))" -} -function shortenDep() { - echo "$1" | sed \ - -e 's/-api//' \ - -e 's/-impl//' \ - -e 's/-java//' \ - -e 's/shiro-.*/shiro-*/' \ - -e 's/jackson-.*/jackson-*/' \ - -e 's/jetty-.*/jetty-*/' \ - -e 's/jna-.*/jna-*/' \ - -e 's/lucene-.*/lucene-*/' \ - -e 's/log4j-.*/log4j-*/' \ - -e 's/mx4j-.*/mx4j*/' \ - -e 's/spring-.*/spring-*/' \ - -e 's/springdoc-.*/springdoc-*/' -} -for REPORT in report1 report2 ; do - [ "$REPORT" = "report1" ] && topic=JAR || topic=WAR - if [ "${licFromWs}" = "true" ] ; then - LICENSE=${root}/geode-assembly/src/main/dist/LICENSE - else - [ "$REPORT" = "report1" ] && LICENSE=${NEW_DIR}/LICENSE || LICENSE=${NEW_DIR}/tools/Pulse/$(cd ${NEW_DIR}/tools/Pulse; ls | grep LICENSE) - fi - LICENSE=${LICENSE#./} - banner "Comparing $topic dep versions in ${NEW_DIR##*/} to $LICENSE" - rm -f missing-$REPORT apache-$REPORT - touch missing-$REPORT apache-$REPORT - tail -n +2 $NEW_DIR/$REPORT | sed -e 's#.*/##' -e 's/\.jar//' | sed 's/-\([0-9]\)/ \1/' | sort -u | grep -v '^ra$' | while read dep ver; do - if isApache2 $dep ; then - echo $dep $ver >> apache-$REPORT - else - echo $(shortenDep $dep) $ver - fi - done | sort -u | while read dep ver ; do - if grep -qi "${dep//-/.}.*$ver" $LICENSE ; then - echo "$dep $ver Found (and version matches)" - elif grep -qi $dep $LICENSE ; then - match="$(grep -i $dep $LICENSE | grep -v License | head -1)" - if echo $match | grep -q '[0-9][0-9]*[.][0-9][0-9]*' ; then - echo "$dep FOUND WITH A DIFFERENT VERSION, PLEASE UPDATE TO $ver:" >> missing-$REPORT - echo "$match" >> missing-$REPORT - else - echo "$dep $ver probably found (without version):" - echo "$match" - fi - else - echo "$LICENSE FAILS TO MENTION $dep v$ver" >> missing-$REPORT - fi - done - echo $(wc -l < apache-$REPORT) "deps are licensed under Apache 2.0 (no need to mention individually)" - rm apache-$REPORT - if [ $(wc -l < missing-$REPORT) -eq 0 ] ; then - echo 'All Good!' - else - cat missing-$REPORT - rm missing-$REPORT - result=1 - fi -done - -function checkMissing() { - rm -f missing - touch missing - grep '^ - ' | sed -e 's/^ - //' -e 's/, .*//' -e 's/ (.*//' -e 's/s* v.*//' -e 's/ /.?/g' | while read f; do - if (cd ${root} && git grep -Eqi "$f" -- ':!LICENSE' ':!**/LICENSE' ':!NOTICE' ':!**/NOTICE') ; then - true - #echo "${f//\?/} found" - else - echo "${f//\?/} appears to be unused. Please remove from $1" >> missing - fi - done - if [ $(wc -l < missing) -eq 0 ] ; then - echo 'All Good!' - rm missing - else - cat missing - rm missing - return 1 - fi -} - -if [ "${licFromWs}" = "true" ] ; then - banner "Checking that binary license is a superset of src license" - SLICENSE=${root}/LICENSE - BLICENSE=${root}/geode-assembly/src/main/dist/LICENSE - if diff $SLICENSE $BLICENSE | grep -q '^<' ; then - echo $(diff $SLICENSE $BLICENSE | grep '^<' | wc -l) "lines appear in $SLICENSE that were not found in $BLICENSE." - echo "Please ensure the binary license is a strict superset of the source license." - echo "(diff $SLICENSE $BLICENSE)" - result=1 - else - echo 'All Good!' - fi - - banner "Checking that binary license is correct" - if diff -q ${BLICENSE} ${NEW_DIR}/LICENSE ; then - echo 'All Good!' - else - echo "Incorrect LICENSE in binary distribution" - echo "Expected:" $(wc -c ${BLICENSE}) - echo "Actual:" $(wc -c ${NEW_DIR}/LICENSE) - result=1 - fi - - if ! [ "$SKIP_SRC_LICENSE" = "true" ] ; then - banner "Checking that source license is correct" - if diff -q ${SLICENSE} ${NEW_SRC_DIR}/LICENSE ; then - echo 'All Good!' - else - echo "Incorrect LICENSE in source distribution" - echo "Expected:" $(wc -c ${SLICENSE}) - echo "Actual:" $(wc -c ${NEW_SRC_DIR}/LICENSE) - result=1 - fi - - banner "Checking references in source license" - cat $SLICENSE | checkMissing $SLICENSE || result=1 - - - banner "Checking references in binary license" - cat $SLICENSE $SLICENSE $BLICENSE | sort | uniq -u | checkMissing $BLICENSE || result=1 - fi -fi - -if [ "$result" == 1 ] ; then - banner "ERRORS WERE FOUND" - echo "review each section above for details" - exit 1 -else - banner "SUMMARY" - echo 'ALL GOOD!' -fi diff --git a/dev-tools/release/prepare_rc.sh b/dev-tools/release/prepare_rc.sh deleted file mode 100755 index 90ed0f9365af..000000000000 --- a/dev-tools/release/prepare_rc.sh +++ /dev/null @@ -1,374 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - -set -e - -usage() { - echo "Usage: prepare_rc.sh -j ticket -v version_number -k signing_key -a apache_ldap_username" - echo " -j The GEODE-nnnnn Jira identifier for this release" - echo " -v The #.#.#.RC# version number" - echo " -k Your 8 digit GPG key id (the last 8 digits of your gpg fingerprint)" - echo " -a Your apache LDAP username (that you use to log in to https://id.apache.org)" - exit 1 -} - -checkCommand() { - COMMAND=$1 - if ! [[ -x "$(command -v $COMMAND)" ]]; then - echo "$COMMAND must be installed" - exit 1 - fi -} - -JIRA="" -FULL_VERSION="" -SIGNING_KEY="" -APACHE_USERNAME="" - -while getopts ":j:v:k:a:" opt; do - case ${opt} in - j ) - JIRA=$OPTARG - ;; - v ) - FULL_VERSION=$OPTARG - ;; - k ) - SIGNING_KEY=$OPTARG - ;; - a ) - APACHE_USERNAME=$OPTARG - ;; - \? ) - usage - ;; - esac -done - -if [[ ${JIRA} == "" ]] || [[ ${FULL_VERSION} == "" ]] || [[ ${SIGNING_KEY} == "" ]] || [[ ${APACHE_USERNAME} == "" ]]; then - usage -fi - -if [[ $SIGNING_KEY =~ ^[0-9A-Fa-f]{8}$ ]]; then - true -else - echo "Malformed signing key ${SIGNING_KEY}. Example valid key: ABCD1234" - exit 1 -fi - -if [[ $FULL_VERSION =~ ^([0-9]+\.[0-9]+\.[0-9]+)\.(RC[0-9]+)$ ]]; then - VERSION=${BASH_REMATCH[1]} -else - echo "Malformed version number ${FULL_VERSION}. Example valid version: 1.9.0.RC1" - exit 1 -fi - -VERSION_MM=${VERSION%.*} - -checkCommand gpg -checkCommand cmake -checkCommand svn -checkCommand doxygen - - -echo "" -echo "============================================================" -echo "Checking java..." -echo "============================================================" -[ -z "$JAVA_HOME" ] && JAVA=java || JAVA=$JAVA_HOME/bin/java -if ! $JAVA -XshowSettings:properties -version 2>&1 | grep 'java.specification.version = 1.8' ; then - echo "Please set JAVA_HOME to use JDK 8 to compile Geode for release" - exit 1 -fi -if $JAVA -XshowSettings:properties -version 2>&1 | grep 'java.vm.vendor = Oracle' ; then - echo "Please set JAVA_HOME to use an Open JDK 8 such as from https://adoptopenjdk.net/?variant=openjdk8&jvmVariant=hotspot to compile Geode for release" - exit 1 -else - $JAVA -XshowSettings:properties -version 2>&1 | grep 'java.vm.vendor = ' -fi - - -echo "" -echo "============================================================" -echo "Checking gpg... (you will be prompted to enter passphrase)" -echo "============================================================" -SECRING=~/.gnupg/secring.gpg -! [ -r $SECRING ] || SECRING=/dev/null -if gpg --export-secret-keys > ${SECRING} && echo "1234" | gpg -o /dev/null --local-user ${SIGNING_KEY} -as - ; then - echo "You entered the correct passphrase; proceeding." - echo "Please note, you will still need to enter it a few more times." - echo "PLEASE NOTE, the very last prompt will be for your apache password (not gpg). Pay attention as the prompts look very similar." -else - echo "Hmm, gpg seems unhappy. Check that you entered correct passphrase or refer to release wiki for troubleshooting." - exit 1 -fi -if ! gpg --list-keys ${SIGNING_KEY} | grep -q "${APACHE_USERNAME}@apache.org" ; then - echo "Please specify a gpg key that is associated with your apache email address." - echo "Expected: ${APACHE_USERNAME}@apache.org" - echo "Found: $(gpg --list-keys ${SIGNING_KEY} | grep ^uid | sed -e 's/.*.*//')" - exit 1 -fi - - -set -x -WORKSPACE=$PWD/release-${VERSION}-workspace -GEODE=$WORKSPACE/geode -GEODE_EXAMPLES=$WORKSPACE/geode-examples -GEODE_NATIVE=$WORKSPACE/geode-native -GEODE_BENCHMARKS=$WORKSPACE/geode-benchmarks -BREW_DIR=$WORKSPACE/homebrew-core -SVN_DIR=$WORKSPACE/dist/dev/geode -if which shasum >/dev/null; then - SHASUM="shasum -a 256" -else - SHASUM=sha256sum -fi -set +x - - -function failMsg1 { - echo "ERROR: script did NOT complete successfully. Please try again." -} -trap failMsg1 ERR - - -echo "" -echo "============================================================" -echo "Cleaning workspace directory..." -echo "============================================================" -set -x -rm -rf $WORKSPACE -mkdir -p $WORKSPACE -cd $WORKSPACE -set +x - - -echo "" -echo "============================================================" -echo "Cloning repositories..." -echo "============================================================" -set -x -git clone --single-branch --branch support/${VERSION_MM} git@github.com:apache/geode.git -#if you attempt to reset to a prior SHA here, skip ${GEODE} in set_copyright.sh or it may backfire -#(cd geode; git reset --hard $desired_sha) #uncomment if latest commit is not the desired sha -git clone git@github.com:apache/geode.git geode-develop -git clone --single-branch --branch support/${VERSION_MM} git@github.com:apache/geode-examples.git -git clone --single-branch --branch support/${VERSION_MM} git@github.com:apache/geode-native.git -git clone --single-branch --branch develop git@github.com:apache/geode-native.git geode-native-develop -git clone --single-branch --branch support/${VERSION_MM} git@github.com:apache/geode-benchmarks.git -git clone --single-branch --branch develop git@github.com:apache/geode-benchmarks.git geode-benchmarks-develop -git clone --single-branch --branch master git@github.com:Homebrew/homebrew-core.git - -svn checkout https://dist.apache.org/repos/dist --depth empty -svn update --set-depth immediates --parents dist/release/geode -svn update --set-depth infinity --parents dist/dev/geode -set +x - -for REPO in ${GEODE} ${WORKSPACE}/geode-develop ${GEODE_EXAMPLES} ${GEODE_NATIVE} ${GEODE_BENCHMARKS} ${BREW_DIR} ; do - cd ${REPO} - git config user.email "${APACHE_USERNAME}@apache.org" -done - -cd ${GEODE}/../.. -set -x -${0%/*}/set_copyright.sh -j $JIRA ${GEODE} ${GEODE_EXAMPLES} ${GEODE_NATIVE} ${GEODE_BENCHMARKS} -set +x - - -echo "" -echo "============================================================" -echo "Keeping -build.0 suffix" -echo "============================================================" -cd ${GEODE}/../.. -set -x -${0%/*}/set_versions.sh -j $JIRA -v ${VERSION} -n -w ${WORKSPACE} -set +x - - -echo "" -echo "============================================================" -echo "Building geode..." -echo "============================================================" -set -x -cd ${GEODE} -git clean -fdx && ./gradlew build -x test publishToMavenLocal -Pversion=${VERSION} -Paskpass -Psigning.keyId=${SIGNING_KEY} -Psigning.secretKeyRingFile=${HOME}/.gnupg/secring.gpg -set +x - - -if [ "${FULL_VERSION##*.RC}" -gt 1 ] ; then - echo "" - echo "============================================================" - echo "Removing previous RC's temporary commit from geode-examples..." - echo "============================================================" - set -x - cd ${GEODE_EXAMPLES} - git pull - set +x - sed -e 's#^geodeRepositoryUrl *=.*#geodeRepositoryUrl =#' \ - -e 's#^geodeReleaseUrl *=.*#geodeReleaseUrl =#' -i.bak gradle.properties - rm gradle.properties.bak - set -x - git add gradle.properties - if [ $(git diff --staged | wc -l) -gt 0 ] ; then - git diff --staged --color | cat - git commit -m "Revert "'"'"$JIRA: Set temporary staging repo"'"' - fi - set +x -fi - - -echo "" -echo "============================================================" -echo "Building geode-examples..." -echo "============================================================" -set -x -cd ${GEODE_EXAMPLES} -git clean -dxf && ./gradlew -Pversion=${VERSION} -PsignArchives -PgeodeReleaseUrl="file://${GEODE}/geode-assembly/build/geode-assembly/build/distributions/apache-geode-${VERSION}" -PgeodeRepositoryUrl="file://${HOME}/.m2/repository" -Psigning.keyId=${SIGNING_KEY} -Psigning.secretKeyRingFile=${HOME}/.gnupg/secring.gpg build -set +x - - -echo "" -echo "============================================================" -echo "Building geode-native..." -echo "============================================================" -set -x -cd ${GEODE_NATIVE} -mkdir build -which brew >/dev/null && OPENSSL_ROOT_DIR=$(brew --prefix openssl) || OPENSSL_ROOT_DIR=$(which openssl) -cd ${GEODE_NATIVE}/build -cmake .. -DPRODUCT_VERSION=${VERSION} -DOPENSSL_ROOT_DIR=$OPENSSL_ROOT_DIR -DGEODE_ROOT=${GEODE}/geode-assembly/build/install/apache-geode -cpack -G TGZ --config CPackSourceConfig.cmake -NCOUT=apache-geode-native-${VERSION}-src.tar.gz -NCTGZ=apache-geode-native-${VERSION}-src.tgz -mkdir repkg-temp -cd repkg-temp -tar xzf ../${NCOUT} -rm ../${NCOUT}* -mv apache-geode-native apache-geode-native-${VERSION}-src -tar czf ../${NCTGZ} * -cd .. -rm -Rf repkg-temp -gpg --armor -u ${SIGNING_KEY} -b ${NCTGZ} -${SHASUM} ${NCTGZ} > ${NCTGZ}.sha256 -set +x - - -echo "" -echo "============================================================" -echo "Building geode-benchmarks..." -echo "============================================================" -set -x -cd ${GEODE_BENCHMARKS} -BMDIR=apache-geode-benchmarks-${VERSION}-src -BMTAR=${BMDIR}.tgz -git clean -dxf -mkdir ../${BMDIR} -cp -r .travis.yml * ../${BMDIR} -tar czf ${BMTAR} -C .. ${BMDIR} -rm -Rf ../${BMDIR} -gpg --armor -u ${SIGNING_KEY} -b ${BMTAR} -${SHASUM} ${BMTAR} > ${BMTAR}.sha256 -set +x - - -function failMsg2 { - errln=$1 - echo "ERROR: script did NOT complete successfully" - echo "Comment out any steps that already succeeded (approximately lines 149-$(( errln - 1 ))) and try again" - echo "For this script only (prepare_rc.sh), it's also safe to just try again from the top" -} -trap 'failMsg2 $LINENO' ERR - - -echo "" -echo "============================================================" -echo "Tagging the release candidate in each repository. The tags will not be pushed yet..." -echo "============================================================" -for DIR in ${GEODE} ${GEODE_EXAMPLES} ${GEODE_NATIVE} ${GEODE_BENCHMARKS} ; do - set -x - cd ${DIR} - git tag -s -u ${SIGNING_KEY} rel/v${FULL_VERSION} -m "Release candidate ${FULL_VERSION}" - set +x -done - - -echo "" -echo "============================================================" -echo "Copying artifacts to svn directory for publication. The artifacts will not be committed..." -echo "============================================================" -set -x -cd ${SVN_DIR} -svn rm ${VERSION}.RC* &>/dev/null || true -cp ${GEODE}/KEYS . -mkdir ${FULL_VERSION} -cp ${GEODE}/geode-assembly/build/distributions/* ${FULL_VERSION} -cp ${GEODE_EXAMPLES}/build/distributions/* ${FULL_VERSION} -cp ${GEODE_NATIVE}/build/apache-geode-native-${VERSION}* ${FULL_VERSION} -cp ${GEODE_BENCHMARKS}/apache-geode-benchmarks-${VERSION}* ${FULL_VERSION} -set +x - -# verify all files are signed. sometimes gradle "forgets" to make the .asc file -for f in ${FULL_VERSION}/*.tgz ; do - if ! [ -r $f.sha256 ] ; then - echo missing $f.sha256 - exit 1 - fi - if ! [ -r $f.asc ] ; then - set -x - gpg --armor -u ${SIGNING_KEY} -b $f - set +x - if ! [ -r $f.asc ] ; then - echo missing $f.asc - exit 1 - fi - fi - size=$(ls -l $f | awk '{print $5}') - if [ $size -lt 10000 ] ; then - echo $f file size is only $size bytes, that seems suspicious. - exit 1 - fi -done - -set -x -svn add ${FULL_VERSION} -set +x - - -echo "" -echo "============================================================" -echo "Publishing artifacts to nexus staging manager..." -echo "PLEASE NOTE, the 2nd prompt will be for your apache (not gpg) password. Pay attention as the prompts look very similar." -echo "============================================================" -publishcmd="./gradlew publish --no-parallel -Pversion=${VERSION} -Paskpass -Psigning.keyId=${SIGNING_KEY} -Psigning.secretKeyRingFile=${HOME}/.gnupg/secring.gpg -PmavenUsername=${APACHE_USERNAME}" -set -x -cd ${GEODE} -sh -c "$publishcmd" -set +x - - -echo "" -echo "============================================================" -echo "Done preparing the release and staging to nexus! Next steps:" -echo "============================================================" -cd ${GEODE}/../.. -echo "1. Go to https://repository.apache.org, login as ${APACHE_USERNAME}, and click on Staging Repositories" -echo "2. If there is a prior ${VERSION} RC, select it and click Drop." -echo "2b.If publication got split between two staging repos, drop one of them then run: pushd ${GEODE}; $publishcmd; popd" -echo '3. Make a note of the 4-digit ID of the current ("implicitly created") staging repo.' -echo '4. Select the current staging repo and click Close.' -echo '5. Wait ~10 seconds and then refresh the page to confirm that status has become "Closed"' -echo "6. Run ${0%/*}/commit_rc.sh -j $JIRA -v ${FULL_VERSION} -m <4-DIGIT-ID-NOTED-ABOVE>" diff --git a/dev-tools/release/print_announce_email.sh b/dev-tools/release/print_announce_email.sh deleted file mode 100755 index 1faf9e150dfa..000000000000 --- a/dev-tools/release/print_announce_email.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - -set -e - -usage() { - echo "Usage: print_announce_email.sh -v version_number -f latest_version_number" - echo " -v The #.#.# version number" - echo " -f The #.#.# version number of the latest and greatest, if other than above" - exit 1 -} - -VERSION="" -LATER="" - -while getopts ":v:f:" opt; do - case ${opt} in - v ) - VERSION=$OPTARG - ;; - f ) - LATER=$OPTARG - ;; - \? ) - usage - ;; - esac -done - -if [[ ${VERSION} == "" ]] ; then - usage -fi - -if [[ $VERSION =~ ^([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then - true -else - echo "Malformed version number ${VERSION}. Example valid number - 1.9.0" - exit 1 -fi - -if [ -z "$FLAGSHIP" ] || [[ "$FLAGSHIP" =~ ^([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then - true -else - echo "Malformed version number ${FLAGSHIP}. Example valid number - 1.9.0" - exit 1 -fi - -VERSION_MM=${VERSION%.*} - -#support mac or linux date arithmetic syntax -DEADLINE=$(date --date '+5 days' '+%a, %B %d %Y' 2>/dev/null || date -v +5d "+%a, %B %d %Y" 2>/dev/null || echo "<5 days from now>") - -if [ -n "${LATER}" ] && [ "${VERSION}" != "${LATER}" ] ; then - LATEST="Users are encouraged to upgrade to the latest ${LATER%.*}.x release (currently $LATER)." -else - LATEST="Users are encouraged to upgrade to this latest release." -fi - -if echo $VERSION | grep -q '\.0$' ; then - IMPROV=" improvements and" -else - IMPROV="" -fi - -cat << EOF -To: user@geode.apache.org, announce@apache.org, dev@geode.apache.org -Subject: [ANNOUNCE] Apache Geode ${VERSION} - -The Apache Geode community is pleased to announce the availability of -Apache Geode ${VERSION}. - -Geode is a data management platform that provides a database-like consistency -model, reliable transaction processing and a shared-nothing architecture -to maintain very low latency performance with high concurrency processing. - -Apache Geode ${VERSION} contains a number of${IMPROV} bug fixes. -$LATEST -For the full list of changes please review the release notes at: -https://cwiki.apache.org/confluence/display/GEODE/Release+Notes#ReleaseNotes-${VERSION} - -Release artifacts and documentation can be found at the project website: -https://geode.apache.org/releases/ -https://geode.apache.org/docs/guide/${VERSION_MM//./}/about_geode.html - -We would like to thank all the contributors that made the release possible. -Regards, -$(git config --get user.name) on behalf of the Apache Geode team -EOF diff --git a/dev-tools/release/print_rc_email.sh b/dev-tools/release/print_rc_email.sh deleted file mode 100755 index 29e45feb7683..000000000000 --- a/dev-tools/release/print_rc_email.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - -set -e - -usage() { - echo "Usage: print_rc_email.sh -v version_number -m maven_repo_id" - echo " -v The #.#.#.RC# version number" - echo " -m The 4 digit id of the nexus maven repo" - exit 1 -} - -FULL_VERSION="" -MAVEN="" - -while getopts ":v:m:" opt; do - case ${opt} in - v ) - FULL_VERSION=$OPTARG - ;; - m ) - MAVEN=$OPTARG - ;; - \? ) - usage - ;; - esac -done - -if [[ ${FULL_VERSION} == "" ]] || [[ ${MAVEN} == "" ]]; then - usage -fi - -if [[ $FULL_VERSION =~ ^([0-9]+\.[0-9]+\.[0-9]+)\.(RC[0-9]+)$ ]]; then - VERSION=${BASH_REMATCH[1]} -else - echo "Malformed version number ${FULL_VERSION}. Example valid number - 1.9.0.RC1" - exit 1 -fi - -VERSION_MM=${VERSION%.*} - -#support mac or linux date arithmetic syntax -DEADLINE=$(date --date '+5 days' '+%a, %B %d %Y' 2>/dev/null || date -v +5d "+%a, %B %d %Y" 2>/dev/null || echo "<5 days from now>") - -cat << EOF -Hello Geode Dev Community, - -This is a release candidate for Apache Geode version ${FULL_VERSION}. -Thanks to all the community members for their contributions to this release! - -Please do a review and give your feedback, including the checks you performed. - -Voting deadline: -3PM PST ${DEADLINE}. - -Please note that we are voting upon the source tag: -rel/v${FULL_VERSION} - -Release notes: -https://cwiki.apache.org/confluence/display/GEODE/Release+Notes#ReleaseNotes-${VERSION} - -Source and binary distributions: -https://dist.apache.org/repos/dist/dev/geode/${FULL_VERSION}/ - -Maven staging repo: -https://repository.apache.org/content/repositories/orgapachegeode-${MAVEN} - -GitHub: -https://github.com/apache/geode/tree/rel/v${FULL_VERSION} -https://github.com/apache/geode-examples/tree/rel/v${FULL_VERSION} -https://github.com/apache/geode-native/tree/rel/v${FULL_VERSION} -https://github.com/apache/geode-benchmarks/tree/rel/v${FULL_VERSION} - -Pipelines: -https://concourse.apachegeode-ci.info/teams/main/pipelines/apache-support-${VERSION_MM//./-}-main -https://concourse.apachegeode-ci.info/teams/main/pipelines/apache-support-${VERSION_MM//./-}-rc - -Geode's KEYS file containing PGP keys we use to sign the release: -https://github.com/apache/geode/blob/develop/KEYS - -Command to run geode-examples: -./gradlew -PgeodeReleaseUrl=https://dist.apache.org/repos/dist/dev/geode/${FULL_VERSION} -PgeodeRepositoryUrl=https://repository.apache.org/content/repositories/orgapachegeode-${MAVEN} build runAll - -Regards -$(git config --get user.name) -EOF diff --git a/dev-tools/release/promote_rc.sh b/dev-tools/release/promote_rc.sh deleted file mode 100755 index 9d8459a443de..000000000000 --- a/dev-tools/release/promote_rc.sh +++ /dev/null @@ -1,703 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - -set -e - -usage() { - echo "Usage: promote_rc.sh -j ticket -v version_number -k your_full_gpg_public_key -g your_github_username" - echo " -j The GEODE-nnnnn Jira identifier for this release" - echo " -v The #.#.#.RC# version number to ship" - echo " -k Your 8 digit GPG key id (the last 8 digits of your gpg fingerprint)" - echo " -g Your github username" - exit 1 -} - -JIRA="" -FULL_VERSION="" -SIGNING_KEY="" -GITHUB_USER="" - -while getopts ":j:v:k:g:" opt; do - case ${opt} in - j ) - JIRA=$OPTARG - ;; - v ) - FULL_VERSION=$OPTARG - ;; - k ) - SIGNING_KEY=$OPTARG - ;; - g ) - GITHUB_USER=$OPTARG - ;; - \? ) - usage - ;; - esac -done - -if [[ ${JIRA} == "" ]] || [[ ${FULL_VERSION} == "" ]] || [[ ${SIGNING_KEY} == "" ]] || [[ ${GITHUB_USER} == "" ]]; then - usage -fi - -SIGNING_KEY=$(gpg --fingerprint "${SIGNING_KEY}" | tr -d ' ' | grep "${SIGNING_KEY}" | sed 's/Keyfingerprint=//' | tail -1) - -if [[ $SIGNING_KEY =~ ^[0-9A-Fa-f]{40}$ ]]; then - true -else - echo "Malformed signing key ${SIGNING_KEY}. Example valid key: ABCD1234" - exit 1 -fi - -if [[ $FULL_VERSION =~ ^([0-9]+\.[0-9]+\.[0-9]+)\.(RC[0-9]+)$ ]]; then - VERSION=${BASH_REMATCH[1]} -else - echo "Malformed version number ${FULL_VERSION}. Example valid version: 1.9.0.RC1" - exit 1 -fi - -VERSION_MM=${VERSION%.*} - -set -x -WORKSPACE=$PWD/release-${VERSION}-workspace -GEODE=$WORKSPACE/geode -GEODE_DEVELOP=$WORKSPACE/geode-develop -GEODE_EXAMPLES=$WORKSPACE/geode-examples -GEODE_NATIVE=$WORKSPACE/geode-native -GEODE_NATIVE_DEVELOP=$WORKSPACE/geode-native-develop -GEODE_BENCHMARKS=$WORKSPACE/geode-benchmarks -GEODE_BENCHMARKS_DEVELOP=$WORKSPACE/geode-benchmarks-develop -BREW_DIR=$WORKSPACE/homebrew-core -SVN_DIR=$WORKSPACE/dist/dev/geode -set +x - -if [ -d "$GEODE" ] && [ -d "$GEODE_DEVELOP" ] && [ -d "$GEODE_EXAMPLES" ] && [ -d "$GEODE_NATIVE" ] && [ -d "$GEODE_NATIVE_DEVELOP" ] && [ -d "$GEODE_BENCHMARKS" ] && [ -d "$GEODE_BENCHMARKS_DEVELOP" ] && [ -d "$BREW_DIR" ] && [ -d "$SVN_DIR" ] ; then - true -else - echo "Please run this script from the same working directory as you initially ran prepare_rc.sh" - exit 1 -fi - - -echo "" -echo "============================================================" -echo "Checking docker..." -echo "============================================================" -if ! docker images >/dev/null ; then - echo "Make sure docker daemon is running and try again." - exit 1 -fi - - -PATCH=${VERSION##*.} -if [ $PATCH -ne 0 ] ; then - echo "" - echo "============================================================" - echo "Checking if serialization version has changed" - echo "============================================================" - cd ${GEODE} - PREV=${VERSION%.*}.$(( PATCH - 1 )) - VER=geode-serialization/src/main/java/org/apache/geode/internal/serialization/KnownVersion.java - [ -r $VER ] || VER=geode-serialization/src/main/java/org/apache/geode/internal/serialization/Version.java - set -x - prevsver=$(git show "rel/v${PREV}:${VER}" | awk '/CURRENT =/{print $NF}') - cursver=$(cat ${VER} | awk '/CURRENT =/{print $NF}') - set +x - [ "$cursver" = "$prevsver" ] && echo "No change: $VERSION will replace $PREV in old-versions list" || echo "Changed: old-versions list will include both $PREV and $VERSION" -fi - - -function failMsg { - errln=$1 - echo "ERROR: script did NOT complete successfully" - echo "Comment out any steps that already succeeded (approximately lines 151-$(( errln - 1 ))) and try again" -} -trap 'failMsg $LINENO' ERR - - -echo "" -echo "============================================================" -echo "Checking for later versions..." -echo "============================================================" -cd ${GEODE_DEVELOP} -latestnv=$(git tag| grep '^rel/v' | grep -v RC | cut -c6- | egrep '^[0-9]+\.[0-9]+\.[0-9]+$' | awk -F. '{print 1000000*$1+1000*$2+$3,$1"."$2"."$3}' | sort -n | tail -1) -latestn=$(echo $latestnv | awk '{print $1}') -latestv=$(echo $latestnv | awk '{print $2}') -thisre=$(echo $VERSION | awk -F. '{print 1000000*$1+1000*$2+$3}') -if [ $latestn -gt $thisre ] ; then - LATER="$latestv" - echo "Later version $LATER found; $VERSION will not be merged to master or tagged as 'latest' in docker." -else - LATER="" - echo "No later versions found; $VERSION will be tagged as 'latest' in docker and merged to master" -fi - - -echo "" -echo "============================================================" -echo "Releasing artifacts to mirror sites..." -echo "(note: must be logged in to svn as a PMC member or this will fail)" -echo "============================================================" -set -x -cd ${SVN_DIR}/../.. -svn update -svn mv dev/geode/${FULL_VERSION} release/geode/${VERSION} -cp dev/geode/KEYS release/geode/KEYS -svn commit -m "$JIRA: Release Apache Geode ${VERSION} - -Publish the source, binary, and checksum artifacts to ASF svn server, -from which they will be picked up and published within 15 minutes to -the URLs on https://geode.apache.org/releases/" -set +x - - -echo "" -echo "============================================================" -echo "Tagging ${FULL_VERSION} as ${VERSION} and pushing tags..." -echo "============================================================" -for DIR in ${GEODE} ${GEODE_EXAMPLES} ${GEODE_NATIVE} ${GEODE_BENCHMARKS} ; do - set -x - cd ${DIR} - git tag -s -u ${SIGNING_KEY} rel/v${VERSION} -m "Apache Geode v${VERSION} release" rel/v${FULL_VERSION}^{} - git push origin rel/v${VERSION} - set +x -done - - -function waitforserver { - server="$1" - msg="$2" - file=apache-geode-${VERSION}.tgz - baseurl=https://${server}/${VERSION}/${file} - echo "" - echo "============================================================" - echo "Waiting for ${baseurl} to appear..." - if echo "${server}" | grep -q repo1 ; then - echo "(may take up to one hour after clicking 'Release' on http://repository.apache.org/ )" - elif echo "${server}" | grep -q dlcdn ; then - echo "(may take a few hours)" - else - echo "(may take up to 15 minutes)" - fi - [ -z "$msg" ] || echo "$msg" - echo "============================================================" - for suffix in "" .asc .sha256 ; do - if [ "${suffix}" = ".sha256" ] && echo "${server}" | grep -q repo1 ; then - continue; - fi - url=${baseurl}${suffix} - expectedsize=$(cd ${SVN_DIR}/../../release/geode/${VERSION}; ls -l ${file}${suffix} | awk '{print $5}') - if [ -z "$expectedsize" ] ; then - echo "internal error: unable to get size of ${SVN_DIR}/../../release/geode/${VERSION}/${file}${suffix}" - exit 1 - fi - actualsize=0 - while [ "$expectedsize" -ne "$actualsize" ] ; do - while ! curl -sk --output /dev/null --head --fail "$url"; do - echo -n . - sleep 12 - done - actualsize=$(curl -fsk --head "$url" | grep -i "Content-Length" | awk '{print $2}' | tr -d '\r') - done - echo "$url exists and is correct size" - done -} - -waitforserver "downloads.apache.org/geode" - - -echo "" -echo "============================================================" -GEODE_SHA=$(awk '{print $1}' < $WORKSPACE/dist/release/geode/${VERSION}/apache-geode-${VERSION}.tgz.sha256) -if [ -n "$LATER" ] ; then - echo "NOT updating brew to avoid overwriting newer version $LATER" - echo "============================================================" -else - echo "Updating brew" - echo "============================================================" - set -x - cd ${BREW_DIR}/Formula - git pull - git remote add myfork git@github.com:${GITHUB_USER}/homebrew-core.git || true - if ! git fetch myfork ; then - echo "Please fork https://github.com/Homebrew/homebrew-core" - exit 1 - fi - git checkout -b apache-geode-${VERSION} - set +x - sed -e 's# *url ".*# url "https://www.apache.org/dyn/closer.lua?path=geode/'"${VERSION}"'/apache-geode-'"${VERSION}"'.tgz"#' \ - -e '/ *mirror ".*www.*/d' \ - -e '/ *mirror ".*downloads.*/d' \ - -e 's# *mirror ".*archive.*# mirror "https://archive.apache.org/dist/geode/'"${VERSION}"'/apache-geode-'"${VERSION}"'.tgz"\ - mirror "https://downloads.apache.org/geode/'"${VERSION}"'/apache-geode-'"${VERSION}"'.tgz"#' \ - -e 's/ *sha256 ".*/ sha256 "'"${GEODE_SHA}"'"/' \ - -i.bak apache-geode.rb - rm apache-geode.rb.bak - set -x - git add apache-geode.rb - git diff --staged --color | cat - git commit -m "$JIRA: Brew apache-geode ${VERSION} - -This is the latest and greatest release of Apache Geode." - git push -u myfork - set +x -fi - - -echo "" -echo "============================================================" -echo "Updating Geode Dockerfile" -echo "============================================================" -set -x -cd ${GEODE}/docker -git pull -r -set +x -sed -e "s/^ENV GEODE_GPG.*/ENV GEODE_GPG ${SIGNING_KEY}/" \ - -e "s/^ENV GEODE_VERSION.*/ENV GEODE_VERSION ${VERSION}/" \ - -e "s/^ENV GEODE_SHA256.*/ENV GEODE_SHA256 ${GEODE_SHA}/" \ - -e "s/ha.pool.sks-keyservers.net/keyserver.ubuntu.com/" \ - -e '/This is a TEMPLATE/d' \ - -i.bak Dockerfile -rm Dockerfile.bak -set -x -git add Dockerfile -git diff --staged --color | cat -git commit -m "$JIRA: update Dockerfile to apache-geode ${VERSION} - -The Dockerfile is updated _after_ the release is already tagged, -because it needs to embed the sha256 of the release" -git push -set +x - - -echo "" -echo "============================================================" -echo "Updating Native Dockerfile and other variables" -echo "============================================================" -set -x -cd ${GEODE_NATIVE} -git pull -r -set +x -if [ -r .travis.yml ] ; then - sed -e "s/geode-native-build:[latest0-9.]*/geode-native-build:${VERSION}/" \ - -i.bak .travis.yml -fi -sed -e "s/GEODE_VERSION=.*/GEODE_VERSION=${VERSION}/" \ - -e "s/^ENV GEODE_VERSION.*/ENV GEODE_VERSION ${VERSION}/" \ - -i.bak $(git grep -l GEODE_VERSION= ; git grep -l 'ENV GEODE_VERSION') -rm $(find . -name '*.bak') -set -x -git add . -git diff --staged --color | cat -git commit -m "$JIRA: Update Dockerfile and vars - -Native client hardcodes Geode version to test with in several places. -Update native Dockerfile and other variables to apache-geode ${VERSION}" -git push -set +x - - -echo "" -echo "============================================================" -echo "Building Geode docker image" -echo "============================================================" -set -x -cd ${GEODE}/docker -sed -e '/www.apache.org.dyn.closer/d' -i.backup Dockerfile -if ! docker build . ; then - echo retrying in 1 minute... - sleep 60 - if ! docker build . ; then - echo retrying in 4 minutes... - sleep 240 - if ! docker build . ; then - echo retrying in 7 minutes... - sleep 420 - if ! docker build . ; then - echo "Hmm, the geode Dockerfile doesn't seem to want to build..." - echo "Try instrumenting it with some echo's to track down where it's failing..." - exit 7 - fi - fi - fi -fi -mv Dockerfile.backup Dockerfile -docker build -t apachegeode/geode:${VERSION} . -[ -n "$LATER" ] || docker build -t apachegeode/geode:latest . -set +x - - -echo "" -echo "============================================================" -echo "Building Native docker image" -echo "============================================================" -set -x -cd ${GEODE_NATIVE}/docker -docker build . || docker build . || docker build . -docker build -t apachegeode/geode-native-build:${VERSION} . -[ -n "$LATER" ] || docker build -t apachegeode/geode-native-build:latest . -set +x - - -echo "" -echo "============================================================" -echo "Publishing Geode docker image" -echo "============================================================" -set -x -cd ${GEODE}/docker -docker login -docker push apachegeode/geode:${VERSION} -[ -n "$LATER" ] || docker push apachegeode/geode:latest -set +x - - -echo "" -echo "============================================================" -echo "Publishing Native docker image" -echo "============================================================" -set -x -cd ${GEODE_NATIVE}/docker -docker push apachegeode/geode-native-build:${VERSION} -[ -n "$LATER" ] || docker push apachegeode/geode-native-build:latest -set +x - - -if [ -z "$LATER" ] ; then - echo "" - echo "============================================================" - echo "Setting Geode version for geode-native develop" - echo "============================================================" - set -x - cd ${GEODE_NATIVE_DEVELOP} - git pull - git remote add myfork git@github.com:${GITHUB_USER}/geode-native.git || true - git checkout -b update-to-geode-${VERSION} - set +x - - sed -e "s/GEODE_VERSION=[0-9.]*/GEODE_VERSION=${VERSION}/" \ - -e "s/^ENV GEODE_VERSION.*/ENV GEODE_VERSION ${VERSION}/" \ - -i.bak $(git grep -l GEODE_VERSION= ; git grep -l 'ENV GEODE_VERSION') - - rm $(find . -name '*.bak') - set -x - git add . - if [ $(git diff --staged | wc -l) -gt 0 ] ; then - git diff --staged --color | cat - git commit -m "$JIRA: Bump Geode version to ${VERSION} - -Native client hardcodes Geode version to test with in several places. -Update those variables to latest-and-greatest apache-geode ${VERSION}" - git push -u myfork - fi - set +x -fi - - -echo "" -echo "============================================================" -echo "Removing temporary commit from geode-examples..." -echo "============================================================" -set -x -cd ${GEODE_EXAMPLES} -git pull -set +x -sed -e 's#^geodeRepositoryUrl *=.*#geodeRepositoryUrl =#' \ - -e 's#^geodeReleaseUrl *=.*#geodeReleaseUrl =#' -i.bak gradle.properties -rm gradle.properties.bak -set -x -git add gradle.properties -git diff --staged --color | cat -git commit -m "Revert "'"'"$JIRA: Set temporary staging repo"'"'" - -The staging repo no longest exists, so set this back to search the -default location (mavencentral)" -git push -set +x - - -echo "" -echo "============================================================" -if [ -n "$LATER" ] ; then - echo "NOT merging to master to avoid overwriting newer version $LATER" - echo "============================================================" -else - echo "Merging to master" - echo "============================================================" - for DIR in ${GEODE} ${GEODE_EXAMPLES} ${GEODE_NATIVE} ${GEODE_BENCHMARKS} ; do - set -x - cd ${DIR} - git remote set-branches --add origin master - git fetch origin - git checkout support/${VERSION_MM} - git checkout -b release/${VERSION} rel/v${VERSION} - #this creates a merge commit that will then be ff-merged to master, so word it from that perspective - git merge -s ours origin/master -m "Replacing master with contents of rel/v${VERSION}" - git checkout master - git merge release/${VERSION} - git push origin master - set +x - done -fi - - -echo "" -echo "============================================================" -echo "Updating 'old' versions and Benchmarks baseline on develop" -echo "============================================================" -set -x -cd ${GEODE_DEVELOP} -git pull -git remote add myfork git@github.com:${GITHUB_USER}/geode.git || true -git checkout -b add-${VERSION}-to-old-versions -set +x -#add at the end if this is a new minor or a patch to the latest minor, otherwise add after it's predecessor -if [ $PATCH -eq 0 ] || grep -q "'${PREV}'].each" settings.gradle ; then - #before: - # '1.9.0'].each { - #after: - # '1.9.0', - # '1.10.0'].each { - sed -e "s/].each/,\\ - '${VERSION}'].each/" \ - -i.bak settings.gradle -else - #before: - # '1.9.0', - #after: - # '1.9.0', - # '1.9.1', - sed -e "s/'${PREV}'/'${PREV}',\\ - '${VERSION}'/" \ - -i.bak settings.gradle -fi -rm settings.gradle.bak - -action="Add" -ser="" -if [ $PATCH -ne 0 ] ; then - #if the serialization version has not changed, we can drop the previous patch - if [ "$cursver" = "$prevsver" ] ; then - sed -e "/'${PREV}'/d" -i.bak settings.gradle - rm settings.gradle.bak - action="Replace ${PREV} with" - ser=" - -The serialization version has not changed between ${PREV} and ${VERSION}, -so there should be no need to keep both" - fi -fi - -if [ -z "$LATER" ] ; then - #also update benchmark baseline for develop to this new minor - sed \ - -e "s/^ baseline_version_default:.*/ baseline_version_default: '${VERSION}'/" \ - -e "s/^ baseline_branch_default:.*/ baseline_branch_default: ''/" \ - -i.bak ci/pipelines/shared/jinja.variables.yml - rm ci/pipelines/shared/jinja.variables.yml.bak - BENCHMSG=" and set as default Benchmarks baseline" - #if custom baseline on develop is newer [than release branch cut date], resetting might - #be the wrong choice. but, assuming it's older, a new minor is the time to un-custom it - if [ $PATCH = 0 ] ; then - sed \ - -e "s/^ baseline_version:.*/ baseline_version: '${VERSION}'/" \ - -e "s/^ baseline_branch:.*/ baseline_branch: ''/" \ - -i.bak ci/pipelines/shared/jinja.variables.yml - rm ci/pipelines/shared/jinja.variables.yml.bak - BENCHMSG=" and set as Benchmarks baseline" - fi - set -x - git add ci/pipelines/shared/jinja.variables.yml -fi -set -x -git add settings.gradle -git diff --staged --color | cat -git commit -m "$JIRA: ${action} ${VERSION} as old version - -${action} ${VERSION} in old versions${BENCHMSG} on develop -to enable rolling upgrade tests from ${VERSION}${ser}" -git push -u myfork -set +x - - -echo "" -echo "============================================================" -echo "Updating 'old' versions and Benchmarks baseline on support/$VERSION_MM" -echo "============================================================" -set -x -cd ${GEODE} -git checkout support/${VERSION_MM} -git pull -set +x -#add at the end as this release will always be the latest on this branch -sed -e "s/].each/,\\ - '${VERSION}'].each/" \ - -i.bak settings.gradle -rm settings.gradle.bak -action="Add" -ser="" -if [ $PATCH -ne 0 ] ; then - #if the serialization version has not changed, we can drop the previous patch - if [ "$cursver" = "$prevsver" ] ; then - sed -e "/'${PREV}'/d" -i.bak settings.gradle - rm settings.gradle.bak - action="Replace ${PREV} with" - ser=" - -The serialization version has not changed between ${PREV} and ${VERSION}, -so there should be no need to keep both" - fi -else - #also update benchmark baseline for support branch to its new minor - sed \ - -e "s/^ baseline_version:.*/ baseline_version: '${VERSION}'/" \ - -e "s/^ baseline_version:.*/ baseline_version: '${VERSION}'/" \ - -e "s/^ baseline_version_default:.*/ baseline_version_default: '${VERSION}'/" \ - -e "s/^ baseline_branch:.*/ baseline_branch: ''/" \ - -e "s/^ baseline_branch_default:.*/ baseline_branch_default: ''/" \ - -i.bak ci/pipelines/shared/jinja.variables.yml - rm ci/pipelines/shared/jinja.variables.yml.bak - BENCHMSG2=" and set as Benchmarks baseline" - set -x - git add ci/pipelines/shared/jinja.variables.yml -fi -set -x -git add settings.gradle -git diff --staged --color | cat -git commit -m "$JIRA: ${action} ${VERSION} as old version - -${action} ${VERSION} in old versions${BENCHMSG2} on support/$VERSION_MM -to enable rolling upgrade tests from ${VERSION}${ser}" -git push -set +x - - -if [ -z "$LATER" ] ; then - for branch in develop support/$VERSION_MM ; do - echo "" - echo "============================================================" - echo "Updating default benchmark baseline on $branch" - echo "============================================================" - set -x - [ "develop" = "$branch" ] && BENCH=${GEODE_BENCHMARKS_DEVELOP} || BENCH=${GEODE_BENCHMARKS} - [ "develop" = "$branch" ] && BASEL=${VERSION} || BASEL=${VERSION_MM}.0 - cd ${BENCH} - git checkout $branch - git pull - set +x - #DEFAULT_BASELINE_VERSION=1.14.0 - sed -e "s/^DEFAULT_BASELINE_VERSION=.*/DEFAULT_BASELINE_VERSION=${BASEL}/" \ - -i.bak infrastructure/scripts/aws/run_against_baseline.sh - rm infrastructure/scripts/aws/run_against_baseline.sh.bak - set -x - git add infrastructure/scripts/aws/run_against_baseline.sh - if [ $(git diff --staged | wc -l) -gt 0 ] ; then - git diff --staged --color | cat - git commit -m "$JIRA: Update benchmark baseline - -Updates the default benchmark baseline on $branch to ${BASEL}" - git push - fi - set +x - done -fi - - -echo "" -echo "============================================================" -echo "Removing old Geode versions from mirrors" -echo "============================================================" -set -x -cd ${SVN_DIR}/../../release/geode -svn update -#identify the latest patch release for "N-2" (the latest 3 major.minor releases), remove anything else from mirrors (all releases remain available on non-mirrored archive site) -RELEASES_TO_KEEP=3 -set +x -ls | awk -F. '/^[0-9]/{print 1000000*$1+1000*$2+$3,$1"."$2"."$3}'| sort -n | awk '{mm=$2;sub(/\.[^.]*$/,"",mm);V[mm]=$2}END{for(v in V){print V[v]}}'|tail -$RELEASES_TO_KEEP > ../keep -echo Keeping releases: $(cat ../keep) -rm -f ../did.remove -(ls | grep '^[0-9]'; cat ../keep ../keep)|sort|uniq -u|while read oldVersion; do - set -x - svn rm $oldVersion - svn commit -m "$JIRA: Remove $oldVersion from mirrors - -ASF requests that we keep preferably one, and definitely fewer than 5 -releases on the mirrors, so aim for 3 to match N-2 support policy. - -Note: it is still archived at http://archive.apache.org/dist/geode" - set +x - [ ! -r ../did.remove ] || echo -n " and " >> ../did.remove - echo -n $oldVersion >> ../did.remove -done -touch ../did.remove -DID_REMOVE=$(cat ../did.remove) -rm ../keep ../did.remove - - -waitforserver "repo1.maven.org/maven2/org/apache/geode/apache-geode" - -echo "" -NEWVERSION="${VERSION_MM}.$(( PATCH + 1 ))" -echo "============================================================" -echo -n "Bumping version to ${NEWVERSION}" -cd "${WORKSPACE}/.." -${0%/*}/set_versions.sh -j $JIRA -v ${NEWVERSION} -s -w "${WORKSPACE}" - - -echo "" -echo "============================================================" -echo 'Done promoting Release Candidate to Official Release!' -echo "============================================================" -MAJOR="${VERSION_MM%.*}" -MINOR="${VERSION_MM#*.}" -PATCH="${VERSION##*.}" -cd ${GEODE}/../.. -echo "Final steps (some gaps in numbering is normal since not all steps apply to all releases):" -[ -n "$LATER" ] || echo "2. Go to https://github.com/${GITHUB_USER}/homebrew-core/pull/new/apache-geode-${VERSION} and submit the pull request" -echo "3. Go to https://github.com/${GITHUB_USER}/geode/pull/new/add-${VERSION}-to-old-versions and create the pull request" -[ -n "$LATER" ] || echo "3b.Go to https://github.com/${GITHUB_USER}/geode-native/pull/new/update-to-geode-${VERSION} and create the pull request" -[ -n "$LATER" ] && tag=":${VERSION}" || tag="" -echo "4. Validate docker image: docker run -it apachegeode/geode${tag}" -[ -n "$LATER" ] && caveat=" (UNLESS they are still unreleased on a later patch branch)" -echo "5. Mark ${VERSION} as Released in Jira and Bulk-transition JIRA issues fixed in this release to Closed${caveat}" -echo "5b.Publish to GitHub ( https://github.com/apache/geode/tags then Create Release from the 2nd ... menu ), filling out the form as follows:" -echo " Upload apache-geode-${VERSION}.tgz from: open ${GEODE}/geode-assembly/build/distributions/" -echo " Release Title: Apache Geode ${VERSION}" -echo " Release Description:" -[ "${PATCH}" -ne 0 ] && echo "This patch release includes a few bug fixes." || echo " This release includes a significant number of bug fixes and improvements." -echo "" -echo "sha256 for apache-geode-${VERSION}.tgz is $(awk '{print $1}' < ${GEODE}/geode-assembly/build/distributions/apache-geode-${VERSION}.tgz.sha256)" -echo "" -echo "See full release notes at https://cwiki.apache.org/confluence/display/GEODE/Release+Notes#ReleaseNotes-${VERSION}" -echo "" -echo "8. Check that ${VERSION} documentation has been published to https://geode.apache.org/docs/" -[ -z "$DID_REMOVE" ] || DID_REMOVE=" and ${DID_REMOVE} info has been removed" -echo "9. Check that ${VERSION} download info has been published to https://geode.apache.org/releases/${DID_REMOVE}" -[ "${PATCH}" -ne 0 ] || echo "10. If 3rd-party dependencies haven't been bumped in awhile, ask on the dev list for a volunteer (details in dev-tools/dependencies/README.md)" -[ "${PATCH}" -ne 0 ] || [ "${MINOR}" -lt 15 ] || echo "11. In accordance with Geode's N-2 support policy, propose on the dev list that the time has come to ${0%/*}/end_of_support.sh -v ${MAJOR}.$((MINOR - 3))" -[ "${PATCH}" -ne 0 ] || [ -n "$LATER" ] || echo "12. Log in to https://hub.docker.com/repository/docker/apachegeode/geode and update the latest Dockerfile linktext and url to ${VERSION_MM}" -[ -n "$LATER" ] || andnative=", geode-benchmarks, and geode-native" -echo "If there are any support branches between ${VERSION_MM} and develop, manually cherry-pick '${VERSION}' bump from develop to those branches of geode${andnative}." -echo "Bump support pipeline to ${VERSION_MM}.$(( PATCH + 1 )) by plussing BumpPatch in https://concourse.apachegeode-ci.info/teams/main/pipelines/apache-support-${VERSION_MM//./-}-main?group=semver-management" -[ "${PATCH}" -ne 0 ] || echo "Run cd ${GEODE} && geode-management/src/test/script/update-management-wiki.sh" -[ -n "$LATER" ] || echo "Make a note to confirm tomorrow morning that your homebrew PR passed its PR checks and was merged to master" -echo 'Send email! Note: MUST be sent from your @apache.org email address (see https://infra.apache.org/committer-email.html) and MUST be sent as Plain text (in gmail click three dots at bottom of compose window then Plain text mode)' -${0%/*}/print_announce_email.sh -v "${VERSION}" -f "${LATER}" -echo "" -which pbcopy >/dev/null && ${0%/*}/print_announce_email.sh -v "${VERSION}" -f "${LATER}" | pbcopy && echo "(copied to clipboard)" -waitforserver "dlcdn.apache.org/geode" "Please wait for this to complete before sending the above [ANNOUNCE] email. -All other tasks above can be completed now (while you wait for dlcdn)." diff --git a/dev-tools/release/set_copyright.sh b/dev-tools/release/set_copyright.sh deleted file mode 100755 index 74df49d655de..000000000000 --- a/dev-tools/release/set_copyright.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - -set -e - -usage() { - echo "Usage: set_copyright.sh -j ticket dirs" - echo " -j The GEODE-nnnnn Jira identifier for this chore" - echo " dirs one or more directories to search for copyrights" - exit 1 -} - -if [[ "$3" == "" ]] ; then - usage -fi - -if [[ "$1" != "-j" ]] ; then - usage -fi - -JIRA=$2 -shift 2 - -function failMsg { - errln=$1 - echo "ERROR: set_copyright script did NOT complete successfully" - echo "Comment out any steps that already succeeded (approximately lines 46-$(( errln - 1 ))) and try again" -} -trap 'failMsg $LINENO' ERR - - -echo "" -echo "============================================================" -echo "Checking Copyright NOTICE and updating year if necessary" -echo "============================================================" -set -x -year=$(date +%Y) -for DIR in $@ ; do - cd ${DIR} - git grep -l '^Copyright.*Apache' | grep NOTICE | while read NOTICE ; do - sed \ - -e "2s/ \(20[0-9][0-9]\) / \1-${year} /" \ - -e "2s/-20[0-9][0-9] /-${year} /" \ - -e "2s/${year}-${year}/${year}/" \ - -i.bak $NOTICE - rm -f $NOTICE.bak - git add $NOTICE - done - if [ $(git diff --staged | wc -l) -gt 0 ] ; then - git diff --staged --color | cat - git commit -a -m "$JIRA: Bumping copyright year to ${year}" - fi -done -set +x diff --git a/dev-tools/release/set_versions.sh b/dev-tools/release/set_versions.sh deleted file mode 100755 index afb65a6dc7f6..000000000000 --- a/dev-tools/release/set_versions.sh +++ /dev/null @@ -1,215 +0,0 @@ -#!/usr/bin/env bash -# -# 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. - -set -e - -usage() { - echo "Usage: set_versions.sh -j ticket -v version_number [-s]" - echo " -j The GEODE-nnnnn Jira identifier for this release" - echo " -v The #.#.# version number for the next release" - echo " -s configure examples to use latest snapshot instead of release" - exit 1 -} - -JIRA="" -FULL_VERSION="" - -while getopts ":j:v:snw:" opt; do - case ${opt} in - j ) - JIRA=$OPTARG - ;; - v ) - VERSION=$OPTARG - ;; - s ) - EXAMPLES_USE_SNAPSHOTS=true - ;; - n ) - NOPUSH=true - ;; - w ) - WORKSPACE="$OPTARG" - CLEAN=false - ;; - \? ) - usage - ;; - esac -done - -if [[ ${JIRA} == "" ]] || [[ ${VERSION} == "" ]] ; then - usage -fi - -if ! [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "Malformed version number ${VERSION}. Example valid version: 1.9.0" - exit 1 -fi - -BUILDSUFFIX="-build.0" -VERSION_MM=${VERSION%.*} - -if [ "${EXAMPLES_USE_SNAPSHOTS}" = "true" ] ; then - GEODEFOREXAMPLES="${VERSION_MM}.+" -else - GEODEFOREXAMPLES="${VERSION}" -fi - -set -x -[ -n "${WORKSPACE}" ] || WORKSPACE=$PWD/release-${VERSION}-workspace -GEODE=$WORKSPACE/geode -GEODE_EXAMPLES=$WORKSPACE/geode-examples -GEODE_BENCHMARKS=$WORKSPACE/geode-benchmarks -set +x - - -function failMsg1 { - echo "ERROR: set_versions script did NOT complete successfully. Please try again." -} -trap failMsg1 ERR - - -if [ "${CLEAN}" != "false" ] ; then - echo "" - echo "============================================================" - echo "Cleaning workspace directory..." - echo "============================================================" - set -x - rm -rf $WORKSPACE - mkdir -p $WORKSPACE - cd $WORKSPACE - set +x - - - echo "" - echo "============================================================" - echo "Cloning repositories..." - echo "============================================================" - set -x - git clone --single-branch --branch support/${VERSION_MM} git@github.com:apache/geode.git - git clone --single-branch --branch support/${VERSION_MM} git@github.com:apache/geode-examples.git - git clone --single-branch --branch support/${VERSION_MM} git@github.com:apache/geode-benchmarks.git - set +x -fi - - -function failMsg2 { - errln=$1 - echo "ERROR: set_versions script did NOT complete successfully" - echo "Comment out any steps that already succeeded (approximately lines 87-$(( errln - 1 ))) and try again" -} -trap 'failMsg2 $LINENO' ERR - - -echo "" -echo "============================================================" -echo "Setting Geode versions" -echo "============================================================" -set -x -cd ${GEODE} -set +x - -#version = 1.13.0-build.0 -sed -e "s/^version =.*/version = ${VERSION}${BUILDSUFFIX}/" -i.bak gradle.properties - -# product_version: '1.13' -sed -E \ - -e "s#product_version: '[0-9.]+'#product_version: '${VERSION_MM}'#" \ - -i.bak geode-book/config.yml - -#git clone -b branch --depth 1 https://github.com/apache/geode.git geode -sed -e "s#clone -b [ds][evlopurt/0-9.]*#clone -b support/${VERSION_MM}#" \ - -i.bak \ - ci/docker/cache_dependencies.sh \ - ci/images/google-geode-builder/scripts/cache_dependencies.sh - -rm -f gradle.properties.bak geode-book/config.yml.bak ci/docker/cache_dependencies.sh.bak ci/images/google-geode-builder/scripts/cache_dependencies.sh.bak -set -x -git add gradle.properties geode-book/config.yml ci/docker/cache_dependencies.sh ci/images/google-geode-builder/scripts/cache_dependencies.sh -if [ $(git diff --staged | wc -l) -gt 0 ] ; then - git diff --staged --color | cat - git commit -m "$JIRA: Bump version to ${VERSION} - -As part of the Geode Release Process, the build number must -be rolled forward so work can begin on the next release" - [ "$NOPUSH" = "true" ] || git push -u origin -fi -set +x - - -echo "" -echo "============================================================" -echo "Setting geode-examples version" -echo "============================================================" -set -x -cd ${GEODE_EXAMPLES} -git pull -set +x - -#version = 1.12.0-build.0 -#geodeVersion = 1.12.+ -sed -e "s/^version = .*/version = ${VERSION}${BUILDSUFFIX}/" \ - -e "s/^geodeVersion = .*/geodeVersion = ${GEODEFOREXAMPLES}/" \ - -i.bak gradle.properties - -rm gradle.properties.bak -set -x -git add . -if [ $(git diff --staged | wc -l) -gt 0 ] ; then - git diff --staged --color | cat - git commit -m "$JIRA: Bump version to ${VERSION} - -As part of the Geode Release Process, the geode-examples build number -must be rolled forward as work begins on the next release" - [ "$NOPUSH" = "true" ] || git push -u origin -fi -set +x - - -echo "" -echo "============================================================" -echo "Setting geode-benchmarks version" -echo "============================================================" -set -x -cd ${GEODE_BENCHMARKS} -git pull -set +x - -#versionNumber = 1.14.0 -sed -e "s/^versionNumber = .*/versionNumber = ${VERSION}/" \ - -i.bak gradle.properties - -rm gradle.properties.bak -set -x -git add gradle.properties -if [ $(git diff --staged | wc -l) -gt 0 ] ; then - git diff --staged --color | cat - git commit -m "$JIRA: Bump version to ${VERSION} - -As part of the Geode Release Process, the geode-benchmarks build number -must be rolled forward as work begins on the next release" - [ "$NOPUSH" = "true" ] || git push -u origin -fi -set +x - - -echo "" -echo "============================================================" -echo 'Done setting support versions!' -echo "============================================================" -cd ${GEODE}/../.. diff --git a/geode-assembly/src/integrationTest/resources/assembly_content.txt b/geode-assembly/src/integrationTest/resources/assembly_content.txt index bcfefacec471..921f5f8ea050 100644 --- a/geode-assembly/src/integrationTest/resources/assembly_content.txt +++ b/geode-assembly/src/integrationTest/resources/assembly_content.txt @@ -963,7 +963,6 @@ lib/hibernate-validator-8.0.1.Final.jar lib/httpclient5-5.4.4.jar lib/httpcore5-5.3.4.jar lib/httpcore5-h2-5.3.4.jar -lib/istack-commons-runtime-4.0.1.jar lib/istack-commons-runtime-4.1.1.jar lib/jackson-annotations-2.17.0.jar lib/jackson-core-2.17.0.jar diff --git a/geode-assembly/src/main/dist/LICENSE b/geode-assembly/src/main/dist/LICENSE index 010654b3cb03..56386e284383 100644 --- a/geode-assembly/src/main/dist/LICENSE +++ b/geode-assembly/src/main/dist/LICENSE @@ -217,12 +217,14 @@ The BSD 3-Clause License (http://opensource.org/licenses/BSD-3-Clause) Apache Geode bundles the following files under the BSD 3-Clause License: + - angus-activation v2.0.0 (https://github.com/eclipse-ee4j/angus-activation) - ANSIBuffer (http://jline.sourceforge.net/apidocs/jline/ANSIBuffer.html), Copyright (c) 2002-2007 Marc Prud'hommeaux. - Antlr v2.7.7 (http://www.antlr.org), Copyright (c) 2012 Terrence Parr and Sam Harwell - - ASM v9.1 (https://asm.ow2.io) Copyright (c) 2000-2011 INRIA, France + - ASM v9.8 (https://asm.ow2.io) Copyright (c) 2000-2011 INRIA, France Telecom + - jakarta.activation v2.1.3 (https://github.com/jakartaee/jaf-api) - JLine v2.12 (http://jline.sourceforge.net), Copyright (c) 2002-2006, Marc Prud'hommeaux - jQuery Sparklines v2.0 (http://omnipotent.net/jquery.sparkline/), @@ -259,16 +261,6 @@ POSSIBILITY OF SUCH DAMAGE. The CDDL Version 1.1 (https://javaee.github.io/glassfish/LICENSE) --------------------------------------------------------------------------- -Apache Geode bundles the following files under the Common Development and -Distribution License: - - - javax.activation v1.2.0 - (https://www.oracle.com/technetwork/java/javase/jaf-135115.html) - - javax.mail v1.6.2 (http://www.oracle.com/) - - javax.resource v 1.7.1 (https://glassfish.java.net/) - - javax.servlet v3.1.0 (https://glassfish.java.net/) - - javax.transaction v1.3 (https://glassfish.java.net/) - - jaxb v2.3.2 (https://javaee.github.io/jaxb-v2/) 1. Definitions. @@ -1022,10 +1014,11 @@ The EDL 1.0 License (http://www.eclipse.org/org/documents/edl-v10.php) Apache Geode bundles the following file under the EDL 1.0 License: - - istack-commons-runtime v4.0.1 - - jakarta.activation v1.2.1 - - jakarta.validation v2.0.2 - - jakarta.xml.bind v2.3.2 + - istack-commons-runtime v4.1.1 + - jakarta.xml.bind v4.0.2 + - jaxb-core v4.0.2 + - jaxb-runtime v4.0.2 + - txw2 v4.0.2 Eclipse Distribution License - v 1.0 @@ -1059,6 +1052,24 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--------------------------------------------------------------------------- +The EPL 2.0 License (https://www.eclipse.org/legal/epl-2.0/) +--------------------------------------------------------------------------- + +Apache Geode bundles the following files under the Eclipse Public License 2.0 +with the Secondary License of GPL-2.0 with Classpath Exception: + + - jakarta.annotation v2.1.1 (https://github.com/jakartaee/common-annotations-api) + - jakarta.el v5.0.0 (https://github.com/jakartaee/expression-language) + - jakarta.interceptor v2.1.0 (https://github.com/jakartaee/interceptors) + - jakarta.mail v2.1.2 (https://github.com/jakartaee/mail-api) + - jakarta.resource v2.1.0 (https://github.com/jakartaee/connectors) + - jakarta.servlet v6.0.0 (https://github.com/jakartaee/servlet) + - jakarta.transaction v2.0.1 (https://github.com/jakartaee/transactions) + +For the full EPL 2.0 license text, see: +https://www.eclipse.org/legal/epl-2.0/ + --------------------------------------------------------------------------- The MIT License (http://opensource.org/licenses/mit-license.html) --------------------------------------------------------------------------- @@ -1097,7 +1108,7 @@ Apache Geode bundles the following files under the MIT License: - Normalize.css v2.1.0 (https://necolas.github.io/normalize.css/), Copyright (c) Nicolas Gallagher and Jonathan Neal - Sizzle.js (http://sizzlejs.com/), Copyright (c) 2011, The Dojo Foundation - - SLF4J API v1.7.36 (http://www.slf4j.org), Copyright (c) 2004-2025 QOS.ch + - SLF4J API v2.0.17 (http://www.slf4j.org), Copyright (c) 2004-2025 QOS.ch - Split.js (https://github.com/nathancahill/Split.js), Copyright (c) 2015 Nathan Cahill - TableDnD v0.5 (https://github.com/isocra/TableDnD), Copyright (c) 2012 diff --git a/geode-book/config.yml b/geode-book/config.yml index c156d7e965c2..a311be02b4bf 100644 --- a/geode-book/config.yml +++ b/geode-book/config.yml @@ -21,19 +21,19 @@ public_host: localhost sections: - repository: name: geode-docs - directory: docs/guide/115 + directory: docs/guide/20 subnav_template: geode-subnav template_variables: product_name_long: Apache Geode product_name: Geode product_name_lowercase: geode - product_version: '1.15' - product_version_nodot: '115' - product_version_old_minor: '1.14' - product_version_geode: '1.15' - min_java_version: '8' - min_java_update: '121' + product_version: '2.0' + product_version_nodot: '20' + product_version_old_minor: '1.15' + product_version_geode: '2.0' + min_java_version: '17' + min_java_update: '16' support_url: http://geode.apache.org/community product_url: http://geode.apache.org/ book_title: Apache Geode Documentation diff --git a/geode-book/master_middleman/source/subnavs/geode-subnav.erb b/geode-book/master_middleman/source/subnavs/geode-subnav.erb index b4ba7467a4ce..f06a8914d460 100644 --- a/geode-book/master_middleman/source/subnavs/geode-subnav.erb +++ b/geode-book/master_middleman/source/subnavs/geode-subnav.erb @@ -2147,26 +2147,6 @@ limitations under the License.
  • Configuring Non-Sticky Sessions
  • -
  • - HTTP Session Management Module for Pivotal tc Server - -
  • HTTP Session Management Module for Tomcat
      diff --git a/geode-core/src/main/antlr/org/apache/geode/cache/query/internal/parse/oql.g b/geode-core/src/main/antlr/org/apache/geode/cache/query/internal/parse/oql.g index cdd1623333e5..5ae8b4e4a79e 100644 --- a/geode-core/src/main/antlr/org/apache/geode/cache/query/internal/parse/oql.g +++ b/geode-core/src/main/antlr/org/apache/geode/cache/query/internal/parse/oql.g @@ -571,11 +571,16 @@ projectionAttributes : projection!{ AST node = null;}: - lb1:identifier TOK_COLON! ( tok1:aggregateExpr{node = #tok1;} | tok2:expr{node = #tok2;}) + // Use syntactic predicate to resolve nondeterminism between aggregateExpr and expr. + // The predicate checks for aggregate function keywords (sum, avg, min, max, count) followed by '('. + // Without this, the parser cannot determine which alternative to choose when it sees these keywords, + // since they can also be used as identifiers in regular expressions. + lb1:identifier TOK_COLON! ( (("sum"|"avg"|"min"|"max"|"count") TOK_LPAREN)=> tok1:aggregateExpr{node = #tok1;} | tok2:expr{node = #tok2;}) { #projection = #([PROJECTION, "projection", "org.apache.geode.cache.query.internal.parse.ASTProjection"], node, #lb1); } | - (tok3:aggregateExpr{node = #tok3;} | tok4:expr{node = #tok4;}) + // Same syntactic predicate as above to handle projections without a label (identifier:) + ((("sum"|"avg"|"min"|"max"|"count") TOK_LPAREN)=> tok3:aggregateExpr{node = #tok3;} | tok4:expr{node = #tok4;}) ( "as" lb2: identifier @@ -958,7 +963,10 @@ collectionExpr : aggregateExpr { int aggFunc = -1; boolean distinctOnly = false; }: !("sum" {aggFunc = SUM;} | "avg" {aggFunc = AVG;} ) - TOK_LPAREN ("distinct"! {distinctOnly = true;} ) ? tokExpr1:expr TOK_RPAREN + // Use greedy option to resolve nondeterminism with optional 'distinct' keyword. + // Greedy tells the parser to match 'distinct' whenever it appears, rather than + // being ambiguous about whether to match it or skip directly to the expression. + TOK_LPAREN (options {greedy=true;}: "distinct"! {distinctOnly = true;} ) ? tokExpr1:expr TOK_RPAREN { #aggregateExpr = #([AGG_FUNC, "aggregate", "org.apache.geode.cache.query.internal.parse.ASTAggregateFunc"], #tokExpr1); ((ASTAggregateFunc)#aggregateExpr).setAggregateFunctionType(aggFunc); @@ -975,8 +983,9 @@ aggregateExpr { int aggFunc = -1; boolean distinctOnly = false; }: | "count"^ + // Same greedy option as above for count's optional 'distinct' keyword TOK_LPAREN! ( TOK_STAR - | ("distinct"! {distinctOnly = true;} ) ? expr ) TOK_RPAREN! + | (options {greedy=true;}: "distinct"! {distinctOnly = true;} ) ? expr ) TOK_RPAREN! { ((ASTAggregateFunc)#aggregateExpr).setAggregateFunctionType(COUNT); #aggregateExpr.setText("aggregate"); diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/deadlock/UnsafeThreadLocal.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/deadlock/UnsafeThreadLocal.java index 17872c29cb65..afabb84722d2 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/deadlock/UnsafeThreadLocal.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/deadlock/UnsafeThreadLocal.java @@ -14,72 +14,68 @@ */ package org.apache.geode.distributed.internal.deadlock; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; +import java.util.Map; +import java.util.WeakHashMap; /** - * Most of this thread local is safe to use, except for the getValue(Thread) method. That is not - * guaranteed to be correct. But for our deadlock detection tool I think it's good enough, and this - * class provides a very low overhead way for us to record what thread holds a particular resource. + * A ThreadLocal implementation that allows reading values from arbitrary threads, useful for + * deadlock detection. This implementation uses a WeakHashMap to track values per thread without + * requiring reflection or JVM internal access. * + *

      + * Unlike standard ThreadLocal, this class maintains an additional mapping that allows querying the + * value for any thread, not just the current thread. This is useful for deadlock detection where + * we need to inspect what resources other threads are holding. + *

      * + *

      + * The implementation uses WeakHashMap with Thread keys to ensure threads can be garbage collected + * when they terminate, preventing memory leaks. + *

      */ public class UnsafeThreadLocal extends ThreadLocal { /** - * Dangerous method. Uses reflection to extract the thread local for a given thread. - * - * Unlike get(), this method does not set the initial value if none is found - * + * Maps threads to their values. Uses WeakHashMap so terminated threads can be GC'd. Synchronized + * to ensure thread-safe access. */ - public T get(Thread thread) { - return (T) get(this, thread); - } + private final Map threadValues = + java.util.Collections.synchronizedMap(new WeakHashMap<>()); - private static Object get(ThreadLocal threadLocal, Thread thread) { - try { - Object threadLocalMap = - invokePrivate(threadLocal, "getMap", new Class[] {Thread.class}, new Object[] {thread}); - - if (threadLocalMap != null) { - Object entry = invokePrivate(threadLocalMap, "getEntry", new Class[] {ThreadLocal.class}, - new Object[] {threadLocal}); - if (entry != null) { - return getPrivate(entry, "value"); - } - } - return null; - } catch (Exception e) { - throw new RuntimeException("Unable to extract thread local", e); + /** + * Sets the value for the current thread and records it in the cross-thread map. + */ + @Override + public void set(T value) { + super.set(value); + if (value != null) { + threadValues.put(Thread.currentThread(), value); + } else { + threadValues.remove(Thread.currentThread()); } } - private static Object getPrivate(Object object, String fieldName) throws SecurityException, - NoSuchFieldException, IllegalArgumentException, IllegalAccessException { - Field field = object.getClass().getDeclaredField(fieldName); - field.setAccessible(true); - return field.get(object); + /** + * Removes the value for the current thread from both the ThreadLocal and the cross-thread map. + */ + @Override + public void remove() { + super.remove(); + threadValues.remove(Thread.currentThread()); } - private static Object invokePrivate(Object object, String methodName, Class[] argTypes, - Object[] args) throws SecurityException, NoSuchMethodException, IllegalArgumentException, - IllegalAccessException, InvocationTargetException { - - Method method = null; - Class clazz = object.getClass(); - while (method == null) { - try { - method = clazz.getDeclaredMethod(methodName, argTypes); - } catch (NoSuchMethodException e) { - clazz = clazz.getSuperclass(); - if (clazz == null) { - throw e; - } - } - } - method.setAccessible(true); - Object result = method.invoke(object, args); - return result; + /** + * Gets the value for an arbitrary thread, useful for deadlock detection. + * + *

      + * Unlike get(), this method does not set the initial value if none is found. Returns null if the + * specified thread has no value set. + *

      + * + * @param thread the thread whose value to retrieve + * @return the value for the specified thread, or null if none exists + */ + public T get(Thread thread) { + return threadValues.get(thread); } } diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/BufferAttachmentTracker.java b/geode-core/src/main/java/org/apache/geode/internal/net/BufferAttachmentTracker.java new file mode 100644 index 000000000000..67bc775c2622 --- /dev/null +++ b/geode-core/src/main/java/org/apache/geode/internal/net/BufferAttachmentTracker.java @@ -0,0 +1,103 @@ +/* + * 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. + */ + +package org.apache.geode.internal.net; + +import java.nio.ByteBuffer; +import java.util.Collections; +import java.util.IdentityHashMap; +import java.util.Map; + +/** + * Tracks the relationship between sliced ByteBuffers and their original parent buffers. + * This replaces the need to access internal JDK implementation classes, using only + * public Java APIs instead. + * + * When ByteBuffer.slice() is called, it creates a new buffer that shares content with + * the original. We need to track this relationship so that when returning buffers to + * the pool, we return the original pooled buffer, not the slice. + * + * This class uses IdentityHashMap (synchronized) which provides thread-safe access + * using object identity rather than equals(). This is critical because ByteBuffer.equals() + * compares buffer content and can throw IndexOutOfBoundsException if buffer position/limit + * is modified after being used as a map key. Callers must explicitly call removeTracking() + * to clean up entries when buffers are returned to the pool. + */ +class BufferAttachmentTracker { + + /** + * Maps sliced buffers to their original parent buffers using object identity. + * Uses synchronized IdentityHashMap for thread-safe access without relying on + * ByteBuffer.equals() or hashCode(), which can be problematic when buffer state changes. + * Entries must be explicitly removed via removeTracking() to prevent memory leaks. + * + * Note: This static mutable field is intentionally designed for global buffer tracking + * across the application. The PMD.StaticFieldsMustBeImmutable warning is suppressed + * because: + * 1. Mutable shared state is required to track buffer relationships across all threads + * 2. IdentityHashMap uses object identity (==) avoiding equals()/hashCode() issues + * 3. Collections.synchronizedMap provides thread-safe operations + * 4. This is the most efficient design for this use case + */ + @SuppressWarnings("PMD.StaticFieldsMustBeImmutable") + private static final Map sliceToOriginal = + Collections.synchronizedMap(new IdentityHashMap<>()); + + /** + * Records that a slice buffer was created from an original buffer. + * + * @param slice the sliced ByteBuffer + * @param original the original ByteBuffer that was sliced + */ + static void recordSlice(ByteBuffer slice, ByteBuffer original) { + sliceToOriginal.put(slice, original); + } + + /** + * Retrieves the original buffer for a given buffer, which may be a slice. + * If the buffer is not a slice (not tracked), returns the buffer itself. + * + * @param buffer the buffer to look up, which may be a slice + * @return the original pooled buffer, or the buffer itself if not a slice + */ + static ByteBuffer getOriginal(ByteBuffer buffer) { + ByteBuffer original = sliceToOriginal.get(buffer); + return original != null ? original : buffer; + } + + /** + * Removes tracking for a buffer. Should be called when returning a buffer + * to the pool to avoid memory leaks in the tracking map. + * + * @param buffer the buffer to stop tracking + */ + static void removeTracking(ByteBuffer buffer) { + sliceToOriginal.remove(buffer); + } + + /** + * For testing: returns the current size of the tracking map. + */ + static int getTrackingMapSize() { + return sliceToOriginal.size(); + } + + /** + * For testing: clears all tracking entries. + */ + static void clearTracking() { + sliceToOriginal.clear(); + } +} diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/BufferPool.java b/geode-core/src/main/java/org/apache/geode/internal/net/BufferPool.java index 56c0b7328c0b..09a1b1796858 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/net/BufferPool.java +++ b/geode-core/src/main/java/org/apache/geode/internal/net/BufferPool.java @@ -22,13 +22,11 @@ import org.jetbrains.annotations.NotNull; -import org.apache.geode.InternalGemFireException; import org.apache.geode.annotations.VisibleForTesting; import org.apache.geode.distributed.internal.DMStats; import org.apache.geode.distributed.internal.DistributionConfig; import org.apache.geode.internal.Assert; import org.apache.geode.internal.tcp.Connection; -import org.apache.geode.unsafe.internal.sun.nio.ch.DirectBuffer; import org.apache.geode.util.internal.GeodeGlossary; public class BufferPool { @@ -111,8 +109,11 @@ private ByteBuffer acquireDirectBuffer(int size, boolean send) { result = acquireLargeBuffer(send, size); } if (result.capacity() > size) { + ByteBuffer original = result; result.position(0).limit(size); result = result.slice(); + // Track the slice-to-original mapping to support buffer pool return + BufferAttachmentTracker.recordSlice(result, original); } return result; } @@ -159,19 +160,14 @@ private ByteBuffer acquirePredefinedFixedBuffer(boolean send, int size) { // it was garbage collected updateBufferStats(-defaultSize, ref.getSend(), true); } else { + // Reset the buffer to full capacity - clear() resets position and sets limit to capacity bb.clear(); - if (defaultSize > size) { - bb.limit(size); - } return bb; } ref = bufferTempQueue.poll(); } result = ByteBuffer.allocateDirect(defaultSize); updateBufferStats(defaultSize, send, true); - if (defaultSize > size) { - result.limit(size); - } return result; } @@ -267,17 +263,51 @@ ByteBuffer expandWriteBufferIfNeeded(BufferType type, ByteBuffer existing, } ByteBuffer acquireDirectBuffer(BufferPool.BufferType type, int capacity) { + // This method is used by NioPlainEngine and NioSslEngine which need full-capacity buffers + // that can be reused for multiple read/write operations. We should NOT create slices here. switch (type) { case UNTRACKED: return ByteBuffer.allocate(capacity); case TRACKED_SENDER: - return acquireDirectSenderBuffer(capacity); + return acquireDirectSenderBufferNonSliced(capacity); case TRACKED_RECEIVER: - return acquireDirectReceiveBuffer(capacity); + return acquireDirectReceiveBufferNonSliced(capacity); } throw new IllegalArgumentException("Unexpected buffer type " + type); } + /** + * Acquire a direct sender buffer without slicing - returns a buffer with capacity >= requested + * size + */ + private ByteBuffer acquireDirectSenderBufferNonSliced(int size) { + if (!useDirectBuffers) { + return ByteBuffer.allocate(size); + } + + if (size <= MEDIUM_BUFFER_SIZE) { + return acquirePredefinedFixedBuffer(true, size); + } else { + return acquireLargeBuffer(true, size); + } + } + + /** + * Acquire a direct receive buffer without slicing - returns a buffer with capacity >= requested + * size + */ + private ByteBuffer acquireDirectReceiveBufferNonSliced(int size) { + if (!useDirectBuffers) { + return ByteBuffer.allocate(size); + } + + if (size <= MEDIUM_BUFFER_SIZE) { + return acquirePredefinedFixedBuffer(false, size); + } else { + return acquireLargeBuffer(false, size); + } + } + ByteBuffer acquireNonDirectBuffer(BufferPool.BufferType type, int capacity) { switch (type) { case UNTRACKED: @@ -310,11 +340,13 @@ void releaseBuffer(BufferPool.BufferType type, @NotNull ByteBuffer buffer) { */ private void releaseBuffer(ByteBuffer buffer, boolean send) { if (buffer.isDirect()) { - buffer = getPoolableBuffer(buffer); - BBSoftReference bbRef = new BBSoftReference(buffer, send); - if (buffer.capacity() <= SMALL_BUFFER_SIZE) { + ByteBuffer original = getPoolableBuffer(buffer); + // Clean up tracking for this buffer to prevent memory leaks + BufferAttachmentTracker.removeTracking(buffer); + BBSoftReference bbRef = new BBSoftReference(original, send); + if (original.capacity() <= SMALL_BUFFER_SIZE) { bufferSmallQueue.offer(bbRef); - } else if (buffer.capacity() <= MEDIUM_BUFFER_SIZE) { + } else if (original.capacity() <= MEDIUM_BUFFER_SIZE) { bufferMiddleQueue.offer(bbRef); } else { bufferLargeQueue.offer(bbRef); @@ -328,25 +360,14 @@ private void releaseBuffer(ByteBuffer buffer, boolean send) { * If we hand out a buffer that is larger than the requested size we create a * "slice" of the buffer having the requested capacity and hand that out instead. * When we put the buffer back in the pool we need to find the original, non-sliced, - * buffer. This is held in DirectBuffer in its "attachment" field. + * buffer. This is tracked using BufferAttachmentTracker. * * This method is visible for use in debugging and testing. For debugging, invoke this method if * you need to see the non-sliced buffer for some reason, such as logging its hashcode. */ @VisibleForTesting ByteBuffer getPoolableBuffer(final ByteBuffer buffer) { - final Object attachment = DirectBuffer.attachment(buffer); - - if (null == attachment) { - return buffer; - } - - if (attachment instanceof ByteBuffer) { - return (ByteBuffer) attachment; - } - - throw new InternalGemFireException("direct byte buffer attachment was not a byte buffer but a " - + attachment.getClass().getName()); + return BufferAttachmentTracker.getOriginal(buffer); } /** diff --git a/geode-core/src/main/java/org/apache/geode/internal/offheap/AddressableMemoryManager.java b/geode-core/src/main/java/org/apache/geode/internal/offheap/AddressableMemoryManager.java index 7429c978786b..473beebf8e6e 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/offheap/AddressableMemoryManager.java +++ b/geode-core/src/main/java/org/apache/geode/internal/offheap/AddressableMemoryManager.java @@ -14,13 +14,9 @@ */ package org.apache.geode.internal.offheap; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.nio.ByteBuffer; import org.apache.geode.annotations.Immutable; -import org.apache.geode.annotations.internal.MakeNotStatic; import org.apache.geode.internal.JvmSizeUtils; import org.apache.geode.unsafe.internal.sun.misc.Unsafe; @@ -174,114 +170,68 @@ public static void fill(long addr, int size, byte fill) { unsafe.setMemory(addr, size, fill); } - @SuppressWarnings("rawtypes") - @MakeNotStatic - private static volatile Class dbbClass = null; - @SuppressWarnings("rawtypes") - @MakeNotStatic - private static volatile Constructor dbbCtor = null; - @MakeNotStatic - private static volatile boolean dbbCreateFailed = false; - @MakeNotStatic - private static volatile Method dbbAddressMethod = null; - @MakeNotStatic - private static volatile boolean dbbAddressFailed = false; - /** - * Returns the address of the Unsafe memory for the first byte of a direct ByteBuffer. If the - * buffer is not direct or the address can not be obtained return 0. + * Returns the address of the Unsafe memory for the first byte of a direct ByteBuffer. + * + * This implementation uses Unsafe to access the ByteBuffer's 'address' field directly, + * which eliminates the need for reflection with setAccessible() and therefore does not + * require the --add-opens=java.base/java.nio=ALL-UNNAMED JVM flag. + * + * If the buffer is not direct or the address cannot be obtained, returns 0. + * + * @param bb the ByteBuffer to get the address from + * @return the native memory address, or 0 if not available */ - @SuppressWarnings({"rawtypes", "unchecked"}) public static long getDirectByteBufferAddress(ByteBuffer bb) { if (!bb.isDirect()) { return 0L; } - if (dbbAddressFailed) { + if (unsafe == null) { return 0L; } - Method m = dbbAddressMethod; - if (m == null) { - Class c = dbbClass; - if (c == null) { - try { - c = Class.forName("java.nio.DirectByteBuffer"); - } catch (ClassNotFoundException e) { - // throw new IllegalStateException("Could not find java.nio.DirectByteBuffer", e); - dbbCreateFailed = true; - dbbAddressFailed = true; - return 0L; - } - dbbClass = c; - } - try { - m = c.getDeclaredMethod("address"); - } catch (NoSuchMethodException | SecurityException e) { - // throw new IllegalStateException("Could not get method DirectByteBuffer.address()", e); - dbbClass = null; - dbbAddressFailed = true; - return 0L; - } - m.setAccessible(true); - dbbAddressMethod = m; - } try { - return (Long) m.invoke(bb); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - // throw new IllegalStateException("Could not create an invoke DirectByteBuffer.address()", - // e); - dbbClass = null; - dbbAddressMethod = null; - dbbAddressFailed = true; + return unsafe.getBufferAddress(bb); + } catch (Exception e) { + // If Unsafe access fails, return 0 to indicate failure return 0L; } } /** - * Create a direct byte buffer given its address and size. The returned ByteBuffer will be direct - * and use the memory at the given address. + * Create a direct byte buffer given its address and size. + * + * This implementation creates a standard DirectByteBuffer and then modifies its internal + * 'address' field to point to the given memory address using Unsafe. This approach uses + * field-level access via Unsafe which does not require --add-opens flags. * - * @return the created direct byte buffer or null if it could not be created. + * The resulting ByteBuffer directly wraps the memory at the given address without copying, + * making it a zero-copy operation suitable for off-heap memory management. + * + * @param address the native memory address to wrap + * @param size the size of the buffer + * @return the created direct byte buffer wrapping the address, or null if creation failed */ - @SuppressWarnings({"rawtypes", "unchecked"}) static ByteBuffer createDirectByteBuffer(long address, int size) { - if (dbbCreateFailed) { + if (unsafe == null) { return null; } - Constructor ctor = dbbCtor; - if (ctor == null) { - Class c = dbbClass; - if (c == null) { - try { - c = Class.forName("java.nio.DirectByteBuffer"); - } catch (ClassNotFoundException e) { - // throw new IllegalStateException("Could not find java.nio.DirectByteBuffer", e); - dbbCreateFailed = true; - dbbAddressFailed = true; - return null; - } - dbbClass = c; - } - try { - ctor = c.getDeclaredConstructor(long.class, int.class); - } catch (NoSuchMethodException | SecurityException e) { - // throw new IllegalStateException("Could not get constructor DirectByteBuffer(long, int)", - // e); - dbbClass = null; - dbbCreateFailed = true; - return null; - } - ctor.setAccessible(true); - dbbCtor = ctor; - } try { - return (ByteBuffer) ctor.newInstance(address, size); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException e) { - // throw new IllegalStateException("Could not create an instance using DirectByteBuffer(long, - // int)", e); - dbbClass = null; - dbbCtor = null; - dbbCreateFailed = true; + // Allocate a small DirectByteBuffer using standard public API + // We'll reuse this buffer's structure but change its address and capacity + ByteBuffer buffer = ByteBuffer.allocateDirect(1); + + // Use Unsafe to modify the buffer's internal fields to point to our address + // This is similar to calling the private DirectByteBuffer(long, int) constructor + // but using field access instead of constructor reflection + unsafe.setBufferAddress(buffer, address); + unsafe.setBufferCapacity(buffer, size); + + // Reset position and limit to match the new capacity + buffer.clear(); + buffer.limit(size); + + return buffer; + } catch (Exception e) { return null; } } diff --git a/geode-core/src/main/java/org/apache/geode/internal/stats50/VMStats50.java b/geode-core/src/main/java/org/apache/geode/internal/stats50/VMStats50.java index a2d25dadeb0b..b223ab3ecbcf 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/stats50/VMStats50.java +++ b/geode-core/src/main/java/org/apache/geode/internal/stats50/VMStats50.java @@ -20,10 +20,8 @@ import java.lang.management.MemoryMXBean; import java.lang.management.MemoryPoolMXBean; import java.lang.management.MemoryUsage; -import java.lang.management.OperatingSystemMXBean; import java.lang.management.ThreadInfo; import java.lang.management.ThreadMXBean; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -31,6 +29,8 @@ import java.util.List; import java.util.Map; +import com.sun.management.OperatingSystemMXBean; +import com.sun.management.UnixOperatingSystemMXBean; import org.apache.logging.log4j.Logger; import org.apache.geode.StatisticDescriptor; @@ -41,7 +41,6 @@ import org.apache.geode.SystemFailure; import org.apache.geode.annotations.Immutable; import org.apache.geode.annotations.internal.MakeNotStatic; -import org.apache.geode.internal.classloader.ClassPathLoader; import org.apache.geode.internal.statistics.StatisticsTypeFactoryImpl; import org.apache.geode.internal.statistics.VMStatsContract; import org.apache.geode.logging.internal.log4j.api.LogService; @@ -61,20 +60,24 @@ public class VMStats50 implements VMStatsContract { private static final ClassLoadingMXBean clBean; @Immutable private static final MemoryMXBean memBean; - @Immutable - private static final OperatingSystemMXBean osBean; + /** - * This is actually an instance of UnixOperatingSystemMXBean but this class is not available on - * Windows so needed to make this a runtime check. + * Platform-specific OperatingSystemMXBean providing extended metrics beyond the standard + * java.lang.management.OperatingSystemMXBean. This interface is in the exported + * com.sun.management package and provides processCpuTime and other platform metrics. + * Available on all platforms. */ @Immutable - private static final Object unixBean; - @Immutable - private static final Method getMaxFileDescriptorCount; - @Immutable - private static final Method getOpenFileDescriptorCount; + private static final OperatingSystemMXBean platformOsBean; + + /** + * Unix-specific OperatingSystemMXBean providing file descriptor metrics. + * Only available on Unix-like platforms (Linux, macOS, Solaris, etc.). + * Gracefully null on Windows and other non-Unix platforms. + */ @Immutable - private static final Method getProcessCpuTime; + private static final UnixOperatingSystemMXBean unixOsBean; + @Immutable private static final ThreadMXBean threadBean; @@ -150,52 +153,53 @@ public class VMStats50 implements VMStatsContract { static { clBean = ManagementFactory.getClassLoadingMXBean(); memBean = ManagementFactory.getMemoryMXBean(); - osBean = ManagementFactory.getOperatingSystemMXBean(); - { - Method m1 = null; - Method m2 = null; - Method m3 = null; - Object bean = null; - try { - Class c = - ClassPathLoader.getLatest().forName("com.sun.management.UnixOperatingSystemMXBean"); - if (c.isInstance(osBean)) { - m1 = c.getMethod("getMaxFileDescriptorCount"); - m2 = c.getMethod("getOpenFileDescriptorCount"); - bean = osBean; - } else { - // leave them null - } - // Always set ProcessCpuTime - m3 = osBean.getClass().getMethod("getProcessCpuTime"); - if (m3 != null) { - m3.setAccessible(true); - } - } catch (VirtualMachineError err) { - SystemFailure.initiateFailure(err); - // If this ever returns, rethrow the error. We're poisoned - // now, so don't let this thread continue. - throw err; - } catch (Throwable ex) { - // Whenever you catch Error or Throwable, you must also - // catch VirtualMachineError (see above). However, there is - // _still_ a possibility that you are dealing with a cascading - // error condition, so you also need to check to see if the JVM - // is still usable: - logger.warn(ex.getMessage()); - SystemFailure.checkFailure(); - // must be on a platform that does not support unix mxbean - bean = null; - m1 = null; - m2 = null; - m3 = null; - } finally { - unixBean = bean; - getMaxFileDescriptorCount = m1; - getOpenFileDescriptorCount = m2; - getProcessCpuTime = m3; + + // Initialize platform-specific MXBeans using direct interface casting. + // This approach eliminates the need for reflection and --add-opens flags. + // The com.sun.management package is exported by jdk.management module, + // making these interfaces accessible without module violations. + OperatingSystemMXBean tempPlatformBean = null; + UnixOperatingSystemMXBean tempUnixBean = null; + + try { + // Get the standard OperatingSystemMXBean + java.lang.management.OperatingSystemMXBean stdOsBean = + ManagementFactory.getOperatingSystemMXBean(); + + // Cast to com.sun.management.OperatingSystemMXBean for extended metrics + // This interface is in the exported com.sun.management package + if (stdOsBean instanceof OperatingSystemMXBean) { + tempPlatformBean = (OperatingSystemMXBean) stdOsBean; } + + // Check for Unix-specific interface + // This is only available on Unix-like platforms (Linux, macOS, Solaris) + if (stdOsBean instanceof UnixOperatingSystemMXBean) { + tempUnixBean = (UnixOperatingSystemMXBean) stdOsBean; + } + } catch (VirtualMachineError err) { + SystemFailure.initiateFailure(err); + // If this ever returns, rethrow the error. We're poisoned + // now, so don't let this thread continue. + throw err; + } catch (Throwable ex) { + // Whenever you catch Error or Throwable, you must also + // catch VirtualMachineError (see above). However, there is + // _still_ a possibility that you are dealing with a cascading + // error condition, so you also need to check to see if the JVM + // is still usable: + logger.warn( + "Unable to access platform OperatingSystemMXBean for statistics collection. " + + "This affects monitoring metrics but does not impact core Geode functionality: {}", + ex.getMessage()); + SystemFailure.checkFailure(); + tempPlatformBean = null; + tempUnixBean = null; + } finally { + platformOsBean = tempPlatformBean; + unixOsBean = tempUnixBean; } + threadBean = ManagementFactory.getThreadMXBean(); if (THREAD_STATS_ENABLED) { if (threadBean.isThreadCpuTimeSupported()) { @@ -242,7 +246,7 @@ public class VMStats50 implements VMStatsContract { true)); sds.add(f.createLongCounter("processCpuTime", "CPU timed used by the process in nanoseconds.", "nanoseconds")); - if (unixBean != null) { + if (unixOsBean != null) { sds.add(f.createLongGauge("fdLimit", "Maximum number of file descriptors", "fds", true)); sds.add(f.createLongGauge("fdsOpen", "Current number of open file descriptors", "fds")); } @@ -260,7 +264,7 @@ public class VMStats50 implements VMStatsContract { totalMemoryId = vmType.nameToId("totalMemory"); maxMemoryId = vmType.nameToId("maxMemory"); processCpuTimeId = vmType.nameToId("processCpuTime"); - if (unixBean != null) { + if (unixOsBean != null) { unix_fdLimitId = vmType.nameToId("fdLimit"); unix_fdsOpenId = vmType.nameToId("fdsOpen"); } else { @@ -585,7 +589,9 @@ private void refreshGC() { public void refresh() { Runtime rt = Runtime.getRuntime(); vmStats.setInt(pendingFinalizationCountId, memBean.getObjectPendingFinalizationCount()); - vmStats.setInt(cpusId, osBean.getAvailableProcessors()); + if (platformOsBean != null) { + vmStats.setInt(cpusId, platformOsBean.getAvailableProcessors()); + } vmStats.setInt(threadsId, threadBean.getThreadCount()); vmStats.setInt(daemonThreadsId, threadBean.getDaemonThreadCount()); vmStats.setInt(peakThreadsId, threadBean.getPeakThreadCount()); @@ -596,32 +602,38 @@ public void refresh() { vmStats.setLong(totalMemoryId, rt.totalMemory()); vmStats.setLong(maxMemoryId, rt.maxMemory()); - // Compute processCpuTime separately, if not accessible ignore - try { - if (getProcessCpuTime != null) { - Object v = getProcessCpuTime.invoke(osBean); - vmStats.setLong(processCpuTimeId, (Long) v); + // Collect process CPU time using public com.sun.management API. + // No reflection or setAccessible() required - this is a properly + // exported interface method from the jdk.management module. + if (platformOsBean != null) { + try { + long cpuTime = platformOsBean.getProcessCpuTime(); + vmStats.setLong(processCpuTimeId, cpuTime); + } catch (VirtualMachineError err) { + SystemFailure.initiateFailure(err); + // If this ever returns, rethrow the error. We're poisoned + // now, so don't let this thread continue. + throw err; + } catch (Throwable ex) { + // Whenever you catch Error or Throwable, you must also + // catch VirtualMachineError (see above). However, there is + // _still_ a possibility that you are dealing with a cascading + // error condition, so you also need to check to see if the JVM + // is still usable: + SystemFailure.checkFailure(); } - } catch (VirtualMachineError err) { - SystemFailure.initiateFailure(err); - // If this ever returns, rethrow the error. We're poisoned - // now, so don't let this thread continue. - throw err; - } catch (Throwable ex) { - // Whenever you catch Error or Throwable, you must also - // catch VirtualMachineError (see above). However, there is - // _still_ a possibility that you are dealing with a cascading - // error condition, so you also need to check to see if the JVM - // is still usable: - SystemFailure.checkFailure(); } - if (unixBean != null) { + // Collect Unix-specific file descriptor metrics. + // This interface is only implemented on Unix-like platforms; + // gracefully null on Windows. + if (unixOsBean != null) { try { - Object v = getMaxFileDescriptorCount.invoke(unixBean); - vmStats.setLong(unix_fdLimitId, (Long) v); - v = getOpenFileDescriptorCount.invoke(unixBean); - vmStats.setLong(unix_fdsOpenId, (Long) v); + long maxFd = unixOsBean.getMaxFileDescriptorCount(); + vmStats.setLong(unix_fdLimitId, maxFd); + + long openFd = unixOsBean.getOpenFileDescriptorCount(); + vmStats.setLong(unix_fdsOpenId, openFd); } catch (VirtualMachineError err) { SystemFailure.initiateFailure(err); // If this ever returns, rethrow the error. We're poisoned diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/AbstractCompiledValueTestJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/AbstractCompiledValueTestJUnitTest.java index 8f1e4f4d28ca..b996f872b11f 100644 --- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/AbstractCompiledValueTestJUnitTest.java +++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/AbstractCompiledValueTestJUnitTest.java @@ -24,6 +24,7 @@ import org.junit.Test; import org.junit.runner.RunWith; +import org.apache.geode.cache.query.internal.parse.OQLLexerTokenTypes; import org.apache.geode.cache.query.internal.types.CollectionTypeImpl; import org.apache.geode.test.junit.runners.GeodeParamsRunner; @@ -47,7 +48,13 @@ private CompiledValue[] getCompiledValuesWhichDoNotImplementGetReceiver() { new LinkedHashMap<>()), new CompiledIn(compiledValue1, compiledValue2), new CompiledIteratorDef("test", new CollectionTypeImpl(), compiledValue1), - new CompiledJunction(new CompiledValue[] {compiledValue1, compiledValue2}, 89), + // Changed from hardcoded value 89 to OQLLexerTokenTypes.LITERAL_or constant. + // The hardcoded value 89 was the token number for LITERAL_or in the original grammar, + // but after adding syntactic predicates to fix nondeterminism warnings, the token + // numbering changed (LITERAL_or is now 94). Using the constant ensures this test + // remains correct regardless of future grammar changes. + new CompiledJunction(new CompiledValue[] {compiledValue1, compiledValue2}, + OQLLexerTokenTypes.LITERAL_or), new CompiledLike(compiledValue1, compiledValue2), new CompiledLiteral(compiledValue1), new CompiledMod(compiledValue1, compiledValue2), diff --git a/geode-core/src/test/java/org/apache/geode/internal/net/BufferAttachmentTrackerTest.java b/geode-core/src/test/java/org/apache/geode/internal/net/BufferAttachmentTrackerTest.java new file mode 100644 index 000000000000..aa37d9b64aa9 --- /dev/null +++ b/geode-core/src/test/java/org/apache/geode/internal/net/BufferAttachmentTrackerTest.java @@ -0,0 +1,236 @@ +/* + * 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. + */ + +package org.apache.geode.internal.net; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.nio.ByteBuffer; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import org.junit.After; +import org.junit.Test; + +/** + * Unit tests for BufferAttachmentTracker. + */ +public class BufferAttachmentTrackerTest { + + @After + public void tearDown() { + // Clean up after each test + BufferAttachmentTracker.clearTracking(); + } + + @Test + public void getOriginal_returnsOriginalBufferForSlice() { + ByteBuffer original = ByteBuffer.allocateDirect(1024); + original.position(0).limit(512); + ByteBuffer slice = original.slice(); + + BufferAttachmentTracker.recordSlice(slice, original); + + ByteBuffer result = BufferAttachmentTracker.getOriginal(slice); + + assertThat(result).isSameAs(original); + } + + @Test + public void getOriginal_returnsBufferItselfWhenNotTracked() { + ByteBuffer buffer = ByteBuffer.allocateDirect(1024); + + ByteBuffer result = BufferAttachmentTracker.getOriginal(buffer); + + assertThat(result).isSameAs(buffer); + } + + @Test + public void removeTracking_removesSliceMapping() { + ByteBuffer original = ByteBuffer.allocateDirect(1024); + original.position(0).limit(512); + ByteBuffer slice = original.slice(); + + BufferAttachmentTracker.recordSlice(slice, original); + assertThat(BufferAttachmentTracker.getTrackingMapSize()).isEqualTo(1); + + BufferAttachmentTracker.removeTracking(slice); + + assertThat(BufferAttachmentTracker.getTrackingMapSize()).isEqualTo(0); + assertThat(BufferAttachmentTracker.getOriginal(slice)).isSameAs(slice); + } + + @Test + public void trackingMapSize_reflectsCurrentMappings() { + assertThat(BufferAttachmentTracker.getTrackingMapSize()).isEqualTo(0); + + ByteBuffer original1 = ByteBuffer.allocateDirect(1024); + ByteBuffer slice1 = original1.slice(); + BufferAttachmentTracker.recordSlice(slice1, original1); + assertThat(BufferAttachmentTracker.getTrackingMapSize()).isEqualTo(1); + + ByteBuffer original2 = ByteBuffer.allocateDirect(2048); + ByteBuffer slice2 = original2.slice(); + BufferAttachmentTracker.recordSlice(slice2, original2); + assertThat(BufferAttachmentTracker.getTrackingMapSize()).isEqualTo(2); + } + + @Test + public void clearTracking_removesAllMappings() { + ByteBuffer original1 = ByteBuffer.allocateDirect(1024); + ByteBuffer slice1 = original1.slice(); + BufferAttachmentTracker.recordSlice(slice1, original1); + + ByteBuffer original2 = ByteBuffer.allocateDirect(2048); + ByteBuffer slice2 = original2.slice(); + BufferAttachmentTracker.recordSlice(slice2, original2); + + assertThat(BufferAttachmentTracker.getTrackingMapSize()).isEqualTo(2); + + BufferAttachmentTracker.clearTracking(); + + assertThat(BufferAttachmentTracker.getTrackingMapSize()).isEqualTo(0); + } + + @Test + public void recordSlice_canOverwriteExistingMapping() { + ByteBuffer original1 = ByteBuffer.allocateDirect(1024); + ByteBuffer original2 = ByteBuffer.allocateDirect(2048); + ByteBuffer slice = original1.slice(); + + BufferAttachmentTracker.recordSlice(slice, original1); + assertThat(BufferAttachmentTracker.getOriginal(slice)).isSameAs(original1); + + BufferAttachmentTracker.recordSlice(slice, original2); + assertThat(BufferAttachmentTracker.getOriginal(slice)).isSameAs(original2); + } + + @Test + public void worksWithHeapBuffers() { + ByteBuffer original = ByteBuffer.allocate(1024); + original.position(0).limit(512); + ByteBuffer slice = original.slice(); + + BufferAttachmentTracker.recordSlice(slice, original); + + ByteBuffer result = BufferAttachmentTracker.getOriginal(slice); + + assertThat(result).isSameAs(original); + } + + @Test + public void simpleThreadSafetyTest() { + // Create a single original and slice + ByteBuffer original = ByteBuffer.allocateDirect(1024); + ByteBuffer slice = original.slice(); + + // Record it + BufferAttachmentTracker.recordSlice(slice, original); + + // Immediately retrieve it + ByteBuffer result = BufferAttachmentTracker.getOriginal(slice); + + // Should get back the exact same original + assertThat(result).isSameAs(original); + assertThat(result).isNotSameAs(slice); + + System.out.println("Original identity: " + System.identityHashCode(original)); + System.out.println("Slice identity: " + System.identityHashCode(slice)); + System.out.println("Result identity: " + System.identityHashCode(result)); + } + + /** + * Thread-safety test: Concurrent reads and writes on the same slice. + * This verifies that race conditions don't cause incorrect mappings. + */ + @Test + public void concurrentAccessToSameSlice_isThreadSafe() throws InterruptedException { + final int numThreads = 10; + final int iterations = 1000; + final ExecutorService executor = Executors.newFixedThreadPool(numThreads); + final CountDownLatch startLatch = new CountDownLatch(1); + final CountDownLatch doneLatch = new CountDownLatch(numThreads); + final AtomicInteger errors = new AtomicInteger(0); + + ByteBuffer original = ByteBuffer.allocateDirect(1024); + ByteBuffer slice = original.slice(); + + for (int i = 0; i < numThreads; i++) { + executor.submit(() -> { + try { + startLatch.await(); + + for (int j = 0; j < iterations; j++) { + // Record the mapping + BufferAttachmentTracker.recordSlice(slice, original); + + // Immediately retrieve it + ByteBuffer retrieved = BufferAttachmentTracker.getOriginal(slice); + + // Should always get the original back + if (retrieved != original) { + errors.incrementAndGet(); + } + } + } catch (Exception e) { + errors.incrementAndGet(); + e.printStackTrace(); + } finally { + doneLatch.countDown(); + } + }); + } + + startLatch.countDown(); + boolean completed = doneLatch.await(30, TimeUnit.SECONDS); + executor.shutdown(); + + assertThat(completed).isTrue(); + assertThat(errors.get()).isEqualTo(0); + } + + /** + * Memory safety test: Verifies that WeakHashMap allows slice buffers to be + * garbage collected without causing memory leaks. + */ + @Test + public void weakHashMap_allowsGarbageCollection() { + ByteBuffer original = ByteBuffer.allocateDirect(1024); + ByteBuffer slice = original.slice(); + + BufferAttachmentTracker.recordSlice(slice, original); + assertThat(BufferAttachmentTracker.getTrackingMapSize()).isEqualTo(1); + + // Remove reference to slice (but not original) + slice = null; + + // Force garbage collection + System.gc(); + System.runFinalization(); + + // Give GC time to clean up weak references + // The WeakHashMap should eventually remove the entry when the slice is GC'd + // Note: This is non-deterministic, so we can't assert on size without + // potentially making the test flaky. The important thing is that it + // doesn't prevent GC. + + // What we can verify is that having null'd the slice doesn't break anything + ByteBuffer result = BufferAttachmentTracker.getOriginal(original); + assertThat(result).isSameAs(original); // Original still works + } +} diff --git a/geode-docs/configuring/cluster_config/persisting_configurations.html.md.erb b/geode-docs/configuring/cluster_config/persisting_configurations.html.md.erb index 8ba79f390e30..f522a62372f2 100644 --- a/geode-docs/configuring/cluster_config/persisting_configurations.html.md.erb +++ b/geode-docs/configuring/cluster_config/persisting_configurations.html.md.erb @@ -58,7 +58,7 @@ This section provides a walk-through example of configuring a simple <%=vars.pro Process ID: 70919 Uptime: 12 seconds <%=vars.product_name%> Version: <%=vars.product_version%> - Java Version: 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> + Java Version: <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Log File: /Users/username/my_geode/locator1/locator1.log JVM Arguments: -Dgemfire.enable-cluster-configuration=true -Dgemfire.load-cluster-configuration-from-dir=false @@ -84,7 +84,7 @@ This section provides a walk-through example of configuring a simple <%=vars.pro Process ID: 5627 Uptime: 2 seconds <%=vars.product_name%> Version: <%=vars.product_version%> - Java Version: 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> + Java Version: <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Log File: /Users/username/my_geode/server1/server1.log JVM Arguments: -Dgemfire.default.locators=192.0.2.0[10334] -Dgemfire.groups=group1 @@ -100,7 +100,7 @@ This section provides a walk-through example of configuring a simple <%=vars.pro Process ID: 5634 Uptime: 2 seconds <%=vars.product_name%> Version: <%=vars.product_version%> - Java Version: 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> + Java Version: <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Log File: /Users/username/my_geode/server2/server2.log JVM Arguments: -Dgemfire.default.locators=192.0.2.0[10334] -Dgemfire.groups=group1 @@ -117,7 +117,7 @@ This section provides a walk-through example of configuring a simple <%=vars.pro Process ID: 5637 Uptime: 2 seconds <%=vars.product_name%> Version: <%=vars.product_version%> - Java Version: 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> + Java Version: <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Log File: /Users/username/my_geode/server3/server3.log JVM Arguments: -Dgemfire.default.locators=192.0.2.0[10334] -Dgemfire.start-dev-rest-api=false -Dgemfire.use-cluster-configuration=true @@ -239,7 +239,7 @@ This section provides a walk-through example of configuring a simple <%=vars.pro Process ID: 5749 Uptime: 15 seconds <%=vars.product_name%> Version: <%=vars.product_version%> - Java Version: 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> + Java Version: <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Log File: /Users/username/new_geode/locator2/locator2.log JVM Arguments: -Dgemfire.enable-cluster-configuration=true @@ -276,7 +276,7 @@ This section provides a walk-through example of configuring a simple <%=vars.pro Process ID: 5813 Uptime: 4 seconds <%=vars.product_name%> Version: <%=vars.product_version%> - Java Version: 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> + Java Version: <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Log File: /Users/username/new_geode/server4/server4.log JVM Arguments: -Dgemfire.default.locators=192.0.2.0[10335] @@ -297,7 +297,7 @@ This section provides a walk-through example of configuring a simple <%=vars.pro Process ID: 5954 Uptime: 2 seconds <%=vars.product_name%> Version: <%=vars.product_version%> - Java Version: 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> + Java Version: <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Log File: /Users/username/new_geode/server5/server5.log JVM Arguments: -Dgemfire.default.locators=192.0.2.0[10335] -Dgemfire.groups=group1 -Dgemfire.start-dev-rest-api=false -Dgemfire.use-cluster-configuration=true diff --git a/geode-docs/configuring/running/running_the_cacheserver.html.md.erb b/geode-docs/configuring/running/running_the_cacheserver.html.md.erb index fd21d6a537a9..b607ba57eed1 100644 --- a/geode-docs/configuring/running/running_the_cacheserver.html.md.erb +++ b/geode-docs/configuring/running/running_the_cacheserver.html.md.erb @@ -147,12 +147,11 @@ If successful, the output provides information as in this sample: % gfsh status server --dir=server4 Server in /home/username/server4 on 192.0.2.0[40404] as server4 is currently online. Process ID: 49008 -Uptime: 2 minutes 4 seconds -<%=vars.product_name %> Version: <%=vars.product_version %> -Java Version: 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> -Log File: /home/username/server4/server4.log -JVM Arguments: -... +Uptime: 2 seconds +<%=vars.product_name%> Version: <%=vars.product_version%> +Java Version: <%=vars.min_java_version%>.0.<%=vars.min_java_update%> +Log File: /Users/username/my_geode/server1/server1.log +JVM Arguments: -Dgemfire.default.locators=192.0.2.0[10334] ``` ## Stop Server diff --git a/geode-docs/configuring/running/running_the_locator.html.md.erb b/geode-docs/configuring/running/running_the_locator.html.md.erb index dbd7328b4744..591da1635b21 100644 --- a/geode-docs/configuring/running/running_the_locator.html.md.erb +++ b/geode-docs/configuring/running/running_the_locator.html.md.erb @@ -203,7 +203,7 @@ Locator in /home/user/locator1 on ubuntu.local[10334] as locator1 is currently o Process ID: 2359 Uptime: 17 minutes 3 seconds GemFire Version: 8.0.0 -Java Version: 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> +Java Version: <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Log File: /home/user/locator1/locator1.log JVM Arguments: -Dgemfire.enable-cluster-configuration=true -Dgemfire.load-cluster-configuration-from-dir=false -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806 diff --git a/geode-docs/getting_started/15_minute_quickstart_gfsh.html.md.erb b/geode-docs/getting_started/15_minute_quickstart_gfsh.html.md.erb index bcf3700a8441..6b30e0b8281e 100644 --- a/geode-docs/getting_started/15_minute_quickstart_gfsh.html.md.erb +++ b/geode-docs/getting_started/15_minute_quickstart_gfsh.html.md.erb @@ -54,12 +54,12 @@ The *locator* is a <%=vars.product_name%> process that tells new, connecting mem Process ID: 3529 Uptime: 18 seconds <%=vars.product_name%> Version: <%=vars.product_version%> - Java Version: 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> + Java Version: <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Log File: /home/username/my_geode/locator1/locator1.log JVM Arguments: -Dgemfire.enable-cluster-configuration=true -Dgemfire.load-cluster-configuration-from-dir=false -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806 - Class-Path: /home/username/Apache_Geode_Linux/lib/geode-core-1.0.0.jar: + Class-Path: /home/username/Apache_Geode_Linux/lib/geode-core-2.0.0.jar: /home/username/Apache_Geode_Linux/lib/geode-dependencies.jar Successfully connected to: JMX Manager [host=10.118.33.169, port=1099] @@ -413,12 +413,12 @@ In this step you restart the cache servers in parallel. Because the data is pers Process ID: 3402 Uptime: 1 minute 46 seconds <%=vars.product_name%> Version: <%=vars.product_version%> - Java Version: 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> + Java Version: <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Log File: /home/username/my_geode/server1/server1.log JVM Arguments: -Dgemfire.default.locators=192.0.2.0[10334] -Dgemfire.use-cluster-configuration=true -XX:OnOutOfMemoryError=kill -KILL %p -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806 - Class-Path: /home/username/Apache_Geode_Linux/lib/geode-core-1.0.0.jar: + Class-Path: /home/username/Apache_Geode_Linux/lib/geode-core-2.0.0.jar: /home/username/Apache_Geode_Linux/lib/geode-dependencies.jar ``` diff --git a/geode-docs/getting_started/installation/install_standalone.html.md.erb b/geode-docs/getting_started/installation/install_standalone.html.md.erb index a6a3fc435827..3c9e71618d35 100644 --- a/geode-docs/getting_started/installation/install_standalone.html.md.erb +++ b/geode-docs/getting_started/installation/install_standalone.html.md.erb @@ -24,7 +24,7 @@ Build from source or use the TAR distribution to install <%=vars.product_name_lo 1. Set the JAVA\_HOME environment variable. ``` pre - JAVA_HOME=/usr/java/jdk1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> + JAVA_HOME=/usr/java/jdk-<%=vars.min_java_version%>.0.<%=vars.min_java_update%> export JAVA_HOME ``` @@ -54,7 +54,7 @@ Build from source or use the TAR distribution to install <%=vars.product_name_lo 1. Set the JAVA\_HOME environment variable. For example: ``` pre - $ set JAVA_HOME="C:\Program Files\Java\jdk1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%>" + $ set JAVA_HOME="C:\Program Files\Java\jdk-<%=vars.min_java_version%>.0.<%=vars.min_java_update%>" ``` 2. Install Gradle, version 2.3 or a more recent version. @@ -91,14 +91,14 @@ Build from source or use the TAR distribution to install <%=vars.product_name_lo 3. Set the JAVA\_HOME environment variable. On Linux/Unix platforms: ``` pre - JAVA_HOME=/usr/java/jdk1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> + JAVA_HOME=/usr/java/jdk-<%=vars.min_java_version%>.0.<%=vars.min_java_update%> export JAVA_HOME ``` On Windows platforms: ``` pre - set JAVA_HOME="C:\Program Files\Java\jdk1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%>" + set JAVA_HOME="C:\Program Files\Java\jdk-<%=vars.min_java_version%>.0.<%=vars.min_java_update%>" ``` 4. Add the <%=vars.product_name%> scripts to your PATH environment variable. On Linux/Unix platforms: diff --git a/geode-docs/images/Apache_Tomcat_Homepage.png b/geode-docs/images/Apache_Tomcat_Homepage.png index bca071c9038b..4a7d14584e97 100644 Binary files a/geode-docs/images/Apache_Tomcat_Homepage.png and b/geode-docs/images/Apache_Tomcat_Homepage.png differ diff --git a/geode-docs/managing/management/jmx_manager_operations.html.md.erb b/geode-docs/managing/management/jmx_manager_operations.html.md.erb index da8ca6a99b9d..5d578819b130 100644 --- a/geode-docs/managing/management/jmx_manager_operations.html.md.erb +++ b/geode-docs/managing/management/jmx_manager_operations.html.md.erb @@ -57,7 +57,7 @@ is currently online. Process ID: 27144 Uptime: 5 seconds <%=vars.product_name%> Version: <%=vars.product_version%> -Java Version: 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> +Java Version: <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Log File: /Users/username/apache-geode/locator1/locator1.log JVM Arguments: -Dgemfire.enable-cluster-configuration=true -Dgemfire.load-cluster-configuration-from-dir=false diff --git a/geode-docs/tools_modules/gfsh/tour_of_gfsh.html.md.erb b/geode-docs/tools_modules/gfsh/tour_of_gfsh.html.md.erb index 5e9dd5b79b58..98983f5f61ce 100644 --- a/geode-docs/tools_modules/gfsh/tour_of_gfsh.html.md.erb +++ b/geode-docs/tools_modules/gfsh/tour_of_gfsh.html.md.erb @@ -61,7 +61,7 @@ as locator1 is currently online. Process ID: 67666 Uptime: 6 seconds <%=vars.product_name%> Version: <%=vars.product_version%> -Java Version: 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> +Java Version: <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Log File: /home/username/gfsh_tutorial/locator1.log JVM Arguments: -Dgemfire.enable-cluster-configuration=true -Dgemfire.load-cluster-configuration-from-dir=false @@ -180,16 +180,12 @@ Starting a <%=vars.product_name%> Server in /home/username/gfsh_tutorial/server1 ... Server in /home/username/gfsh_tutorial/server1 on 192.0.2.0[40404] as server1 is currently online. -Process ID: 68375 -Uptime: 4 seconds +Process ID: 49601 +Uptime: 2 seconds <%=vars.product_name%> Version: <%=vars.product_version%> -Java Version: 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> -Log File: /home/username//gfsh_tutorial/server1/server1.log -JVM Arguments: -Dgemfire.locators=localhost[10334] - -Dgemfire.use-cluster-configuration=true -Dgemfire.start-dev-rest-api=false - -XX:OnOutOfMemoryError=kill -KILL %p - -Dgemfire.launcher.registerSignalHandlers=true - -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806 +Java Version: <%=vars.min_java_version%>.0.<%=vars.min_java_update%> +Log File: /home/username/gfsh_tutorial/server1/server1.log +JVM Arguments: -Dgemfire.enable-cluster-configuration=true Class-Path: /home/username/geode/geode-assembly/build/install/apache-geode/lib /geode-core-1.2.0.jar:/home/username/geode/geode-assembly/build/install /apache-geode/lib/geode-dependencies.jar @@ -299,7 +295,7 @@ server2 is currently online. Process ID: 68423 Uptime: 4 seconds <%=vars.product_name%> Version: <%=vars.product_version%> -Java Version: 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> +Java Version: <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Log File: /home/username/gfsh_tutorial/server2/server2.log JVM Arguments: -Dgemfire.default.locators=192.0.2.0[10334] -Dgemfire.use-cluster-configuration=true -Dgemfire.start-dev-rest-api=false diff --git a/geode-docs/tools_modules/http_session_mgmt/chapter_overview.html.md.erb b/geode-docs/tools_modules/http_session_mgmt/chapter_overview.html.md.erb index 04c099ca1e52..d0513b459f61 100644 --- a/geode-docs/tools_modules/http_session_mgmt/chapter_overview.html.md.erb +++ b/geode-docs/tools_modules/http_session_mgmt/chapter_overview.html.md.erb @@ -21,7 +21,9 @@ limitations under the License. The <%=vars.product_name_long%> HTTP Session Management modules provide fast, scalable, and reliable session replication for HTTP servers without requiring application changes. -<%=vars.product_name_long%> offers HTTP session management modules for tc Server, Tomcat, and AppServers. +<%=vars.product_name_long%> offers HTTP session management modules for Tomcat and AppServers. + +**Note:** As of version 2.x, Geode only supports Tomcat 10.1 and later versions (Jakarta EE namespace). Support for Tomcat 7, 8, 9, and Pivotal tc Server has been discontinued. These modules are included with the <%=vars.product_name_long%> product distribution, and installation .zip files can be found in the `tools/Modules` directory of your product installation. @@ -49,13 +51,9 @@ These modules are included with the <%=vars.product_name_long%> product distribu This section describes the configuration of non-sticky sessions. -- **[HTTP Session Management Module for Pivotal tc Server](../../tools_modules/http_session_mgmt/session_mgmt_tcserver.html)** - - This section describes how to set up and use the HTTP session management module with tc Server templates. - - **[HTTP Session Management Module for Tomcat](../../tools_modules/http_session_mgmt/session_mgmt_tomcat.html)** - You set up and use the module by modifying the Tomcat's `server.xml` and `context.xml` files. + You set up and use the module by modifying Tomcat's `server.xml` and `context.xml` files. Supports Tomcat 10.1 and later (Jakarta EE). - **[HTTP Session Management Module for AppServers](../../tools_modules/http_session_mgmt/session_mgmt_weblogic.html)** diff --git a/geode-docs/tools_modules/http_session_mgmt/common_gemfire_topologies.html.md.erb b/geode-docs/tools_modules/http_session_mgmt/common_gemfire_topologies.html.md.erb index e0bf3a93eeff..ebc217db5286 100644 --- a/geode-docs/tools_modules/http_session_mgmt/common_gemfire_topologies.html.md.erb +++ b/geode-docs/tools_modules/http_session_mgmt/common_gemfire_topologies.html.md.erb @@ -33,4 +33,4 @@ In a peer-to-peer configuration, each instance within an application server cont -In a client/server configuration, the Tomcat or tc Server instance operates as a <%=vars.product_name%> client, which must communicate with one or more <%=vars.product_name%> servers to acquire session data. The client maintains its own local cache and will communicate with the server to satisfy cache misses. A client/server configuration is useful when you want to separate the application server instance from the cached session data. In this configuration, you can reduce the memory consumption of the application server since session data is stored in separate <%=vars.product_name%> server processes. +In a client/server configuration, the Tomcat instance operates as a <%=vars.product_name%> client, which must communicate with one or more <%=vars.product_name%> servers to acquire session data. The client maintains its own local cache and will communicate with the server to satisfy cache misses. A client/server configuration is useful when you want to separate the application server instance from the cached session data. In this configuration, you can reduce the memory consumption of the application server since session data is stored in separate <%=vars.product_name%> server processes. diff --git a/geode-docs/tools_modules/http_session_mgmt/quick_start.html.md.erb b/geode-docs/tools_modules/http_session_mgmt/quick_start.html.md.erb index fae1198d18f6..6d0b5bf3e1fe 100644 --- a/geode-docs/tools_modules/http_session_mgmt/quick_start.html.md.erb +++ b/geode-docs/tools_modules/http_session_mgmt/quick_start.html.md.erb @@ -22,10 +22,10 @@ limitations under the License. In this section you download, install, and set up the HTTP Session Management modules. Following the Apache Tomcat convention, this page assumes the CATALINA_HOME environment variable is set to the root directory of the "binary" Tomcat distribution. -For example, if Apache Tomcat is installed in `/usr/bin/apache-tomcat-9.0.62` then +For example, if Apache Tomcat is installed in `/opt/apache-tomcat-10.1.30` then ``` -CATALINA_HOME=/usr/bin/apache-tomcat-9.0.62 +CATALINA_HOME=/opt/apache-tomcat-10.1.30 ``` ## Quick Start Instructions @@ -34,61 +34,46 @@ CATALINA_HOME=/usr/bin/apache-tomcat-9.0.62 | Supported Application Server | Version | Download Location | |------------------------------|---------|-------------------------| - | tc Server | 3.2 | [https://network.pivotal.io/products/pivotal-tcserver](https://network.pivotal.io/products/pivotal-tcserver) | - | Tomcat | 8.5 | [Tomcat 8 Software Downloads](https://tomcat.apache.org/download-80.cgi) | - | Tomcat | 9.0 | [Tomcat 9 Software Downloads](https://tomcat.apache.org/download-90.cgi) | + | Tomcat | 10.1+ | [Tomcat 10 Software Downloads](https://tomcat.apache.org/download-10.cgi) | + | Tomcat | 11.x | [Tomcat 11 Software Downloads](https://tomcat.apache.org/download-11.cgi) | - The generic HTTP Session Management Module for AppServers is implemented as a servlet filter and should work on any application server platform that supports the Java Servlet 3.1 specification. + **Note:** Support for Tomcat 7, 8, 9, and Pivotal tc Server has been discontinued. Tomcat 10.1+ requires Jakarta EE (jakarta.servlet.* namespace). + + The generic HTTP Session Management Module for AppServers is implemented as a servlet filter and should work on any application server platform that supports the Java Servlet 6.0 specification (Jakarta EE). 2. The HTTP Session Management Modules installation .zip files are located in the `tools/Modules` directory of the product installation directory. Locate the .zip file for the HTTP Session Management Module that you wish to install. Unzip the appropriate HTTP Session Management Module into the specified directory for your application server: | Supported Application Server | Version | Module | Target Location for Module | |------------------------------|----------|------------------------------------------------------|----------------------------------| - | tc Server | 2.9 | Apache_Geode_Modules-SERVER-VERSION-tcServer.zip | `/templates` | - | tc Server | 3.2 | Apache_Geode_Modules-SERVER-VERSION-tcServer30.zip | `/templates` | - | Tomcat | 8.5, 9.0 | Apache_Geode_Modules-SERVER-VERSION-Tomcat.zip | `$CATALINA_HOME` | + | Tomcat | 10.1, 11 | Apache_Geode_Modules-SERVER-VERSION-Tomcat.zip | `$CATALINA_HOME` | + + **Note:** Support for Pivotal tc Server has been removed. Users should migrate to Tomcat 10.1 or later. 3. Complete the appropriate set up instructions for your application server described in the following sections: - - [Additional Quick Start Instructions for tc Server Module](quick_start.html#quick_start__section_EE60463F524A46B7B83CE74C1C3E8E0E) - [Additional Quick Start Instructions for Tomcat Module](quick_start.html#quick_start__section_4689A4FA609A4F4FB091F03E9BECA4DB) - [Additional Instructions for AppServers Module](quick_start.html#quick_start__section_1587C3E55F06406EBD4AB13014A406D4) -## Additional Quick Start Instructions for tc Server Module - -These steps provide a basic starting point for using the tc Server module. For more configuration options, see [HTTP Session Management Module for Pivotal tc Server](session_mgmt_tcserver.html). As a prerequisite, module set up requires a JAVA\_HOME environment variable set to the java installation. - -1. Navigate to the root directory of tc Server. -2. Create a <%=vars.product_name%> instance using one of the provided templates and start the instance after starting up a locator. For example: - - ``` pre - $ gfsh start locator --name=locator1 - $ ./tcruntime-instance.sh create my_instance_name --template geode-p2p - $ ./tcruntime-ctl.sh my_instance_name start - ``` - - This will create and run a <%=vars.product_name%> instance using the peer-to-peer topology and default configuration values. Another <%=vars.product_name%> instance on another system can be created and started in the same way. - - If you need to pin your tc Server instance to a specific tc Server runtime version, use the `--version` option when creating the instance. - ## Additional Quick Start Instructions for Tomcat Module These steps provide a basic starting point for using the Tomcat module. For more configuration options, see [HTTP Session Management Module for Tomcat](session_mgmt_tomcat.html). -1. Modify Tomcat's `server.xml` and `context.xml` files. Configuration is slightly different depending on the topology you are setting up and the version of Tomcat you are using. +1. Modify Tomcat's `server.xml` and `context.xml` files. Configuration is slightly different depending on the topology you are setting up. - For example, in a peer-to-peer configuration using Tomcat 9, you would add the following entry within the `` element of server.xml: + For example, in a peer-to-peer configuration using Tomcat 10.1+, you would add the following entry within the `` element of server.xml: ``` pre + locators="localhost[10334]" /> ``` and the following entry within the `` tag in the context.xml file: ``` pre - + ``` + **Note:** For Tomcat 10.1+, use `Tomcat10DeltaSessionManager`. Support for Tomcat 7, 8, and 9 has been discontinued. + See [Setting Up the HTTP Module for Tomcat](tomcat_setting_up_the_module.html) for additional instructions. 2. Start the Tomcat application server. diff --git a/geode-docs/tools_modules/http_session_mgmt/session_mgmt_tcserver.html.md.erb b/geode-docs/tools_modules/http_session_mgmt/session_mgmt_tcserver.html.md.erb index 8af8a039afd7..f9d01d4e9e98 100644 --- a/geode-docs/tools_modules/http_session_mgmt/session_mgmt_tcserver.html.md.erb +++ b/geode-docs/tools_modules/http_session_mgmt/session_mgmt_tcserver.html.md.erb @@ -1,5 +1,5 @@ --- -title: HTTP Session Management Module for Pivotal tc Server +title: DEPRECATED - Pivotal tc Server Support Removed --- -You set up and use the module by modifying the Tomcat's `server.xml` and `context.xml` files. +You set up and use the module by modifying Tomcat's `server.xml` and `context.xml` files. -For instructions specific to SpringSource tc Server templates, refer to [HTTP Session Management Module for Pivotal tc Server](session_mgmt_tcserver.html). +**Note:** Geode only supports Tomcat 10.1 and later versions (Jakarta EE). Support for Tomcat 7, 8, 9, and Pivotal tc Server has been discontinued. For tc Server users, migration to Tomcat 10.1 or later is required. - **[Installing the HTTP Module for Tomcat](../../tools_modules/http_session_mgmt/tomcat_installing_the_module.html)** diff --git a/geode-docs/tools_modules/http_session_mgmt/session_mgmt_weblogic.html.md.erb b/geode-docs/tools_modules/http_session_mgmt/session_mgmt_weblogic.html.md.erb index 0ef18684ba71..a8bc272a2703 100644 --- a/geode-docs/tools_modules/http_session_mgmt/session_mgmt_weblogic.html.md.erb +++ b/geode-docs/tools_modules/http_session_mgmt/session_mgmt_weblogic.html.md.erb @@ -21,7 +21,7 @@ limitations under the License. You implement session caching with the HTTP Session Management Module for AppServers with a special filter, defined in the `web.xml`, which is configured to intercept and wrap all requests. -You can use this HTTP module with a variety of application servers. Wrapping each request allows the interception of `getSession()` calls to be handled by <%=vars.product_name%> instead of the native container. This approach is a generic solution, which is supported by any container that implements the Servlet 3.1 specification. +You can use this HTTP module with a variety of application servers. Wrapping each request allows the interception of `getSession()` calls to be handled by <%=vars.product_name%> instead of the native container. This approach is a generic solution, which is supported by any container that implements the Jakarta Servlet 6.0 specification (Jakarta EE 10). - **[Setting Up the HTTP Module for AppServers](../../tools_modules/http_session_mgmt/weblogic_setting_up_the_module.html)** diff --git a/geode-docs/tools_modules/http_session_mgmt/tc_additional_info.html.md.erb b/geode-docs/tools_modules/http_session_mgmt/tc_additional_info.html.md.erb index 43bf40357732..47cf2ce74c86 100644 --- a/geode-docs/tools_modules/http_session_mgmt/tc_additional_info.html.md.erb +++ b/geode-docs/tools_modules/http_session_mgmt/tc_additional_info.html.md.erb @@ -45,7 +45,7 @@ To acquire <%=vars.product_name%> module version information, look in the web se ``` pre INFO: Initializing <%=vars.product_name%> Modules Java version: 1.0.0 user1 041216 2016-11-12 11:18:37 -0700 - javac 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> + javac <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Native version: native code unavailable Source revision: 857bb75916640a066eb832b43b3c805f0dd7ed0b Source repository: develop diff --git a/geode-docs/tools_modules/http_session_mgmt/tc_setting_up_the_module.html.md.erb b/geode-docs/tools_modules/http_session_mgmt/tc_setting_up_the_module.html.md.erb index 68802881d350..4757397cad29 100644 --- a/geode-docs/tools_modules/http_session_mgmt/tc_setting_up_the_module.html.md.erb +++ b/geode-docs/tools_modules/http_session_mgmt/tc_setting_up_the_module.html.md.erb @@ -71,8 +71,8 @@ With a similar environment to this example that is for a client/server set up, ``` pre TC_VER=tomcat-8.0.30.C.RELEASE INSTANCE=geode-cs -CLASSPATH=$PWD/$INSTANCE/lib/geode-modules-1.0.0.jar:\ -$PWD/$INSTANCE/lib/geode-modules-tomcat8-1.0.0.jar:\ +CLASSPATH=$PWD/$INSTANCE/lib/geode-modules-2.0.0.jar:\ +$PWD/$INSTANCE/lib/geode-modules-tomcat8-2.0.0.jar:\ $PWD/$TC_VER/lib/servlet-api.jar:\ $PWD/$TC_VER/lib/catalina.jar:\ $PWD/$TC_VER/lib/tomcat-util.jar:\ @@ -111,7 +111,7 @@ lifecycleEvent INFO: Initializing <%=vars.product_name%> Modules Modules version: 1.0.0 Java version: 1.0.0 user1 032916 2016-11-29 07:49:26 -0700 -javac 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> +javac <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Native version: native code unavailable Source revision: c36591b73243c7ee3a0186710338453d12efe364 Source repository: develop diff --git a/geode-docs/tools_modules/http_session_mgmt/tomcat_changing_gf_default_cfg.html.md.erb b/geode-docs/tools_modules/http_session_mgmt/tomcat_changing_gf_default_cfg.html.md.erb index 418671d82894..633e4f335b96 100644 --- a/geode-docs/tools_modules/http_session_mgmt/tomcat_changing_gf_default_cfg.html.md.erb +++ b/geode-docs/tools_modules/http_session_mgmt/tomcat_changing_gf_default_cfg.html.md.erb @@ -82,7 +82,7 @@ To edit <%=vars.product_name%> cache properties such as the name and the charact ``` pre ``` +**Note:** For Tomcat 10.1 and later, use `Tomcat10DeltaSessionManager`. Support for Tomcat 7, 8, and 9 has been discontinued. + The following parameters are the cache configuration parameters that can be added to Tomcat's `context.xml` file.
      **CommitSessionValve**
      diff --git a/geode-docs/tools_modules/http_session_mgmt/tomcat_installing_the_module.html.md.erb b/geode-docs/tools_modules/http_session_mgmt/tomcat_installing_the_module.html.md.erb index 9590dff4ba5d..79ef6bcea6b6 100644 --- a/geode-docs/tools_modules/http_session_mgmt/tomcat_installing_the_module.html.md.erb +++ b/geode-docs/tools_modules/http_session_mgmt/tomcat_installing_the_module.html.md.erb @@ -21,12 +21,12 @@ limitations under the License. This topic describes how to install the HTTP session management module for Tomcat. -1. If you have not already installed Tomcat, download the desired version from the [Apache Website](http://tomcat.apache.org/) and install it. +1. If you have not already installed Tomcat, download version 10.1 or later from the [Apache Website](http://tomcat.apache.org/) and install it. **Note:** Geode only supports Tomcat 10.1 and later versions (Jakarta EE). Support for Tomcat 7, 8, and 9 has been discontinued. 2. Following the Apache Tomcat convention, this page assumes the CATALINA_HOME environment variable is set to the root directory of the "binary" Tomcat distribution. - For example, if Apache Tomcat is installed in `/usr/bin/apache-tomcat-9.0.62` then + For example, if Apache Tomcat is installed in `/opt/apache-tomcat-10.1.30` then ``` - CATALINA_HOME=/usr/bin/apache-tomcat-9.0.62 + CATALINA_HOME=/opt/apache-tomcat-10.1.30 ``` Define $CATALINA_HOME if it is not already defined. @@ -48,12 +48,15 @@ This adds jar files to the `lib` subdirectory and XML files to the `conf` subdir unzip $GEODE_HOME/tools/Modules/Apache_Geode_Modules-SERVER-VERSION-Tomcat.zip ``` - -6. Copy all of the jar files from the <%=vars.product_name%> `lib` subdirectory to the `lib` subdirectory of your Tomcat server (`$CATALINA_HOME/lib`): +6. **CRITICAL:** Copy all of the jar files from the <%=vars.product_name%> `lib` subdirectory to the `lib` subdirectory of your Tomcat server (`$CATALINA_HOME/lib`). + + **The module zip file alone does not contain all required dependencies.** You must copy all Geode libraries including `geode-core`, `geode-common`, Jakarta Transaction API, and other runtime dependencies: ``` cd $CATALINA_HOME/lib cp $GEODE_HOME/lib/*.jar . ``` + + **Note:** Without these libraries, Tomcat will fail to start with `ClassNotFoundException` errors for Geode classes. The Geode session management module requires the complete Geode runtime, not just the module JARs included in the zip file. Proceed to [Setting Up the HTTP Module for Tomcat](./tomcat_setting_up_the_module.html) to complete your Tomcat configuration. diff --git a/geode-docs/tools_modules/http_session_mgmt/tomcat_setting_up_the_module.html.md.erb b/geode-docs/tools_modules/http_session_mgmt/tomcat_setting_up_the_module.html.md.erb index 1698795c3edb..0524c37c7514 100644 --- a/geode-docs/tools_modules/http_session_mgmt/tomcat_setting_up_the_module.html.md.erb +++ b/geode-docs/tools_modules/http_session_mgmt/tomcat_setting_up_the_module.html.md.erb @@ -27,32 +27,37 @@ Configuration is slightly different depending on the topology you are setting up -To run <%=vars.product_name%> in a peer-to-peer configuration, add the following line to Tomcat's `$CATALINA_HOME$/conf/server.xml` within the `` tag: +To run <%=vars.product_name%> in a peer-to-peer configuration, you must first start a <%=vars.product_name%> locator, then configure Tomcat to join the cluster as a peer member. + +### Starting the Locator + +Start a <%=vars.product_name%> locator using `gfsh`: ``` pre - +$ gfsh start locator --name=locator1 --port=10334 ``` -Depending on the version of Tomcat you are using, add one of the following lines to `$CATALINA_HOME$/conf/context.xml` within the `` tag: +The locator coordinates membership in the peer-to-peer cache. -For Tomcat 7.0: +### Configuring Tomcat -``` pre - -``` -For Tomcat 8.0 and 8.5: +Add the following line to Tomcat's `$CATALINA_HOME$/conf/server.xml` within the `` tag: ``` pre - + ``` -For Tomcat 9.0: +Add the following line to `$CATALINA_HOME$/conf/context.xml` within the `` tag: + +For Tomcat 10.1 and later (Jakarta EE 10): ``` pre - + ``` +**Note:** Tomcat 10.1+ implements Jakarta EE 10 with Servlet 6.0 specification and uses the Jakarta EE namespace (`jakarta.servlet.*`) instead of the legacy `javax.servlet.*` namespace. Ensure your application has been migrated to Jakarta EE 10 before using this module. Support for Tomcat 7, 8, and 9 has been discontinued. + ## Client/Server Setup @@ -63,41 +68,37 @@ To run <%=vars.product_name%> in a client/server configuration, the application ``` -Depending on the version of Tomcat you are using, add one of the following lines to `$CATALINA_HOME$/conf/context.xml` within the `` tag: +Add the following line to `$CATALINA_HOME$/conf/context.xml` within the `` tag: -For Tomcat 7.0: +For Tomcat 10.1 and later (Jakarta EE 10): ``` pre - + ``` -For Tomcat 8.0 and 8.5: +**Note:** Tomcat 10.1+ implements Jakarta EE 10 with Servlet 6.0 specification and uses the Jakarta EE namespace (`jakarta.servlet.*`) instead of the legacy `javax.servlet.*` namespace. Ensure your application has been migrated to Jakarta EE 10 before using this module. Support for Tomcat 7, 8, and 9 has been discontinued. -``` pre - -``` +The application server operates as a <%=vars.product_name%> client in this configuration. -For Tomcat 9.0: +### Setting the CLASSPATH + +Set the CLASSPATH environment variable to include Tomcat and <%=vars.product_name%> module libraries. This CLASSPATH is required when starting the locator and server. + +For a client/server setup using Apache Tomcat v10.1+ and Geode v2.x, the CLASSPATH should include: ``` pre - +export CLASSPATH=$CATALINA_HOME/lib/servlet-api.jar:$CATALINA_HOME/lib/catalina.jar:$CATALINA_HOME/bin/tomcat-juli.jar:$GEODE_HOME/lib/geode-modules-2.x.x.jar:$GEODE_HOME/lib/geode-modules-tomcat10-2.x.x.jar ``` -The application server operates as a <%=vars.product_name%> client in this configuration. - -Set the CLASSPATH environment variable. For a client/server set up using Apache Tomcat v9 and Geode v1.13, -the CLASSPATH setting should be similar to the following. Adjust filenames and version numbers as needed for your implementation. +Example with explicit paths: ``` pre -CLASSPATH="$CATALINA_HOME/lib/geode-modules-1.13.3.jar:\ -$CATALINA_HOME/lib/geode-modules-tomcat9-1.13.3.jar:\ -$CATALINA_HOME/lib/servlet-api.jar:\ -$CATALINA_HOME/lib/catalina.jar:\ -$CATALINA_HOME/lib/tomcat-util.jar:\ -$CATALINA_HOME/bin/tomcat-juli.jar" +CLASSPATH=/opt/apache-tomcat-10.1.x/lib/servlet-api.jar:/opt/apache-tomcat-10.1.x/lib/catalina.jar:/opt/apache-tomcat-10.1.x/bin/tomcat-juli.jar:/opt/geode-2.x/lib/geode-modules-2.x.x.jar:/opt/geode-2.x/lib/geode-modules-tomcat10-2.x.x.jar ``` -Start the locator and server using `gfsh`: +### Starting the Locator and Server + +Start the locator and server using `gfsh` with the configured CLASSPATH: ``` pre $ gfsh start locator --name=locator1 --classpath=$CLASSPATH @@ -107,7 +108,7 @@ $ gfsh start server --name=server1 --locators=localhost[10334] --server-port=0 \ ## Starting the Application Server -Once you've updated the configuration, you are now ready to start your tc Server or Tomcat instance. Refer to your application server documentation for starting the application server. Once started, <%=vars.product_name%> will automatically launch within the application server process. +Once you've updated the XML configuration files, you are now ready to start your Tomcat instance. Refer to your application server documentation for starting the application server. Once started, <%=vars.product_name%> will automatically launch within the application server process. **Note:** <%=vars.product_name%> session state management provides its own clustering functionality. If you are using <%=vars.product_name%>, you should NOT turn on Tomcat clustering as well. @@ -117,8 +118,65 @@ Once you've updated the configuration, you are now ready to start your tc Server You can verify that <%=vars.product_name%> has successfully started by inspecting the Tomcat log file. For example: ``` pre -15-Jul-2021 10:25:11.483 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/Users/user/workspace/apache-tomcat-9.0.62/webapps/host-manager] has finished in [1,688] ms -15-Jul-2021 10:25:11.486 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] -15-Jul-2021 10:25:11.493 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [11682] milliseconds +15-Jul-2025 10:25:11.483 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/Users/user/workspace/apache-tomcat-10.1.x/webapps/host-manager] has finished in [1,688] ms +15-Jul-2025 10:25:11.486 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] +15-Jul-2025 10:25:11.493 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [11682] milliseconds +``` + +### Verifying Cluster Topology + +You can verify the cluster configuration by using `gfsh` to list cluster members. + +**For Peer-to-Peer Configuration:** + +``` pre +$ gfsh -e "connect --locator=localhost[10334]" -e "list members" +``` + +You should see two members: the locator and the Tomcat server. The Tomcat server appears as a full member of the <%=vars.product_name%> distributed system. + +``` pre +Member Count : 2 + + Name | Id +----------- | ------------------------------------- +locator1 | 192.168.1.100(locator1:12345:locator) +TomcatNode | 192.168.1.100(67890) +``` + +**For Client/Server Configuration:** + +``` pre +$ gfsh -e "connect --locator=localhost[10334]" -e "list members" +``` + +You should see two members: the locator and the cache server. The Tomcat server does NOT appear in the member list because it operates as a lightweight client. + +``` pre +Member Count : 2 + + Name | Id +----------- | ------------------------------------- +locator1 | 192.168.1.100(locator1:12345:locator) +server1 | 192.168.1.100(server1:67890) ``` +## Troubleshooting + +**Problem:** Tomcat logs show `ClassNotFoundException: org.apache.geode.modules.util.BootstrappingFunction` (client/server only) + +**Solution:** Ensure you started the locator and server with the `--classpath` option as shown in the client/server configuration. The <%=vars.product_name%> server must have access to the session module classes. + +--- + +**Problem:** Tomcat fails with "Connection refused" when connecting to locator (peer-to-peer only) + +**Solution:** Ensure the <%=vars.product_name%> locator is running before starting Tomcat. Use `gfsh list members` or `lsof -i :10334` to verify the locator is listening on the configured port. + +--- + +**Problem:** Web applications fail to deploy with session manager errors + +**Solution:** Check that you completed all installation steps, including copying all JAR files from `$GEODE_HOME/lib` to `$CATALINA_HOME/lib` as described in [Installing the HTTP Module for Tomcat](./tomcat_installing_the_module.html). + + diff --git a/geode-docs/tools_modules/http_session_mgmt/weblogic_setting_up_the_module.html.md.erb b/geode-docs/tools_modules/http_session_mgmt/weblogic_setting_up_the_module.html.md.erb index 084db231743b..237ce158d361 100644 --- a/geode-docs/tools_modules/http_session_mgmt/weblogic_setting_up_the_module.html.md.erb +++ b/geode-docs/tools_modules/http_session_mgmt/weblogic_setting_up_the_module.html.md.erb @@ -73,7 +73,7 @@ To modify your war or ear file manually, make the following updates: - geode-serialization jar - geode-membership jar - geode-tcp-server jar - - javax.transaction-api jar + - jakarta.transaction-api jar - jgroups jar - log4j-api jar - log4j-core jar @@ -89,28 +89,28 @@ If you are deploying an ear file: ``` pre Manifest-Version: 1.0 Built-By: joe - Build-Jdk: 1.8.0_77 + Build-Jdk: 17.0.16 Created-By: Apache Maven Archiver-Version: Plexus Archiver - Class-Path: lib/geode-modules-1.0.0.jar - lib/geode-modules-session-internal-1.0.0.jar - lib/geode-modules-session-1.0.0.jar - lib/slf4j-api-1.7.7.jar - lib/slf4j-jdk14-1.7.7.jar + Class-Path: lib/geode-modules-2.0.0.jar + lib/geode-modules-session-internal-2.0.0.jar + lib/geode-modules-session-2.0.0.jar + lib/slf4j-api-2.0.17.jar + lib/slf4j-jdk14-2.0.17.jar lib/antlr-2.7.7.jar - lib/geode-membership.1.0.0.jar - lib/geode-tcp.1.0.0.jar - lib/fastutil-7.0.2.jar - lib/geode-core-1.0.0.jar - lib/geode-common.1.0.0.jar - lib/geode-management.1.0.0.jar - lib/geode-logging.1.0.0.jar - lib/geode-serialization.1.0.0.jar - lib/javax.transaction-api-1.3.jar - lib/jgroups-3.6.8.Final.jar - lib/log4j-api-2.5.jar - lib/log4j-core-2.5.jar - lib/log4j-jul-2.5.jar + lib/geode-membership-2.0.0.jar + lib/geode-tcp-server-2.0.0.jar + lib/fastutil-8.5.8.jar + lib/geode-core-2.0.0.jar + lib/geode-common-2.0.0.jar + lib/geode-management-2.0.0.jar + lib/geode-logging-2.0.0.jar + lib/geode-serialization-2.0.0.jar + lib/jakarta.transaction-api-2.0.1.jar + lib/jgroups-3.6.20.Final.jar + lib/log4j-api-2.17.2.jar + lib/log4j-core-2.17.2.jar + lib/log4j-jul-2.17.2.jar ``` ## Peer-to-Peer Setup @@ -182,8 +182,8 @@ $ gfsh start server \ --name=server1 \ --server-port=0 \ --locators=localhost[10334] \ - --classpath=/lib/geode-modules-1.0.0.jar:\ -/lib/geode-modules-session-internal-1.0.0.jar + --classpath=/lib/geode-modules-2.0.0.jar:\ +/lib/geode-modules-session-internal-2.0.0.jar ``` Once the application server is started, the <%=vars.product_name%> client will automatically launch within the application server process. @@ -193,10 +193,10 @@ Once the application server is started, the <%=vars.product_name%> client will a You can verify that <%=vars.product_name%> has successfully started by inspecting the application server log file. For example: ``` pre -info 2016/04/18 10:04:18.685 PDT tid=0x1a] +info 2025/04/18 10:04:18.685 PDT tid=0x1a] Initializing <%=vars.product_name%> Modules -Java version: 1.0.0 user1 041816 2016-11-18 08:46:17 -0700 -javac 1.<%=vars.min_java_version%>.0_<%=vars.min_java_update%> +Java version: 2.0.0 user1 041816 2025-11-18 08:46:17 -0700 +javac <%=vars.min_java_version%>.0.<%=vars.min_java_update%> Native version: native code unavailable Source revision: 19dd8eb1907e0beb2aa3e0a17d5f12c6cbec6968 Source repository: develop diff --git a/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/MemberJvmOptions.java b/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/MemberJvmOptions.java index dbfc1ee40043..fd9116cedeff 100644 --- a/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/MemberJvmOptions.java +++ b/geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/MemberJvmOptions.java @@ -28,17 +28,10 @@ import org.apache.geode.distributed.internal.deadlock.UnsafeThreadLocal; import org.apache.geode.internal.offheap.AddressableMemoryManager; -import org.apache.geode.internal.stats50.VMStats50; import org.apache.geode.unsafe.internal.com.sun.jmx.remote.security.MBeanServerAccessController; -import org.apache.geode.unsafe.internal.sun.nio.ch.DirectBuffer; public class MemberJvmOptions { static final int CMS_INITIAL_OCCUPANCY_FRACTION = 60; - /** - * export needed by {@link DirectBuffer} - */ - private static final String SUN_NIO_CH_EXPORT = - "--add-exports=java.base/sun.nio.ch=ALL-UNNAMED"; /** * export needed by {@link MBeanServerAccessController} */ @@ -52,16 +45,9 @@ public class MemberJvmOptions { * open needed by {@link AddressableMemoryManager} */ private static final String JAVA_NIO_OPEN = "--add-opens=java.base/java.nio=ALL-UNNAMED"; - /** - * open needed by {@link VMStats50} - */ - private static final String COM_SUN_MANAGEMENT_INTERNAL_OPEN = - "--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED"; static final List JAVA_11_OPTIONS = Arrays.asList( COM_SUN_JMX_REMOTE_SECURITY_EXPORT, - SUN_NIO_CH_EXPORT, - COM_SUN_MANAGEMENT_INTERNAL_OPEN, JAVA_LANG_OPEN, JAVA_NIO_OPEN); diff --git a/geode-server-all/src/integrationTest/resources/dependency_classpath.txt b/geode-server-all/src/integrationTest/resources/dependency_classpath.txt index 0ce95af717d5..2e0a90e7e50b 100644 --- a/geode-server-all/src/integrationTest/resources/dependency_classpath.txt +++ b/geode-server-all/src/integrationTest/resources/dependency_classpath.txt @@ -62,7 +62,7 @@ classgraph-4.8.147.jar spring-aop-6.1.14.jar angus-activation-2.0.0.jar jakarta.activation-api-2.1.3.jar -istack-commons-runtime-4.0.1.jar +istack-commons-runtime-4.1.1.jar spring-web-6.1.14.jar spring-shell-table-3.3.3.jar spring-boot-starter-validation-3.3.5.jar diff --git a/geode-unsafe/src/main/java/org/apache/geode/unsafe/internal/sun/misc/Unsafe.java b/geode-unsafe/src/main/java/org/apache/geode/unsafe/internal/sun/misc/Unsafe.java index 3c5db9e96df1..96e028205521 100644 --- a/geode-unsafe/src/main/java/org/apache/geode/unsafe/internal/sun/misc/Unsafe.java +++ b/geode-unsafe/src/main/java/org/apache/geode/unsafe/internal/sun/misc/Unsafe.java @@ -26,6 +26,33 @@ public class Unsafe { private final sun.misc.Unsafe unsafe; + + // Cached field offsets for ByteBuffer access + // These are computed once and reused to avoid repeated reflection + private static final long BUFFER_ADDRESS_FIELD_OFFSET; + private static final long BUFFER_CAPACITY_FIELD_OFFSET; + + static { + long addressOffset = -1; + long capacityOffset = -1; + try { + Field unsafeField = sun.misc.Unsafe.class.getDeclaredField("theUnsafe"); + unsafeField.setAccessible(true); + sun.misc.Unsafe unsafeInstance = (sun.misc.Unsafe) unsafeField.get(null); + + // Get field offsets for Buffer fields + Field addressField = java.nio.Buffer.class.getDeclaredField("address"); + addressOffset = unsafeInstance.objectFieldOffset(addressField); + + Field capacityField = java.nio.Buffer.class.getDeclaredField("capacity"); + capacityOffset = unsafeInstance.objectFieldOffset(capacityField); + } catch (Exception e) { + // If initialization fails, offsets remain -1 + } + BUFFER_ADDRESS_FIELD_OFFSET = addressOffset; + BUFFER_CAPACITY_FIELD_OFFSET = capacityOffset; + } + { sun.misc.Unsafe tmp; try { @@ -210,4 +237,59 @@ public boolean compareAndSwapObject(Object o, long offset, Object expected, Obje public void putOrderedObject(Object o, long offset, Object x) { unsafe.putOrderedObject(o, offset, x); } + + /** + * Gets the native memory address from a DirectByteBuffer using field offset. + * This method accesses the 'address' field of java.nio.Buffer directly via Unsafe, + * which does not require --add-opens flags (unlike method reflection with setAccessible()). + * + * @param buffer the DirectByteBuffer to get the address from + * @return the native memory address + */ + public long getBufferAddress(Object buffer) { + if (BUFFER_ADDRESS_FIELD_OFFSET == -1) { + throw new RuntimeException("Buffer address field offset not initialized"); + } + return unsafe.getLong(buffer, BUFFER_ADDRESS_FIELD_OFFSET); + } + + /** + * Sets the native memory address for a ByteBuffer using field offset. + * This allows wrapping an arbitrary memory address as a ByteBuffer. + * + * @param buffer the ByteBuffer to set the address for + * @param address the native memory address + */ + public void setBufferAddress(Object buffer, long address) { + if (BUFFER_ADDRESS_FIELD_OFFSET == -1) { + throw new RuntimeException("Buffer address field offset not initialized"); + } + unsafe.putLong(buffer, BUFFER_ADDRESS_FIELD_OFFSET, address); + } + + /** + * Gets the capacity from a ByteBuffer using field offset. + * + * @param buffer the ByteBuffer to get the capacity from + * @return the buffer capacity + */ + public int getBufferCapacity(Object buffer) { + if (BUFFER_CAPACITY_FIELD_OFFSET == -1) { + throw new RuntimeException("Buffer capacity field offset not initialized"); + } + return unsafe.getInt(buffer, BUFFER_CAPACITY_FIELD_OFFSET); + } + + /** + * Sets the capacity for a ByteBuffer using field offset. + * + * @param buffer the ByteBuffer to set the capacity for + * @param capacity the capacity value + */ + public void setBufferCapacity(Object buffer, int capacity) { + if (BUFFER_CAPACITY_FIELD_OFFSET == -1) { + throw new RuntimeException("Buffer capacity field offset not initialized"); + } + unsafe.putInt(buffer, BUFFER_CAPACITY_FIELD_OFFSET, capacity); + } } diff --git a/geode-unsafe/src/main/java/org/apache/geode/unsafe/internal/sun/nio/ch/DirectBuffer.java b/geode-unsafe/src/main/java/org/apache/geode/unsafe/internal/sun/nio/ch/DirectBuffer.java deleted file mode 100644 index dc894cfea212..000000000000 --- a/geode-unsafe/src/main/java/org/apache/geode/unsafe/internal/sun/nio/ch/DirectBuffer.java +++ /dev/null @@ -1,36 +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. - */ - -package org.apache.geode.unsafe.internal.sun.nio.ch; - -/** - * Provides access to methods on non-SDK class {@link sun.nio.ch.DirectBuffer}. - */ -public interface DirectBuffer { - - /** - * @see sun.nio.ch.DirectBuffer#attachment() - * @param object to get attachment for - * @return returns attachment if object is {@link sun.nio.ch.DirectBuffer} otherwise null. - */ - static Object attachment(final Object object) { - if (object instanceof sun.nio.ch.DirectBuffer) { - return ((sun.nio.ch.DirectBuffer) object).attachment(); - } - - return null; - } - -} diff --git a/geode-unsafe/src/test/java/org/apache/geode/unsafe/internal/sun/nio/ch/DirectBufferTest.java b/geode-unsafe/src/test/java/org/apache/geode/unsafe/internal/sun/nio/ch/DirectBufferTest.java deleted file mode 100644 index 6d2f52b1c339..000000000000 --- a/geode-unsafe/src/test/java/org/apache/geode/unsafe/internal/sun/nio/ch/DirectBufferTest.java +++ /dev/null @@ -1,53 +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. - */ - - -package org.apache.geode.unsafe.internal.sun.nio.ch; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; - -import java.nio.ByteBuffer; - -import org.junit.jupiter.api.MethodOrderer; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestMethodOrder; -import org.junit.jupiter.api.parallel.Execution; - -@Execution(CONCURRENT) -@TestMethodOrder(MethodOrderer.Random.class) -public class DirectBufferTest { - - @Test - public void attachmentIsNullForNonDirectBuffer() { - assertThat(DirectBuffer.attachment(null)).isNull(); - assertThat(DirectBuffer.attachment(new Object())).isNull(); - assertThat(DirectBuffer.attachment(ByteBuffer.allocate(1))).isNull(); - } - - @Test - public void attachmentIsNullForUnslicedDirectBuffer() { - assertThat(DirectBuffer.attachment(ByteBuffer.allocateDirect(1))).isNull(); - } - - @Test - public void attachmentIsRootBufferForDirectBufferSlice() { - final ByteBuffer root = ByteBuffer.allocateDirect(10); - final ByteBuffer slice = root.slice(); - - assertThat(DirectBuffer.attachment(slice)).isSameAs(root); - } - -} diff --git a/gradle.properties b/gradle.properties index 72695f0437e1..6bfc6b19a27c 100755 --- a/gradle.properties +++ b/gradle.properties @@ -26,7 +26,7 @@ # - release # # The full version string consists of 'versionNumber + releaseQualifier + releaseType' -version = 1.16.0-build.0 +version = 2.0.0-build.0 # Default Maven targets mavenSnapshotUrl = gcs://maven.apachegeode-ci.info/snapshots