Skip to content

Comparisons between TserverInstance and TabletMetadata.Location are error prone #3254

@keith-turner

Description

@keith-turner

While working on #3251 an equals method was added to TabletMetadata.Location which caused this test to break.

The cause of the breakage in the test was this code that ends up looking up a TabletMetadata.Location object in a set of TServerInstance objects. This works because TabletMetadata.Location extends TServerInstance and does not override equals or hashcode. Overriding the equals method caused the test to break.

It would be much cleaner and less error prone if TabletMetadata.Location encapsulated TServerInstance instead of extending it. If something wanted to compare to the TServerInstance then it could call getTServerInstance() on location and compare to that. Encapsulation instead of extension would allow TabletMetadata.Location to have its own sensible equals and hashcode methods also.

Metadata

Metadata

Assignees

Labels

bugThis issue has been verified to be a bug.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions