agura commented on a change in pull request #6976: IGNITE-6804 Warning if
unordered map used in locking cache operation.
URL: https://github.com/apache/ignite/pull/6976#discussion_r374111535
##########
File path:
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
##########
@@ -5176,6 +5198,91 @@ protected final void validateCacheKeys(Iterable<?>
keys) {
}
}
+ /**
+ * Checks that given map is sorted or otherwise constant order, or
processed inside deadlock-detecting transaction.
+ *
+ * Issues developer warning otherwise.
+ *
+ * @param m Map to examine.
+ */
+ protected void checkKeysOrdered(Map m, BulkOperation op) {
+ if (m == null || m.size() <= 1)
+ return;
+
+ if (m instanceof SortedMap || m instanceof GridSerializableMap)
+ return;
+
+ if (curTxDeadlockDetecting(op))
+ return;
+
+ LT.warn(log, "Unordered map " + m.getClass().getSimpleName() +
Review comment:
I think it would be better to log FQDN for map class. There are many
libraries where class names will differ only by package names. It would be
helpfull because we doesn't log any stack trace that could help determine exact
place of map usage in the code.
The same is for method with `Collection` parameter.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services