tkalkirill commented on code in PR #1462:
URL: https://github.com/apache/ignite-3/pull/1462#discussion_r1055192159
##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/storage/state/TxStateStorage.java:
##########
@@ -122,9 +125,55 @@ public interface TxStateStorage extends ManuallyCloseable {
void close();
/**
- * Removes all data from the storage.
+ * Closes and removes all data from the storage.
*
- * @throws StorageException In case when the operation has failed.
+ * @throws IgniteInternalException with {@link
Transactions#TX_STATE_STORAGE_ERR} error code in case when the operation has
failed.
*/
void destroy();
+
+ /**
+ * Prepares the transaction state storage for a full rebalance: clears the
storage, sets the {@link #lastAppliedIndex()} and
+ * {@link #lastAppliedTerm()} to {@link #FULL_REBALANCE_IN_PROGRESS}, and
closes all cursors.
+ *
+ * <p>After calling this method, only write methods will be available, and
read methods with {@link #lastApplied(long, long)} 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.
Review Comment:
You're right, we can make it automatic at the start of the storage, I think
it's worth mentioning.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]