Skip to content

Commit

Permalink
Merge pull request #379 from rhusar/CLOUD-4173
Browse files Browse the repository at this point in the history
CLOUD-4173 Never truncate jboss.node.name - replace by tx specific JBOSS_TX_NODE_ID property.
  • Loading branch information
jfdenise authored Aug 22, 2023
2 parents 7b652c8 + 4b01f40 commit e8e04a8
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ PRIVATE_IP_ADDRESS=${PUBLIC_IP_ADDRESS}
MANAGEMENT_IP_ADDRESS=${WILDFLY_MANAGEMENT_BIND_ADDRESS:-${SERVER_MANAGEMENT_BIND_ADDRESS:-0.0.0.0}}
ENABLE_STATISTICS=${WILDFLY_ENABLE_STATISTICS:-${SERVER_ENABLE_STATISTICS:-true}}

# handle jboss node name truncation
# Handle JBOSS_TX_NODE_ID computation from JBOSS_NODE_NAME
# Do not rely on ha.sh launch script to set it. The ha logic will get removed at some point.
init_node_name

launchServer "$JBOSS_HOME/bin/standalone.sh -c $SERVER_CONFIG" "-Djboss.node.name=${JBOSS_NODE_NAME} -bprivate ${PUBLIC_IP_ADDRESS} -b ${PUBLIC_IP_ADDRESS} -bmanagement ${MANAGEMENT_IP_ADDRESS} -Dwildfly.statistics-enabled=${ENABLE_STATISTICS} ${SERVER_ARGS}"
launchServer "$JBOSS_HOME/bin/standalone.sh -c $SERVER_CONFIG" "-Djboss.node.name=${JBOSS_NODE_NAME} -Djboss.tx.node.id=${JBOSS_TX_NODE_ID} -bprivate ${PUBLIC_IP_ADDRESS} -b ${PUBLIC_IP_ADDRESS} -bmanagement ${MANAGEMENT_IP_ADDRESS} -Dwildfly.statistics-enabled=${ENABLE_STATISTICS} ${SERVER_ARGS}"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature-group-spec name="os-tx-recovery" xmlns="urn:jboss:galleon:feature-group:1.0">
<feature spec="subsystem.transactions">
<param name="node-identifier" value="${jboss.node.name}"/>
<param name="node-identifier" value="${jboss.tx.node.id}"/>
<param name="recovery-listener" value="true"/>
</feature>
</feature-group-spec>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash

function prepareEnv() {
unset STATEFULSET_HEADLESS_SERVICE_NAME
Expand Down
2 changes: 1 addition & 1 deletion jboss/container/wildfly/launch/jgroups/added/launch/ha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ configure_ha_args() {

init_node_name

JBOSS_HA_ARGS="${JBOSS_HA_ARGS} -Djboss.node.name=${JBOSS_NODE_NAME}"
JBOSS_HA_ARGS="${JBOSS_HA_ARGS} -Djboss.node.name=${JBOSS_NODE_NAME} -Djboss.tx.node.id=${JBOSS_TX_NODE_ID}"
}

configure_ha() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ function init_node_name() {
JBOSS_NODE_NAME="${HOSTNAME}"
fi

# CLOUD-427: truncate to 23 characters max (from the end backwards)
if [ ${#JBOSS_NODE_NAME} -gt 23 ]; then
JBOSS_NODE_NAME=${JBOSS_NODE_NAME: -23}
fi
# CLOUD-427: truncate transaction node-id JBOSS_TX_NODE_ID to the last 23 characters of the JBOSS_NODE_NAME
JBOSS_TX_NODE_ID=${JBOSS_NODE_NAME: -23}
fi
}
4 changes: 3 additions & 1 deletion jboss/container/wildfly/run/api/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ envs:
- name: JAVA_OPTS_APPEND
description: To append options to JAVA_OPTS env variable.
- name: JBOSS_NODE_NAME
description: Set jboss.node.name property value. By default a truncated to 23 characters name based on the hostname is computed.
description: Set jboss.node.name property value.
- name: JBOSS_TX_NODE_ID
description: Set transactions subsystem node-identifier property value. By default set as truncated to last 23 characters name based on the hostname is computed.
- name: PORT_OFFSET
description: Use this env variable to set the server port offset. This is advised practice instead of directly setting jboss.socket.binding.port-offset in the SERVER_ARGS. It allows the server shutdown logic to connect to the running server to do a clean CLI shutdown.
- name: SERVER_ARGS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ else
#Ensure node name (FOR NOW NEEDED PERHAPS REVISIT FOR EAP8)
run_init_node_name

SERVER_ARGS="${JAVA_PROXY_OPTIONS} -Djboss.node.name=${JBOSS_NODE_NAME} ${PORT_OFFSET_PROPERTY} -b ${PUBLIC_IP_ADDRESS} -bmanagement ${MANAGEMENT_IP_ADDRESS} -Dwildfly.statistics-enabled=${ENABLE_STATISTICS} ${SERVER_ARGS}"
SERVER_ARGS="${JAVA_PROXY_OPTIONS} -Djboss.node.name=${JBOSS_NODE_NAME} -Djboss.tx.node.id=${JBOSS_TX_NODE_ID} ${PORT_OFFSET_PROPERTY} -b ${PUBLIC_IP_ADDRESS} -bmanagement ${MANAGEMENT_IP_ADDRESS} -Dwildfly.statistics-enabled=${ENABLE_STATISTICS} ${SERVER_ARGS}"

if [ -n "${CLI_LAUNCH_SCRIPT}" ]; then
if [ ! -f "${CLI_LAUNCH_SCRIPT}" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ function run_init_node_name() {
JBOSS_NODE_NAME="$(hostname)"
fi

# CLOUD-427: truncate to 23 characters max (from the end backwards)
if [ ${#JBOSS_NODE_NAME} -gt 23 ]; then
JBOSS_NODE_NAME=${JBOSS_NODE_NAME: -23}
fi
# CLOUD-427: truncate transaction node-id JBOSS_TX_NODE_ID to the last 23 characters of the JBOSS_NODE_NAME
JBOSS_TX_NODE_ID=${JBOSS_NODE_NAME: -23}
fi
}
14 changes: 11 additions & 3 deletions jboss/container/wildfly/run/bash/test/run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,20 @@ setup() {
@test "Node name set" {
NODE_NAME=abcdefghijklmnopqrstuvwxyz
run_init_node_name
[ "${JBOSS_NODE_NAME}" = "defghijklmnopqrstuvwxyz" ]

# Verify that jboss.node.name is untouched
[ "${JBOSS_NODE_NAME}" = "abcdefghijklmnopqrstuvwxyz" ]
# Verify that jboss.tx.node.id is truncated to last 23 characters
[ "${JBOSS_TX_NODE_ID}" = "defghijklmnopqrstuvwxyz" ]
}

@test "Host name set" {
HOSTNAME=abcdefghijklmnopqrstuvwxyz123
run_init_node_name
echo $JBOSS_NODE_NAME
[ "${JBOSS_NODE_NAME}" = "ghijklmnopqrstuvwxyz123" ]
echo $JBOSS_NODE_NAME

# Verify that jboss.node.name is untouched
[ "${JBOSS_NODE_NAME}" = "abcdefghijklmnopqrstuvwxyz123" ]
# Verify that jboss.tx.node.id is truncated to last 23 characters
[ "${JBOSS_TX_NODE_ID}" = "ghijklmnopqrstuvwxyz123" ]
}
2 changes: 1 addition & 1 deletion jboss/container/wildfly/s2i/1.0/bash/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ envs:
value: "4.2.8.Final"
- name: GALLEON_WILDFLY_VERSION
value: "5.2.11.Final"
description: "Set to true to explicitly add org.wildfly:wildfly-datasources-galleon-pack to provisoned galleon feature-packs."
description: "Set to true to explicitly add org.wildfly:wildfly-datasources-galleon-pack to provisioned galleon feature-packs."
- name: GALLEON_S2I_PRODUCER_NAME
description: Mandatory. Name of the built feature-pack producer.
- name: S2I_FP_VERSION
Expand Down

0 comments on commit e8e04a8

Please sign in to comment.