org.elasticsearch.cluster.node.DiscoveryNode Java Examples

The following examples show how to use org.elasticsearch.cluster.node.DiscoveryNode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NodeStatsContextFieldResolver.java    From crate with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
NodeStatsContextFieldResolver(Supplier<DiscoveryNode> localNode,
                              MonitorService monitorService,
                              Supplier<TransportAddress> boundHttpAddress,
                              Supplier<HttpStats> httpStatsSupplier,
                              ThreadPool threadPool,
                              ExtendedNodeInfo extendedNodeInfo,
                              Supplier<ConnectionStats> psqlStats,
                              Supplier<TransportAddress> boundPostgresAddress,
                              LongSupplier numOpenTransportConnections,
                              LongSupplier clusterStateVersion) {
    this.localNode = localNode;
    processService = monitorService.processService();
    osService = monitorService.osService();
    jvmService = monitorService.jvmService();
    fsService = monitorService.fsService();
    this.httpStatsSupplier = httpStatsSupplier;
    this.boundHttpAddress = boundHttpAddress;
    this.threadPool = threadPool;
    this.extendedNodeInfo = extendedNodeInfo;
    this.psqlStats = psqlStats;
    this.boundPostgresAddress = boundPostgresAddress;
    this.numOpenTransportConnections = numOpenTransportConnections;
    this.clusterStateVersion = clusterStateVersion;
}
 
Example #2
Source File: PublishClusterStateAction.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
private void sendFullClusterState(ClusterState clusterState, @Nullable Map<Version, BytesReference> serializedStates,
                                  DiscoveryNode node, AtomicBoolean timedOutWaitingForNodes, TimeValue publishTimeout,
                                  BlockingClusterStatePublishResponseHandler publishResponseHandler) {
    BytesReference bytes = null;
    if (serializedStates != null) {
        bytes = serializedStates.get(node.version());
    }
    if (bytes == null) {
        try {
            bytes = serializeFullClusterState(clusterState, node.version());
            if (serializedStates != null) {
                serializedStates.put(node.version(), bytes);
            }
        } catch (Throwable e) {
            logger.warn("failed to serialize cluster_state before publishing it to node {}", e, node);
            publishResponseHandler.onFailure(node, e);
            return;
        }
    }
    publishClusterStateToNode(clusterState, bytes, node, timedOutWaitingForNodes, publishTimeout, publishResponseHandler, false);
}
 
Example #3
Source File: AllocateUnassignedDecision.java    From crate with Apache License 2.0 6 votes vote down vote up
private AllocateUnassignedDecision(AllocationStatus allocationStatus,
                                   DiscoveryNode assignedNode,
                                   String allocationId,
                                   List<NodeAllocationResult> nodeDecisions,
                                   boolean reuseStore,
                                   long remainingDelayInMillis,
                                   long configuredDelayInMillis) {
    super(assignedNode, nodeDecisions);
    assert assignedNode != null || allocationStatus != null :
        "a yes decision must have a node to assign the shard to";
    assert allocationId == null || assignedNode != null :
        "allocation id can only be null if the assigned node is null";
    this.allocationStatus = allocationStatus;
    this.allocationId = allocationId;
    this.reuseStore = reuseStore;
    this.remainingDelayInMillis = remainingDelayInMillis;
    this.configuredDelayInMillis = configuredDelayInMillis;
}
 
Example #4
Source File: ClusterBootstrapServiceTests.java    From crate with Apache License 2.0 6 votes vote down vote up
public void testBootstrapsOnDiscoveryOfTwoOfThreeRequiredNodes() {
    final AtomicBoolean bootstrapped = new AtomicBoolean();

    ClusterBootstrapService clusterBootstrapService = new ClusterBootstrapService(Settings.builder().putList(
        INITIAL_MASTER_NODES_SETTING.getKey(), localNode.getName(), otherNode1.getName(), otherNode2.getName()).build(),
        transportService, () -> singletonList(otherNode1), () -> false, vc -> {
        assertTrue(bootstrapped.compareAndSet(false, true));
        assertThat(vc.getNodeIds(), hasSize(3));
        assertThat(vc.getNodeIds(), hasItem(localNode.getId()));
        assertThat(vc.getNodeIds(), hasItem(otherNode1.getId()));
        assertThat(vc.getNodeIds(), hasItem(allOf(startsWith(BOOTSTRAP_PLACEHOLDER_PREFIX), containsString(otherNode2.getName()))));
        assertTrue(vc.hasQuorum(Stream.of(localNode, otherNode1).map(DiscoveryNode::getId).collect(Collectors.toList())));
        assertFalse(vc.hasQuorum(singletonList(localNode.getId())));
        assertFalse(vc.hasQuorum(singletonList(otherNode1.getId())));
    });

    transportService.start();
    clusterBootstrapService.onFoundPeersUpdated();
    deterministicTaskQueue.runAllTasks();
    assertTrue(bootstrapped.get());

    bootstrapped.set(false);
    clusterBootstrapService.onFoundPeersUpdated();
    deterministicTaskQueue.runAllTasks();
    assertFalse(bootstrapped.get()); // should only bootstrap once
}
 
Example #5
Source File: RoutingProvider.java    From crate with Apache License 2.0 6 votes vote down vote up
public Routing forRandomMasterOrDataNode(RelationName relationName, DiscoveryNodes nodes) {
    DiscoveryNode localNode = nodes.getLocalNode();
    if (localNode.isMasterNode() || localNode.isDataNode()) {
        return forTableOnSingleNode(relationName, localNode.getId());
    }
    ImmutableOpenMap<String, DiscoveryNode> masterAndDataNodes = nodes.getMasterAndDataNodes();
    int randomIdx = seed % masterAndDataNodes.size();
    Iterator<DiscoveryNode> it = masterAndDataNodes.valuesIt();
    int currIdx = 0;
    while (it.hasNext()) {
        if (currIdx == randomIdx) {
            return forTableOnSingleNode(relationName, it.next().getId());
        }
        currIdx++;
    }
    throw new AssertionError("Cannot find a master or data node with given random index " + randomIdx);
}
 
Example #6
Source File: ADStatsTests.java    From anomaly-detection with Apache License 2.0 6 votes vote down vote up
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    node1 = "node1";
    nodeName1 = "nodename1";
    clusterName = "test-cluster-name";
    discoveryNode1 = new DiscoveryNode(
        nodeName1,
        node1,
        new TransportAddress(TransportAddress.META_ADDRESS, 9300),
        emptyMap(),
        emptySet(),
        Version.CURRENT
    );
    clusterStats = new HashMap<>();
}
 
Example #7
Source File: SnapshotsService.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
private boolean removedNodesCleanupNeeded(ClusterChangedEvent event) {
    // Check if we just became the master
    boolean newMaster = !event.previousState().nodes().localNodeMaster();
    SnapshotsInProgress snapshotsInProgress = event.state().custom(SnapshotsInProgress.TYPE);
    if (snapshotsInProgress == null) {
        return false;
    }
    for (SnapshotsInProgress.Entry snapshot : snapshotsInProgress.entries()) {
        if (newMaster && (snapshot.state() == State.SUCCESS || snapshot.state() == State.INIT)) {
            // We just replaced old master and snapshots in intermediate states needs to be cleaned
            return true;
        }
        for (DiscoveryNode node : event.nodesDelta().removedNodes()) {
            for (ShardSnapshotStatus shardStatus : snapshot.shards().values()) {
                if (!shardStatus.state().completed() && node.getId().equals(shardStatus.nodeId())) {
                    // At least one shard was running on the removed node - we need to fail it
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example #8
Source File: SearchScrollQueryAndFetchAsyncAction.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
void executePhase(final int shardIndex, DiscoveryNode node, final long searchId) {
    InternalScrollSearchRequest internalRequest = internalScrollSearchRequest(searchId, request);
    searchService.sendExecuteFetch(node, internalRequest, new ActionListener<ScrollQueryFetchSearchResult>() {
        @Override
        public void onResponse(ScrollQueryFetchSearchResult result) {
            queryFetchResults.set(shardIndex, result.result());
            if (counter.decrementAndGet() == 0) {
                finishHim();
            }
        }

        @Override
        public void onFailure(Throwable t) {
            onPhaseFailure(t, searchId, shardIndex);
        }
    });
}
 
Example #9
Source File: IndicesClusterStateService.java    From crate with Apache License 2.0 6 votes vote down vote up
/**
 * Removes shard entries from the failed shards cache that are no longer allocated to this node by the master.
 * Sends shard failures for shards that are marked as actively allocated to this node but don't actually exist on the node.
 * Resends shard failures for shards that are still marked as allocated to this node but previously failed.
 *
 * @param state new cluster state
 */
private void updateFailedShardsCache(final ClusterState state) {
    RoutingNode localRoutingNode = state.getRoutingNodes().node(state.nodes().getLocalNodeId());
    if (localRoutingNode == null) {
        failedShardsCache.clear();
        return;
    }

    DiscoveryNode masterNode = state.nodes().getMasterNode();

    // remove items from cache which are not in our routing table anymore and resend failures that have not executed on master yet
    for (Iterator<Map.Entry<ShardId, ShardRouting>> iterator = failedShardsCache.entrySet().iterator(); iterator.hasNext(); ) {
        ShardRouting failedShardRouting = iterator.next().getValue();
        ShardRouting matchedRouting = localRoutingNode.getByShardId(failedShardRouting.shardId());
        if (matchedRouting == null || matchedRouting.isSameAllocation(failedShardRouting) == false) {
            iterator.remove();
        } else {
            if (masterNode != null) { // TODO: can we remove this? Is resending shard failures the responsibility of shardStateAction?
                String message = "master " + masterNode + " has not removed previously failed shard. resending shard failure";
                LOGGER.trace("[{}] re-sending failed shard [{}], reason [{}]", matchedRouting.shardId(), matchedRouting, message);
                shardStateAction.localShardFailed(matchedRouting, message, null, SHARD_STATE_ACTION_LISTENER, state);
            }
        }
    }
}
 
Example #10
Source File: NettyTransport.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
/**
 * Disconnects from a node if a channel is found as part of that nodes channels.
 */
protected void disconnectFromNodeChannel(final Channel channel, final Throwable failure) {
    threadPool().generic().execute(new Runnable() {

        @Override
        public void run() {
            for (DiscoveryNode node : connectedNodes.keySet()) {
                if (disconnectFromNode(node, channel, ExceptionsHelper.detailedMessage(failure))) {
                    // if we managed to find this channel and disconnect from it, then break, no need to check on
                    // the rest of the nodes
                    break;
                }
            }
        }
    });
}
 
Example #11
Source File: CopyStatementPlanner.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
private static Collection<String> getExecutionNodes(DiscoveryNodes allNodes,
                                                    int maxNodes,
                                                    final Predicate<DiscoveryNode> nodeFilters) {
    final AtomicInteger counter = new AtomicInteger(maxNodes);
    final List<String> nodes = new ArrayList<>(allNodes.size());
    allNodes.dataNodes().values().forEach(new ObjectProcedure<DiscoveryNode>() {
        @Override
        public void apply(DiscoveryNode value) {
            if (nodeFilters.apply(value) && counter.getAndDecrement() > 0) {
                nodes.add(value.id());
            }
        }
    });
    return nodes;
}
 
Example #12
Source File: ShardStateAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
public void shardFailed(final ShardRouting shardRouting, final String indexUUID, final String message, @Nullable final Throwable failure) {
    DiscoveryNode masterNode = clusterService.state().nodes().masterNode();
    if (masterNode == null) {
        logger.warn("can't send shard failed for {}, no master known.", shardRouting);
        return;
    }
    innerShardFailed(shardRouting, indexUUID, masterNode, message, failure);
}
 
Example #13
Source File: SnapshotsService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Inject
public SnapshotsService(Settings settings, ClusterService clusterService, IndexNameExpressionResolver indexNameExpressionResolver, RepositoriesService repositoriesService, ThreadPool threadPool) {
    super(settings);
    this.clusterService = clusterService;
    this.indexNameExpressionResolver = indexNameExpressionResolver;
    this.repositoriesService = repositoriesService;
    this.threadPool = threadPool;

    if (DiscoveryNode.masterNode(settings)) {
        // addLast to make sure that Repository will be created before snapshot
        clusterService.addLast(this);
    }
}
 
Example #14
Source File: LocalAllocateDangledIndices.java    From crate with Apache License 2.0 5 votes vote down vote up
public void allocateDangled(Collection<IndexMetaData> indices, final Listener listener) {
    ClusterState clusterState = clusterService.state();
    DiscoveryNode masterNode = clusterState.nodes().getMasterNode();
    if (masterNode == null) {
        listener.onFailure(new MasterNotDiscoveredException("no master to send allocate dangled request"));
        return;
    }
    AllocateDangledRequest request = new AllocateDangledRequest(clusterService.localNode(),
        indices.toArray(new IndexMetaData[indices.size()]));
    transportService.sendRequest(masterNode, ACTION_NAME, request, new TransportResponseHandler<AllocateDangledResponse>() {
        @Override
        public AllocateDangledResponse read(StreamInput in) throws IOException {
            return new AllocateDangledResponse(in);
        }

        @Override
        public void handleResponse(AllocateDangledResponse response) {
            listener.onResponse(response);
        }

        @Override
        public void handleException(TransportException exp) {
            listener.onFailure(exp);
        }

        @Override
        public String executor() {
            return ThreadPool.Names.SAME;
        }
    });
}
 
Example #15
Source File: TcpTransport.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void onRequestSent(DiscoveryNode node, long requestId, String action, TransportRequest request,
                          TransportRequestOptions finalOptions) {
    for (TransportMessageListener listener : listeners) {
        listener.onRequestSent(node, requestId, action, request, finalOptions);
    }
}
 
Example #16
Source File: MockTransportService.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
protected void traceReceivedResponse(long requestId, DiscoveryNode sourceNode, String action) {
    super.traceReceivedResponse(requestId, sourceNode, action);
    for (Tracer tracer : activeTracers) {
        tracer.receivedResponse(requestId, sourceNode, action);
    }
}
 
Example #17
Source File: Publication.java    From crate with Apache License 2.0 5 votes vote down vote up
void onFaultyNode(DiscoveryNode faultyNode) {
    if (isActive() && discoveryNode.equals(faultyNode)) {
        logger.debug("onFaultyNode: [{}] is faulty, failing target in publication {}", faultyNode, Publication.this);
        setFailed(new ElasticsearchException("faulty node"));
        onPossibleCommitFailure();
    }
}
 
Example #18
Source File: LocalTransport.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void sendRequest(final DiscoveryNode node, final long requestId, final String action, final TransportRequest request, TransportRequestOptions options) throws IOException, TransportException {
    final Version version = Version.smallest(node.version(), this.version);

    try (BytesStreamOutput stream = new BytesStreamOutput()) {
        stream.setVersion(version);

        stream.writeLong(requestId);
        byte status = 0;
        status = TransportStatus.setRequest(status);
        stream.writeByte(status); // 0 for request, 1 for response.

        stream.writeString(action);
        request.writeTo(stream);

        stream.close();

        final LocalTransport targetTransport = connectedNodes.get(node);
        if (targetTransport == null) {
            throw new NodeNotConnectedException(node, "Node not connected");
        }

        final byte[] data = stream.bytes().toBytes();

        transportServiceAdapter.sent(data.length);
        transportServiceAdapter.onRequestSent(node, requestId, action, request, options);
        targetTransport.workers().execute(new Runnable() {
            @Override
            public void run() {
                targetTransport.messageReceived(data, action, LocalTransport.this, version, requestId);
            }
        });
    }
}
 
Example #19
Source File: SearchServiceTransportAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
public void sendExecuteFetch(DiscoveryNode node, final ShardSearchTransportRequest request, final ActionListener<QueryFetchSearchResult> listener) {
    transportService.sendRequest(node, QUERY_FETCH_ACTION_NAME, request, new ActionListenerResponseHandler<QueryFetchSearchResult>(listener) {
        @Override
        public QueryFetchSearchResult newInstance() {
            return new QueryFetchSearchResult();
        }
    });
}
 
Example #20
Source File: CoordinatorTests.java    From crate with Apache License 2.0 5 votes vote down vote up
ClusterNode restartedNode(Function<MetaData, MetaData> adaptGlobalMetaData, Function<Long, Long> adaptCurrentTerm,
                          Settings nodeSettings) {
    final TransportAddress address = randomBoolean() ? buildNewFakeTransportAddress() : localNode.getAddress();
    final DiscoveryNode newLocalNode = new DiscoveryNode(localNode.getName(), localNode.getId(),
        UUIDs.randomBase64UUID(random()), // generated deterministically for repeatable tests
        address.address().getHostString(), address.getAddress(), address, Collections.emptyMap(),
        localNode.isMasterNode() ? EnumSet.allOf(Role.class) : emptySet(), Version.CURRENT);
    return new ClusterNode(nodeIndex, newLocalNode,
        node -> new MockPersistedState(newLocalNode, persistedState, adaptGlobalMetaData, adaptCurrentTerm), nodeSettings);
}
 
Example #21
Source File: GatewayMetaState.java    From crate with Apache License 2.0 5 votes vote down vote up
public PersistedState getPersistedState(Settings settings, ClusterApplierService clusterApplierService) {
    applyClusterStateUpdaters();
    if (DiscoveryNode.isMasterNode(settings) == false) {
        // use Zen1 way of writing cluster state for non-master-eligible nodes
        // this avoids concurrent manipulating of IndexMetadata with IndicesStore
        clusterApplierService.addLowPriorityApplier(this);
        return new InMemoryPersistedState(getCurrentTerm(), getLastAcceptedState());
    }
    return this;
}
 
Example #22
Source File: RoutesProvider.java    From swagger-for-elasticsearch with Apache License 2.0 5 votes vote down vote up
protected DiscoveryNode getCurrentNode() {
    return cache.getOrResolve("getCurrentNode",
        new Callable<DiscoveryNode>() {
            @Override
            public DiscoveryNode call() throws Exception {
                return client.admin().cluster().prepareNodesInfo().get().getNodes()[0].getNode();
            }
        }
    );
}
 
Example #23
Source File: ExplainAnalyzeIntegrationTest.java    From crate with Apache License 2.0 5 votes vote down vote up
@Test
public void testExplainSelectWithoutJobExecutionContexts() {
    execute("explain analyze select 1");
    Map<String, Object> analysis = (Map<String, Object>) response.rows()[0][0];
    Map<String, Object> executeAnalysis = (Map<String, Object>) analysis.get("Execute");
    assertTrue(executeAnalysis.keySet().contains("Total"));
    DiscoveryNodes nodes = clusterService().state().nodes();
    List<Matcher<String>> nodeIds = new ArrayList<>(nodes.getSize());
    for (DiscoveryNode discoveryNode : nodes) {
        nodeIds.add(is(discoveryNode.getId()));
    }
    assertThat(executeAnalysis.keySet(), hasItems(is("Total"), anyOf(nodeIds.toArray(new Matcher[]{}))));
}
 
Example #24
Source File: ShardStateAction.java    From crate with Apache License 2.0 5 votes vote down vote up
private void sendShardAction(final String actionName, final ClusterState currentState, final TransportRequest request, final ActionListener<Void> listener) {
    ClusterStateObserver observer = new ClusterStateObserver(currentState, clusterService, null, LOGGER);
    DiscoveryNode masterNode = currentState.nodes().getMasterNode();
    Predicate<ClusterState> changePredicate = MasterNodeChangePredicate.build(currentState);
    if (masterNode == null) {
        LOGGER.warn("no master known for action [{}] for shard entry [{}]", actionName, request);
        waitForNewMasterAndRetry(actionName, observer, request, listener, changePredicate);
    } else {
        LOGGER.debug("sending [{}] to [{}] for shard entry [{}]", actionName, masterNode.getId(), request);
        transportService.sendRequest(masterNode,
            actionName, request, new EmptyTransportResponseHandler(ThreadPool.Names.SAME) {
                @Override
                public void handleResponse(TransportResponse.Empty response) {
                    listener.onResponse(null);
                }

                @Override
                public void handleException(TransportException exp) {
                    if (isMasterChannelException(exp)) {
                        waitForNewMasterAndRetry(actionName, observer, request, listener, changePredicate);
                    } else {
                        LOGGER.warn(new ParameterizedMessage("unexpected failure while sending request [{}] to [{}] for shard entry [{}]", actionName, masterNode, request), exp);
                        listener.onFailure(exp instanceof RemoteTransportException ? (Exception) (exp.getCause() instanceof Exception ? exp.getCause() : new ElasticsearchException(exp.getCause())) : exp);
                    }
                }
            });
    }
}
 
Example #25
Source File: IndicesClusterStateService.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
protected void doStart() {
    // Doesn't make sense to manage shards on non-master and non-data nodes
    if (DiscoveryNode.isDataNode(settings) || DiscoveryNode.isMasterNode(settings)) {
        clusterService.addHighPriorityApplier(this);
    }
}
 
Example #26
Source File: PeerRecoveryTargetService.java    From crate with Apache License 2.0 5 votes vote down vote up
public void startRecovery(final IndexShard indexShard, final DiscoveryNode sourceNode, final RecoveryListener listener) {
    // create a new recovery status, and process...
    final long recoveryId = onGoingRecoveries.startRecovery(indexShard, sourceNode, listener, recoverySettings.activityTimeout());
    // we fork off quickly here and go async but this is called from the cluster state applier
    // thread too and that can cause assertions to trip if we executed it on the same thread
    // hence we fork off to the generic threadpool.
    threadPool.generic().execute(new RecoveryRunner(recoveryId));
}
 
Example #27
Source File: CopyFromAnalyzedStatement.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
public CopyFromAnalyzedStatement(DocTableInfo table,
                                 Settings settings,
                                 Symbol uri,
                                 @Nullable String partitionIdent,
                                 Predicate<DiscoveryNode> nodePredicate) {
    super(settings, uri);
    this.table = table;
    this.partitionIdent = partitionIdent;
    this.nodePredicate = nodePredicate;
}
 
Example #28
Source File: TransportActionNodeProxy.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
public void execute(final DiscoveryNode node, final Request request, final ActionListener<Response> listener) {
    ActionRequestValidationException validationException = request.validate();
    if (validationException != null) {
        listener.onFailure(validationException);
        return;
    }
    transportService.sendRequest(node, action.name(), request, transportOptions, new ActionListenerResponseHandler<Response>(listener) {
        @Override
        public Response newInstance() {
            return action.newResponse();
        }
    });
}
 
Example #29
Source File: SysNodesTableInfo.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public Routing getRouting(WhereClause whereClause, @Nullable String preference) {
    DiscoveryNodes nodes = service.state().nodes();
    TreeMapBuilder<String, Map<String, List<Integer>>> builder = TreeMapBuilder.newMapBuilder();
    Map<String, List<Integer>> emptyTableMap = Collections.emptyMap();
    for (DiscoveryNode node : nodes) {
        builder.put(node.id(), emptyTableMap);
    }
    return new Routing(builder.map());
}
 
Example #30
Source File: ClusterState.java    From crate with Apache License 2.0 5 votes vote down vote up
ClusterStateDiff(StreamInput in, DiscoveryNode localNode) throws IOException {
    clusterName = new ClusterName(in);
    fromUuid = in.readString();
    toUuid = in.readString();
    toVersion = in.readLong();
    routingTable = RoutingTable.readDiffFrom(in);
    nodes = DiscoveryNodes.readDiffFrom(in, localNode);
    metaData = MetaData.readDiffFrom(in);
    blocks = ClusterBlocks.readDiffFrom(in);
    customs = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), CUSTOM_VALUE_SERIALIZER);
}