You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For each new node, we are actually sending the tserver hostport instead of the CQL one. Therefore, the host/IP is correct, but the port is wrong: typically 9100 (tserver default) instead of 9042 (CQL default).
Some drivers (e.g. the Java driver) were ignoring the port sent in the event anyway and
using the one set in config/constructor of the driver object -- so this was not practically an issue.
But others like Gocql seem to rely on it.
To replicate
1. Install gocql
go get github.com/yugabyte/gocql
2. Copy the code below into a file cql_example.go
package main;
import (
"fmt""log""time""strconv""github.com/yugabyte/gocql"
)
funcmain() {
// Connect to the cluster.cluster:=gocql.NewCluster("127.0.0.1", "127.0.0.2", "127.0.0.3")
// Use the same timeout as the Java driver.cluster.Timeout=12*time.Second// Create the session.session, _:=cluster.CreateSession()
defersession.Close()
// Set up the keyspace and table.iferr:=session.Query("CREATE KEYSPACE IF NOT EXISTS ybdemo").Exec(); err!=nil {
log.Fatal(err)
}
fmt.Println("Created keyspace ybdemo")
iferr:=session.Query(`DROP TABLE IF EXISTS ybdemo.employee`).Exec(); err!=nil {
log.Fatal(err)
}
varcreateStmt=`CREATE TABLE ybdemo.employee (id int PRIMARY KEY, name varchar, age int, language varchar)`;
iferr:=session.Query(createStmt).Exec(); err!=nil {
log.Fatal(err)
}
fmt.Println("Created table ybdemo.employee")
// Insert some rows into the table.fori:=0; i<10000; i++ {
varinsertStmtstring="INSERT INTO ybdemo.employee(id, name, age, language)"+" VALUES ("+strconv.Itoa(i) +", 'John', 35, 'Go')";
iferr:=session.Query(insertStmt).Exec(); err!=nil {
log.Fatal(err)
}
}
}
3. Start a yb cluster
Use rf-3 and a low refresh interval to ensure we get topology change events often:
Summary:
Previously, for each node node, we were sending the tserver port (typically `9100`).
Now, we correctly send the CQL port (typically `9042`) so that the drivers can handle
change correctly.
Note: Some drivers (e.g. the Java driver) were ignoring the port sent in the event and
using the one set in config/constructor of the driver object. But others like Gocql seem
to rely on it.
Test Plan:
Follow the instructions from #2607
and check that the ports in the output are not correct (`9042` instead of `9100`).
```
2019/10/14 17:55:50 gocql: handling frame: [topology_change change=NEW_NODE host=127.0.0.1 port=9042]
2019/10/14 17:55:50 gocql: handling frame: [topology_change change=NEW_NODE host=127.0.0.2 port=9042]
2019/10/14 17:55:50 gocql: handling frame: [topology_change change=NEW_NODE host=127.0.0.1 port=9042]
2019/10/14 17:55:50 gocql: handling frame: [topology_change change=NEW_NODE host=127.0.0.2 port=9042]
2019/10/14 17:55:50 gocql: handling frame: [topology_change change=NEW_NODE host=127.0.0.3 port=9042]
2019/10/14 17:55:50 gocql: handling frame: [topology_change change=NEW_NODE host=127.0.0.3 port=9042]
2019/10/14 17:55:50 gocql: handling frame: [topology_change change=MOVED_NODE host=127.0.0.1 port=9042]
```
Reviewers: neil, sergei
Reviewed By: sergei
Subscribers: amitanand, kannan, yql
Differential Revision: https://phabricator.dev.yugabyte.com/D7397
For each new node, we are actually sending the tserver hostport instead of the CQL one. Therefore, the host/IP is correct, but the port is wrong: typically
9100
(tserver default) instead of9042
(CQL default).Some drivers (e.g. the Java driver) were ignoring the port sent in the event anyway and
using the one set in config/constructor of the driver object -- so this was not practically an issue.
But others like Gocql seem to rely on it.
To replicate
1. Install gocql
2. Copy the code below into a file
cql_example.go
3. Start a yb cluster
Use rf-3 and a low refresh interval to ensure we get topology change events often:
4. Now run the app
This should output a lot of logging including lines like:
Notice that above
NEW_NODE
events have the wrong9100
port while theMOVED_NODE
event has the correct9042
port.The text was updated successfully, but these errors were encountered: