...
- The approach will require a new temporary FilePageStore to be initialized. It must be created as a part of the temporary cache group or in the separate temporary data region to provide reusing machinery of iteration over the full partition file.
Proposed Changes (Hot swap
...
with historical rebalance)
Process Overview
In the process of balancing data:
- demaner Demander (receiver of partition files)
- supplier Supplier (sender of partition files).
The whole process is described in terms of rebalance single cache group and partition files rebalancing a single partition file of a cache group. All the other partitions would be rebalanced one-by-one:.
- NODE_JOIN event occurrs and the blocking PME starts;
- The Demander decides which partitions must be loaded. All the desired partitions have MOVING state;
- The Demander initiates a new checkpoint process;
- Under the checkpoint write-lock it swaps cache data storage with the temporary one for each partition of the given set;
- The temporary cache data storage tracks partition counter number as ususal (on each cache operations);
- Wait for the checkpoint begin future ends;
- The Demander sends a request to the Supplier with the previously prepares set of cache groups and partition files;
- The Supplier receives a request and starts a new local checkpoint process;
- Creates a temporary file with .delta postfix (for each partition file e.g. part-0.bin.delta);
- Under checkpoint write lock fixes the partition expected file size (at the moment of the checkpoint end);
- Wait for the checkpoint begin future ends;
- Starts the copy process of the partition file to the Demander;
- Opens the partition file in read-only mode;
- Starts sending partition file (with any concurrent writes) by chunks of predefined size;
- Asynchronouosly writes each page to the partition file and the same page to the corresponding file with .delta postfix;
- When the partition file sent it starts sending corresponding .delta file;
- The Demander listens new file sending attempts from the Supplier;
- The Demander receives partition file (for each partition file one by one);
- The Demander reads corresponding partition .delta file by chunks and applies them on the received partiton file;
- When the Demander receives the whole cache partition file;
- Swap the temporary cache data storage with the original one on the next checkpoint (under write lock);
- When the partition has been swapped it starts the rebuild indexes procedure over given partition files;
- Starts historical rebalance for the given partition file;
- The Supplier deletes
- The demander node prepares the set of IgniteDhtDemandedPartitionsMap#full cache partitions to fetch;
- The demander node checks compatibility version (for example, 2.8) and starts recording all incoming cache updates to the new special storage – the temporary WAL storage;
- The demander node sends the GridDhtPartitionDemandMessage to the supplier node as usual;
- The supplier node receives GridDhtPartitionDemandMessage and starts the new checkpoint process and fixes cache partition file sizes;
- The supplier node creates an empty temporary file with .delta (e.g. part-0.bin.delta file) postfix for each cache partition file (in the same cache working directory or another configured);
- The supplier node starts tracking each pageId write attempt to these partition files
- When the write attempt happens, the thread that caused it reads the original copy of this page from the partition and flushes it to the corresponding .delta file;
- After it the thread writes the changed page data to the partition file;
- The supplier waits the checkpoint process ends;
- On the supplier for each cache partition file
- The process opens the partition file in read-only mode;
- Starts sending partition file (as it is with any concurrent writes) by chunks of predefined constant size (multiple of PageMemory size);
- After the partition file sent it starts sending corresponding .delta file;
- The demander node starts to listen to new type of incoming connections (a socket channel created event) from the supplier node;
- When the appropriate connection established the demander node for each cache partition file
- Receives file metadata information (corresponding cache group identifier, cache partition file name, file size)
- Writes data from the socket to the particular cache partition file from the beginning of the file
- After the original cache partition file received the node starts receiving corresponding .delta file
- The node reads data from the socket by chunks of PageMemory size and applies each received pageId to the partition file
- When the demander node receives the whole cache partition file
- The node begins the rebuild secondary indexes procedure over received partition file
- After it the thread begins to apply for data entries from the beginning of WAL-temporary storage;
- All async operations corresponding to this partition file still write to the end of temporary WAL;
- At the moment of WAL-temporary storage is ready to be empty
- Start the first checkpoint;
- Wait for the first checkpoint ends and own the cache partition;
- All operations now are switched to the partition file instead of writing to the temporary WAL;
- Schedule the temporary WAL storage deletion;
- The supplier node deletes all temporary files;
Components
...