Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Ignite Partition notes

2025-03-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Data replication mechanism: the client calculates the master node according to HASH, and the data is only sent from the client to the master node.

GridNearAtomicSingleUpdateFuture.mapOnTopology

GridNearAtomicSingleUpdateFuture.map

GridNearAtomicAbstractUpdateFuture.sendSingleRequest

GridCacheIoManager.send

When the data is copied to the primary node, it is copied from the primary node to other nodes

GridDhtAtomicCache.updateAllAsyncInternal

GridDhtAtomicAbstractUpdateFuture.map

GridDhtAtomicAbstractUpdateFuture.sendDhtRequests

GridCacheIoManager.send

The primary node is recalculated whenever the cluster topology changes

GridCachePartitionExchangeManager.onDiscoveryEvent

GridDhtPartitionsExchangeFuture.onClusterStateChangeRequest/onCacheChangeRequest/onAffinityChangeRequest/

CacheAffinitySharedManager.applyx

GridAffinityAssignmentCache.calculate

AffinityFunction.assignPartitions

IGNITE uses Rendezvous hash algorithm to calculate the weight of each node. As long as the view of the cluster is consistent, the client server uses this algorithm to find out the N nodes with the highest weight.

As the primary node and replication node

RendezvousAffinityFunction:

Assign multiple cluster nodes to each PARTITION. The number of PARTITION is passed into RendezvousAffinityFunction as a parameter. Default is 1024. The result of the allocation indicates which nodes the data of this PARTITION should fall on.

Calculate the HASH for each cluster node: the CONSISTENTHASHID with the value of the node modulates the current PARTITION

Sort the HASH, and then take the first N nodes, and N is the node to which each PARTITION finally needs to be copied, depending on the number of BACKUP, EXCLUDE NEIGHBOR and other options

Calculate which PARTITION the KEY belongs to: the result of the allocation exists in the GridAffinityAssignment

There is a method in GridCacheContext.allowFastLocalRead to determine whether it can be quickly read locally:

Topology () .partitionState (localNodeId (), part) = = OWNING

The GridCacheContext.toCacheKeyObject method converts key to KeyCacheObject and assigns partition. Refer to IgniteCacheObjectProcessorImpl.partition

Read the data:

The GridPartitionedSingleGetFuture.mapKeyToNode method gets the node from which the data is read

Internal calls to GridCacheAffinityManager.partition and GridCacheAffinityManager.nodesByPartition

Then read the data from the first one that gets the NODE list by default

The new node will automatically re-REBLANCE data after joining.

CacheAffinitySharedManager.onServerJoin

CacheAffinitySharedManager.initAffinityOnNodeJoin

Check whether rebalance completes CacheAffinitySharedManager.checkRebalanceState

Partition status MOVING, OWNING, RENTING, EVICTED, LOST

OWNING indicates that the partition belongs to the primary node

RENTING indicates that after the topology has changed

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report