-
Notifications
You must be signed in to change notification settings - Fork 624
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
CASSGO-6 'Unable to discover cluster nodes with an empty rack name' issue fix #1785
base: trunk
Are you sure you want to change the base?
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 |
---|---|---|
|
@@ -157,6 +157,7 @@ type HostInfo struct { | |
state nodeState | ||
schemaVersion string | ||
tokens []string | ||
isRackNil bool | ||
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. We can change 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. Sounds good to me! |
||
} | ||
|
||
func (h *HostInfo) Equal(host *HostInfo) bool { | ||
|
@@ -484,9 +485,18 @@ func (s *Session) hostInfoFromMap(row map[string]interface{}, host *HostInfo) (* | |
return nil, fmt.Errorf(assertErrorMsg, "data_center") | ||
} | ||
case "rack": | ||
host.rack, ok = value.(string) | ||
rack, ok := value.(*string) | ||
if !ok { | ||
return nil, fmt.Errorf(assertErrorMsg, "rack") | ||
host.rack, ok = value.(string) | ||
if !ok { | ||
return nil, fmt.Errorf(assertErrorMsg, "rack") | ||
} | ||
} else { | ||
if rack != nil { | ||
host.rack = *rack | ||
} else { | ||
host.isRackNil = true | ||
} | ||
} | ||
case "host_id": | ||
hostId, ok := value.(UUID) | ||
|
@@ -673,7 +683,7 @@ func isValidPeer(host *HostInfo) bool { | |
return !(len(host.RPCAddress()) == 0 || | ||
host.hostId == "" || | ||
host.dataCenter == "" || | ||
host.rack == "" || | ||
host.isRackNil || | ||
len(host.tokens) == 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.
This seems like a hack, plus it could break backwards compatibility for existing users of
RowData
(outside of gocql) that read from those tables.Could the issue be fixed another way, for example improving the API/adding new API for all users?
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.
There is #1834, which allows to handle a nullable value. After #1834 is merged, I will refactor this PR using the nullable scan functional. This should help to avoid the hack.
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 agree with addressing #1834 first, @martin-sucha can you provide feedback on #1834 ? I see your original comment on that issue, but I'm not sure if #1834 accurately implements what you were proposing.