Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix how reverse proxy ports are stored. #72

Draft
wants to merge 32 commits into
base: xdmod11.0
Choose a base branch
from

Conversation

aaronweeden
Copy link

@aaronweeden aaronweeden commented Nov 14, 2024

WORK IN PROGRESS

Description

Currently, the page_impressions.reverse_proxy_port_id column is only smallint(5) unsigned, but the reverse_proxy_port.id column is int(11). This means if reverse_proxy_port.id is > 65535 (the maximum value of smallint(5) unsigned), then it will be mistakenly mapped as 65535 in page_impressions.reverse_proxy_port_id.

This PR fixes this by adding a 11.0.0 -> 11.0.1 migration that will create a new column page_impressions.reverse_proxy_port, fill it with the corresponding value of reverse_proxy_port.port if page_impressions.reverse_proxy_port_id < 65535 (otherwise 0), drop the column page_impressions.reverse_proxy_port_id, drop the table reverse_proxy_port, and update the unique index on the page_impressions table.

This PR also adds instructions to the upgrade guide for reingesting old logs to fix port numbers whose IDs were ≥ 65535.

This PR also updates the CircleCI config to add tests for both major and minor upgrades, in this case 10.5.0 -> 11.0.1 and 11.0.0 -> 11.0.1, respectively. This is needed for this PR because the previous 10.5.0 -> 11.0.0 upgrade added the reverse_proxy_port table, the new 11.0.0 -> 11.0.1 upgrade will remove it, but the new 10.5.0 -> 11.0.0 -> 11.0.1 upgrade does not need to add the table in the first place.

This PR also adds a PR template for this repository.

Motivation and Context

This bug was noticed on both xdmod-dev and ACCESS XDMoD when the following warning appears during ingestion.

[warning] Warning 1264 Out of range value for column 'reverse_proxy_port_id' at row 1

Tests performed

I tested the following in a Docker container running the image tools-ext-01.ccr.xdmod.org/xdmod-ondemand:x86_64-rockylinux8.9.20231119-v11.0.0-1.0-03:

  1. Run these commands:
    ~/bin/services start
    mysql -e 'update modw_ondemand.reverse_proxy_port set id = 65535 where id = 3'
    mysql -e 'update modw_ondemand.reverse_proxy_port set id = 65536 where id = 4'
    mysql -e 'update modw_ondemand.page_impressions set reverse_proxy_port_id = 65535 where reverse_proxy_port_id = 3'
    mysql -e 'update modw_ondemand.page_impressions set reverse_proxy_port_id = 65536 where reverse_proxy_port_id = 4'
    ~/bin/services stop
    export COMPOSER_ALLOW_SUPERUSER=1
    export XDMOD_REALMS='jobs,storage,cloud,resourcespecifications'
    export XDMOD_IS_CORE=yes
    export XDMOD_INSTALL_DIR=/xdmod
    export XDMOD_TEST_MODE=upgrade
    export XDMOD_SRC_DIR=/xdmod
    git clone https://github.com/aaronweeden/xdmod-ondemand -b fix-reverse-proxy-port-11.0 /xdmod-ondemand
    cd /xdmod-ondemand
    git clone https://github.com/ubccr/xdmod --branch xdmod11.0 $XDMOD_SRC_DIR
    ln -s `pwd` $XDMOD_SRC_DIR/open_xdmod/modules/ondemand
    composer install -d $XDMOD_SRC_DIR --no-progress
    export XDMOD_SOURCE_DIR=/xdmod
    pushd $XDMOD_SRC_DIR
    ~/bin/buildrpm xdmod ondemand
    popd
    $XDMOD_SRC_DIR/tests/ci/bootstrap.sh
    ./tests/scripts/bootstrap.sh
    sudo -u xdmod xdmod-ondemand-ingestor -d /tmp/ondemand -r styx --debug
  2. Run the SQL commands in the upgrade guide to confirm that there were the expected duplicate rows and those rows were deleted as expected.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project as found in the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@aaronweeden aaronweeden added the bug Something isn't working label Nov 14, 2024
@aaronweeden aaronweeden added this to the 11.0.1 milestone Nov 14, 2024
@aaronweeden aaronweeden force-pushed the fix-reverse-proxy-port-11.0 branch from 4e07c19 to df6dbe8 Compare December 16, 2024 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant