remove serialization of DruidServer#2665
Conversation
|
👍 |
|
Is the serialization used by any of the coordinator or broker jersey informational resources? |
|
I don't think so. ContainerCache of CuratorInventoryManager uses deserialization of DruidServer when CHILD_ADDED or CHILD_UPDATED happens in its from AbstractDataSegmentAnnouncer: Please correct me if I am wrong or missing something. |
|
Actually I found a usage of it on ServersResource, as it returns server information from |
|
FWIW, DruidServerMetadata should be the source of truth of a Druid node's metadata, if you want to get basic metadata of a Druid node, use DruidServerMetadata. DruidServer actually just means a Druid node that can load segments, i.e. Historical or Realtime. It is constructed from serialized DruidServerMetadata, but it stores more information about the segments it is serving. So technically it should be a subclass of DruidServerMetadata (I am working on refactoring this in #2242). If Druid never uses serialized DruidServer, I am 👍 |
|
It's also fine to leave them as is. I am fine with either. |
|
@guobingkun @jisookim0513 what this tells me is that I think it's still useful to remove the serialization of DruidServer just because it is confusing and also handles a lot of logic for the server views. @guobingkun I am not sure about making DruidServer a subclass of DruidServerMetadata unless there really is a need to. If I remember correctly, the main reason we split off the metadata in the first place was to reduce heap usage on the coordinator. |
a1f0588 to
4ce536a
Compare
|
@xvrl added a custom serialization for full DruidServer in |
|
@xvrl @gianm I added tests for ServersResource, mainly for serialization of DruidServer. I created the test based on the previous version (with a serialization of DruidServer) so the customized serialized outputs of |
|
👍 once you squash your commits |
bd3d14a to
0d3c5a3
Compare
|
@xvrl squashed |
|
👍 |
Under the current implementation, when DruidServer can be serialized, and when it is, the serialized object contains every field except for
name,dataSources, andmetadata. This can be confusing and misleading since deserialized DruidServer has information of all the segments it has but no information of dataSource. In this case, adding a data segment to the server for adding dataSource will fail since it already has the segment onsegmentsmap. I am not sure whysegmentsgets serialized, and since serialized object doesn't seem to be used anywhere (only DruidServerMetadata is serialized and used), I suggest getting rid of serialization of DruidServer to avoid further confusion.I originally tried serializing and deserializing DruidServer in order to construct my own TimelineServerView based on the timeline I got from BrokerServerView, and this custom TimelineServerView couldn't return the correct timeline because DruidServer's
dataSourceswasnullwhile it hadsegmentspopulated. In addition, the server didn't have name (name == null) and there was no method to set name.The correct way of reconstructing DruidServer was to serialize and deserialize DruidServer's DruidServerMetadata and use that to construct a new DruidServer and populate it by calling
addDataSegmentfor all data segments. By doing this, I was able to get the DruidServer with all fields being correct and the correct VersionedIntervalTimeline.