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 weight to 1001 #209

Open
wants to merge 1 commit into
base: v2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ Write node info
+-----------+--------------+--------+-----------+
| hostname | hostgroup_id | port | weight |
+-----------+--------------+--------+-----------+
| 127.0.0.1 | 10 | 25000 | 1000000 |
| 127.0.0.1 | 10 | 25000 | 1001 |
+-----------+--------------+--------+-----------+

ProxySQL configuration completed!
Expand Down Expand Up @@ -655,7 +655,7 @@ mysql_servers rows for this configuration
+---------------+-------+-----------+-------+--------+-----------+----------+---------+-----------+
| hostgroup | hg_id | hostname | port | status | weight | max_conn | use_ssl | gtid_port |
+---------------+-------+-----------+-------+--------+-----------+----------+---------+-----------+
| writer | 10 | 127.0.0.1 | 25000 | ONLINE | 1000000 | 1000 | 0 | 0 |
| writer | 10 | 127.0.0.1 | 25000 | ONLINE | 1001 | 1000 | 0 | 0 |
| reader | 11 | 127.0.0.1 | 25100 | ONLINE | 1000 | 1000 | 0 | 0 |
| reader | 11 | 127.0.0.1 | 25200 | ONLINE | 1000 | 1000 | 0 | 0 |
| backup-writer | 12 | 127.0.0.1 | 25100 | ONLINE | 1000 | 1000 | 0 | 0 |
Expand Down Expand Up @@ -693,7 +693,7 @@ All other remaining nodes will be read-only and will only receive read statement

With the --write-node option we can control which node ProxySQL will use as the
writer node. The writer node is specified as an address:port - 10.0.0.51:3306
If --write-node is used, the writer node is given a weight of 1000000 (the default
If --write-node is used, the writer node is given a weight of 1001 (the default
weight is 1000).

The mode _loadbal_ on the other hand is a load balanced set of evenly weighted
Expand Down
8 changes: 4 additions & 4 deletions proxysql-admin
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ function enable_proxysql() {
# writer-is-also-reader=0, since we only have writers

# Setup parameters for loadbal
MAX_WRITERS=1000000
MAX_WRITERS=1001

# Force this for loadbal, since in loadbal, everyone is a writer
WRITERS_ARE_READERS_OPTION=0
Expand All @@ -1394,7 +1394,7 @@ function enable_proxysql() {
# Update the write_node to have a higher priority
proxysql_exec "$LINENO" \
"UPDATE mysql_servers
SET weight = 1000000
SET weight = 1001
WHERE
hostname = '$writer_ws_ip' AND
port = $writer_ws_port AND
Expand Down Expand Up @@ -2323,14 +2323,14 @@ function update_cluster()
SET weight = 1000
WHERE
hostgroup_id IN ($all_hostgroups) AND
weight = 1000000"
weight = 1001"
check_cmd $? "$LINENO" "Failed to update the write-node" \
"\n-- Please check the ProxySQL connection parameters and status."

# Update the write_node to have a higher priority
proxysql_exec "$LINENO" \
"UPDATE mysql_servers
SET weight = 1000000
SET weight = 1001
WHERE
hostname = '$writer_ws_ip' AND
port = $writer_ws_port AND
Expand Down
6 changes: 3 additions & 3 deletions tests/proxysql-admin-testsuite.bats
Original file line number Diff line number Diff line change
Expand Up @@ -649,11 +649,11 @@ fi
max_transactions_behind=$(echo "$data" | cut -f8)

echo "active:$active expected:1" >&2
echo "max_writers:$active expected:1000000" >&2
echo "max_writers:$active expected:1001" >&2
echo "writer_is_also_reader:$active expected:0" >&2
echo "max_transactions_behind:$active expected:100" >&2
[[ $active -eq 1 ]]
[[ $max_writers -eq 1000000 ]]
[[ $max_writers -eq 1001 ]]
[[ $writer_is_also_reader -eq 0 ]]
[[ $max_transactions_behind -eq 100 ]]

Expand Down Expand Up @@ -733,7 +733,7 @@ fi
retrieve_writer_info $WRITER_HOSTGROUP_ID
echo "write_weight[0]:${write_weight[0]}" >&2
[ "${write_status[0]}" = 'ONLINE' ]
[ "${write_weight[0]}" -eq 1000000 ]
[ "${write_weight[0]}" -eq 1001 ]
[ "${write_port[0]}" -eq $PORT_2 ]

retrieve_writer_info $BACKUP_WRITER_HOSTGROUP_ID
Expand Down