[ 
https://issues.apache.org/jira/browse/IGNITE-18022?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kirill Tkalenko updated IGNITE-18022:
-------------------------------------
    Description: 
Suggested API for a full rebalance for 
*org.apache.ignite.internal.tx.storage.state.TxStateStorage*:

{code:java}
public interface TxStateStorage extends ManuallyCloseable {
....
    long FULL_REBALANCE_IN_PROGRESS = -1;

    /**
     * Prepares the transaction state storage for a full rebalance: clears the 
storage, sets the {@link #lastAppliedIndex()} to
     * {@link #FULL_REBALANCE_IN_PROGRESS}, and closes all cursors.
     *
     * <p>After the complete of future, only write methods will be available, 
and read methods will throw {@link IgniteInternalException}.
     *
     * <p>This method must be called before every full rebalance of transaction 
state storage and ends with a call to one of the methods:
     * <ul>
     *     <li>{@link #abortFullRebalance()} - in case of errors or 
cancellation of a full rebalance;</li>
     *     <li>{@link #finishFullRebalance(long, long)} - in case of successful 
completion of a full rebalance.</li>
     * </ul>
     *
     * <p>If the {@link #lastAppliedIndex()} is {@link 
#FULL_REBALANCE_IN_PROGRESS} after a node restart, then the storage needs to be 
     * cleared before it can be used.
     *
     * @return Future of the start a full rebalance for transaction state 
storage.
     */
    CompletableFuture<Void> startFullRebalance();

    /**
     * Aborts a full rebalance for transaction state storage: clears the 
storage, sets the {@link #lastAppliedIndex()} to {@code 0}.
     *
     * <p>After the complete of future, methods for writing and reading will be 
available.
     *
     * <p>If a full rebalance has not started, then nothing will happen.
     *
     * @return Future of the abort a full rebalance for transaction state 
storage.
     */
    CompletableFuture<Void> abortFullRebalance();

    /**
     * Completes a full rebalance for transaction state storage: updates {@link 
#lastAppliedIndex()} and {@link #lastAppliedTerm()}.
     *
     * <p>After the complete of future, methods for writing and reading will be 
available.
     *
     * <p>If a full rebalance has not started, then nothing will happen.
     *
     * @param lastAppliedIndex Last applied index.
     * @param lastAppliedTerm Last applied term.
     * @return Future of the finish a full rebalance for transaction state 
storage.
     */
    CompletableFuture<Void> finishFullRebalance(long lastAppliedIndex, long 
lastAppliedTerm);
}
{code}

We will also need to write tests and make a test implementation.

The main idea is described in IGNITE-17990.

  was:
We need to create an API for a complete rebalance without losing user data in 
class *TxStateStorage* and *TxStateTableStorage* on receiver.

And also to make a test implementation and basic tests.

The main idea is described in IGNITE-17990.


> Creating an API for full rebalance without losing user data in TxStateStorage 
> on receiver
> -----------------------------------------------------------------------------------------
>
>                 Key: IGNITE-18022
>                 URL: https://issues.apache.org/jira/browse/IGNITE-18022
>             Project: Ignite
>          Issue Type: Task
>            Reporter: Kirill Tkalenko
>            Assignee: Kirill Tkalenko
>            Priority: Major
>              Labels: ignite-3
>             Fix For: 3.0.0-beta2
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Suggested API for a full rebalance for 
> *org.apache.ignite.internal.tx.storage.state.TxStateStorage*:
> {code:java}
> public interface TxStateStorage extends ManuallyCloseable {
> ....
>     long FULL_REBALANCE_IN_PROGRESS = -1;
>     /**
>      * Prepares the transaction state storage for a full rebalance: clears 
> the storage, sets the {@link #lastAppliedIndex()} to
>      * {@link #FULL_REBALANCE_IN_PROGRESS}, and closes all cursors.
>      *
>      * <p>After the complete of future, only write methods will be available, 
> and read methods will throw {@link IgniteInternalException}.
>      *
>      * <p>This method must be called before every full rebalance of 
> transaction state storage and ends with a call to one of the methods:
>      * <ul>
>      *     <li>{@link #abortFullRebalance()} - in case of errors or 
> cancellation of a full rebalance;</li>
>      *     <li>{@link #finishFullRebalance(long, long)} - in case of 
> successful completion of a full rebalance.</li>
>      * </ul>
>      *
>      * <p>If the {@link #lastAppliedIndex()} is {@link 
> #FULL_REBALANCE_IN_PROGRESS} after a node restart, then the storage needs to 
> be 
>      * cleared before it can be used.
>      *
>      * @return Future of the start a full rebalance for transaction state 
> storage.
>      */
>     CompletableFuture<Void> startFullRebalance();
>     /**
>      * Aborts a full rebalance for transaction state storage: clears the 
> storage, sets the {@link #lastAppliedIndex()} to {@code 0}.
>      *
>      * <p>After the complete of future, methods for writing and reading will 
> be available.
>      *
>      * <p>If a full rebalance has not started, then nothing will happen.
>      *
>      * @return Future of the abort a full rebalance for transaction state 
> storage.
>      */
>     CompletableFuture<Void> abortFullRebalance();
>     /**
>      * Completes a full rebalance for transaction state storage: updates 
> {@link #lastAppliedIndex()} and {@link #lastAppliedTerm()}.
>      *
>      * <p>After the complete of future, methods for writing and reading will 
> be available.
>      *
>      * <p>If a full rebalance has not started, then nothing will happen.
>      *
>      * @param lastAppliedIndex Last applied index.
>      * @param lastAppliedTerm Last applied term.
>      * @return Future of the finish a full rebalance for transaction state 
> storage.
>      */
>     CompletableFuture<Void> finishFullRebalance(long lastAppliedIndex, long 
> lastAppliedTerm);
> }
> {code}
> We will also need to write tests and make a test implementation.
> The main idea is described in IGNITE-17990.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to