Skip to content

Conversation

@timoninmaxim
Copy link
Member

Thank you for submitting the pull request to the Apache Ignite.

In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:

The Contribution Checklist

  • There is a single JIRA ticket related to the pull request.
  • The web-link to the pull request is attached to the JIRA ticket.
  • The JIRA ticket has the Patch Available state.
  • The pull request body describes changes that have been made.
    The description explains WHAT and WHY was made instead of HOW.
  • The pull request title is treated as the final commit message.
    The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
  • A reviewer has been mentioned through the JIRA comments
    (see the Maintainers list)
  • The pull request has been checked by the Teamcity Bot and
    the green visa attached to the JIRA ticket (see TC.Bot: Check PR)

Notes

If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com #ignite channel.

}
});

// All active transactions that didn't log COMMITTED or ROLL_BACK records are considered committed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can transactions without WAL record be rolled back during node recovery?
In case node fails after incremental snapshot created but before TX_RECORD loged

/** Holder for parition hashes. */
private static class PartitionHashHolder {
/** */
private int hash;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like these fields should be long

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it as int, because PartitionHashRecordV2 stores hashes as int too: partHash, partVerHash.

}
};

short locShortId = blt.consistentIdMapping().get(consId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

locNodeId?

Map<PartitionKeyV2, PartitionHashHolder> partMap = new HashMap<>();
List<Exception> exceptions = new ArrayList<>();

BiConsumer<GridCacheVersion, Set<Short>> calcTransactionHash = (xid, partNodes) -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calcTxHash?

List<Exception> exceptions = new ArrayList<>();

BiConsumer<GridCacheVersion, Set<Short>> calcTransactionHash = (xid, partNodes) -> {
for (short shortId: partNodes) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nodeId?

Map<GridCacheVersion, Set<Short>> txPrimPartNodes = new HashMap<>();
Map<Short, PartitionHashHolder> nodesTxHash = new HashMap<>();

Set<GridCacheVersion> partialCommittedTxs = new HashSet<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

partiallyCommittedTxs here and in all other places?

Map<Short, PartitionHashHolder> nodesTxHash = new HashMap<>();

Set<GridCacheVersion> partialCommittedTxs = new HashSet<>();
Map<PartitionKeyV2, PartitionHashHolder> partMap = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add comment that hashes in this map calculated based on WAL records, not part-X.bin data so they will differs from idle_verify produced hashes.

hash.increment(valHash, verHash);
}
catch (IgniteCheckedException ex) {
exceptions.add(ex);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to continue task in case of any error?
Looks like we can just skip all further actions like:

                proc.process(dataEntry -> {
                    if (dataEntry.op() == GridCacheOperation.READ || !exceptions.isEmpty())
                        return;

...

                }, txRec -> {
                    if (!exceptions.isEmpty())
                         return;

                    if (log.isDebugEnabled())
                        log.debug("Checking tx record [txRec=" + txRec + ']');

/** Transaction hashes collection. */
private Map<Object, TransactionsHashRecord> txHashRes;

/** Partition hashes collection. It is calculated on data entries included into only incremental part of snapshot. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Partition hashes collection. It is calculated on data entries included into only incremental part of snapshot. */
/**
* Partition hashes collection.
* Hash of data entries({@link DataEntry}) from WAL segments included in incremental snapshot.
*/

null)
));

return new IncrementalSnapshotVerificationTaskResult(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's locally log verification results here on info level.
Including number of dataEntry (proc.applied) and transactions

@timoninmaxim timoninmaxim force-pushed the IGNITE-18550__verify_inc_snp branch from addbcee to 91ccb4e Compare April 7, 2023 13:22
@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 8, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 58 Code Smells

0.0% 0.0% Coverage
1.0% 1.0% Duplication

@timoninmaxim timoninmaxim merged commit d0d3ead into apache:master Apr 8, 2023
@timoninmaxim timoninmaxim deleted the IGNITE-18550__verify_inc_snp branch April 8, 2023 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants