Re: [PR] IGNITE-25572 v2 draft [ignite-3]

2025-07-25 Thread via GitHub


lowka closed pull request #6257: IGNITE-25572 v2 draft
URL: https://github.com/apache/ignite-3/pull/6257


-- 
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]



Re: [PR] IGNITE-25572 v2 draft [ignite-3]

2025-07-16 Thread via GitHub


lowka commented on code in PR #6257:
URL: https://github.com/apache/ignite-3/pull/6257#discussion_r2209915120


##
modules/runner/src/test/java/org/apache/ignite/internal/configuration/compatibility/framework/Comp2.java:
##
@@ -0,0 +1,447 @@
+package org.apache.ignite.internal.configuration.compatibility.framework;
+
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Optional;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.stream.Collectors;
+import 
org.apache.ignite.internal.configuration.compatibility.GenerateConfigurationSnapshot;
+import 
org.apache.ignite.internal.configuration.compatibility.framework.ConfigNode.NodeReference;
+import 
org.apache.ignite.internal.configuration.compatibility.framework.ConfigurationTreeComparator.ComparisonContext;
+import org.apache.ignite.internal.logger.IgniteLogger;
+import org.apache.ignite.internal.logger.Loggers;
+import org.apache.ignite.internal.util.CollectionUtils;
+
+public class Comp2 {
+
+private static final IgniteLogger LOG = 
Loggers.forClass(GenerateConfigurationSnapshot.class);
+
+private final ComparisonContext comparisonContext;
+
+public Comp2() {
+this.comparisonContext = new ComparisonContext();
+}
+
+public Comp2(ComparisonContext comparisonContext) {
+this.comparisonContext = comparisonContext;
+}
+
+public void ensureCompatible(List previousRoots, 
List currentRoots) {
+Map> previousRootsByKind = 
groupByKind(previousRoots);
+Map> currentRootsByKind = 
groupByKind(currentRoots);
+
+// Compare configuration kinds
+if (!previousRootsByKind.keySet().equals(currentRootsByKind.keySet())) 
{
+String error = format("Configuration kind do not match. Expected: 
{} but got {}",
+previousRootsByKind.keySet(),
+currentRootsByKind.keySet()
+);
+
+throw new IllegalStateException(error);
+}
+
+// Then compare roots one by one
+for (Entry> entry : 
previousRootsByKind.entrySet()) {
+Map prev = entry.getValue();
+Map current = 
currentRootsByKind.get(entry.getKey());
+
+compareConfigRoots(prev, current);
+}
+}
+
+private void compareConfigRoots(Map previousRoots, 
Map currentRoots) {
+Set removed = 
CollectionUtils.difference(previousRoots.keySet(), currentRoots.keySet());
+
+// Check config roots
+if (!removed.isEmpty()) {
+String error = format("Incompatible change. Some of the root keys 
has been removed.\n"
++ "Removed root keys: {}\n"
++ "Previous root keys: {}\n"
++ "Current root keys: {}\n",
+removed, previousRoots.keySet(), currentRoots.keySet());
+
+throw new IllegalStateException(error);
+}
+
+for (Map.Entry e : previousRoots.entrySet()) {
+ConfigNode current = currentRoots.get(e.getKey());
+if (current == null) {

Review Comment:
   I should check new roots like:
   ```
List errors = new ArrayList<>();
   for (String key : CollectionUtils.diff(currentRoots, prevousRoot)) {
   ConfigNode current = currentRoots.get(key);
   Map> paths = buildPaths(current);
   validateAdded(paths, paths.keySet(), errors);
   }
   reportErrors(errors);
   ```



-- 
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]



[PR] IGNITE-25572 v2 draft [ignite-3]

2025-07-16 Thread via GitHub


lowka opened a new pull request, #6257:
URL: https://github.com/apache/ignite-3/pull/6257

   Thank you for submitting the pull request.
   
   To streamline the review process of the patch and ensure better code quality
   we ask both an author and a reviewer to verify the following:
   
   ### The Review Checklist
   - [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. 
Also make sure to complete the following:  
   \- 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 description of the JIRA ticket explains WHAT was made, WHY and HOW.  
   \- The pull request title is treated as the final commit message. The 
following pattern must be used: IGNITE- Change summary where  - number 
of JIRA issue.
   - [ ] **Design:** new code conforms with the design principles of the 
components it is added to.
   - [ ] **Patch quality:** patch cannot be split into smaller pieces, its size 
must be reasonable.
   - [ ] **Code quality:** code is clean and readable, necessary developer 
documentation is added if needed.
   - [ ] **Tests code quality:** test set covers positive/negative scenarios, 
happy/edge cases. Tests are effective in terms of execution time and resources.
   
   ### Notes
   - [Apache Ignite Coding 
Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)


-- 
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]