-
Notifications
You must be signed in to change notification settings - Fork 7
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
session: prepare now prepares on all nodes #266
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ type topology struct { | |
localDC string | ||
peers peerMap | ||
dcRacks dcRacksMap | ||
nodes []*Node | ||
Nodes []*Node | ||
policyInfo policyInfo | ||
keyspaces ksMap | ||
} | ||
|
@@ -94,6 +94,10 @@ func (c *Cluster) NewTokenAwareQueryInfo(t Token, ks string) (QueryInfo, error) | |
top := c.Topology() | ||
// When keyspace is not specified, we take default keyspace from ConnConfig. | ||
if ks == "" { | ||
if c.cfg.Keyspace == "" { | ||
// We don't know anything about the keyspace, fallback to non-token aware query. | ||
return c.NewQueryInfo(), nil | ||
} | ||
Comment on lines
+97
to
+100
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change necessary for the purpose of this PR (preparing statements on all nodes)? If not, then perhaps it should be sent as a separate PR, or - at least - as a separate commit? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Creating the test i encountered a missing keyspace error that "" was not found in system_schema.keyspaces, currently the driver always assumes it's querying the default session keyspace which needs to be changed with #257, right now the driver doesn't save info about keyspace from prepared results, hence i needed this workaround. I prefer to do this all with #257. I moved the workaround to another commit. |
||
ks = c.cfg.Keyspace | ||
} | ||
if stg, ok := top.keyspaces[ks]; ok { | ||
|
@@ -219,7 +223,7 @@ func (c *Cluster) refreshTopology() error { | |
// Every encountered node becomes known host for future use. | ||
c.knownHosts[n.addr] = struct{}{} | ||
t.peers[n.addr] = n | ||
t.nodes = append(t.nodes, n) | ||
t.Nodes = append(t.Nodes, n) | ||
u[uniqueRack{dc: n.datacenter, rack: n.rack}] = struct{}{} | ||
if err := parseTokensFromRow(n, r, &t.policyInfo.ring); err != nil { | ||
return err | ||
|
@@ -251,7 +255,7 @@ func newTopology() *topology { | |
return &topology{ | ||
peers: make(peerMap), | ||
dcRacks: make(dcRacksMap), | ||
nodes: make([]*Node, 0), | ||
Nodes: make([]*Node, 0), | ||
policyInfo: policyInfo{ | ||
ring: make(Ring, 0), | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the sleep is here in order to simulate a "wait for schema agreement" operation? I suggest placing a TODO comment here so that it will be easier to find the workaround-sleeps when somebody gets to implement it.