[ 
https://issues.apache.org/jira/browse/GOBBLIN-2211?focusedWorklogId=975842&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-975842
 ]

ASF GitHub Bot logged work on GOBBLIN-2211:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 23/Jul/25 11:21
            Start Date: 23/Jul/25 11:21
    Worklog Time Spent: 10m 
      Work Description: NamsB7 commented on code in PR #4121:
URL: https://github.com/apache/gobblin/pull/4121#discussion_r2225230729


##########
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/troubleshooter/InMemoryMultiContextIssueRepository.java:
##########
@@ -46,6 +46,7 @@
 public class InMemoryMultiContextIssueRepository extends AbstractIdleService 
implements MultiContextIssueRepository {
   private final LRUMap<String, InMemoryIssueRepository> contextIssues;
   private final Configuration configuration;
+  private String _contextId;

Review Comment:
   Seems redundant, has been removed.



##########
gobblin-metastore/src/main/java/org/apache/gobblin/metastore/MysqlErrorPatternStore.java:
##########
@@ -279,64 +302,46 @@ public List<ErrorPatternProfile> 
getErrorPatternsByCategory(String categoryName)
   }
 
   @Override
-  public Category getDefaultCategory()
+  public ErrorCategory getDefaultCategory()
       throws IOException {
-    if (hasIsDefaultColumn()) {
-      Category cat = getDefaultCategoryFromIsDefault();
+    // 1. Try to use the configured default category name if set
+    if (configuredDefaultCategoryName != null && 
!configuredDefaultCategoryName.trim().isEmpty()) {
+      ErrorCategory cat = getErrorCategory(configuredDefaultCategoryName);
       if (cat != null) {
         return cat;
+      } else {
+        // Throw exception if configured category doesn't exist
+        throw new IOException(String.format(
+            "Configured default category '%s' not found in database",
+            configuredDefaultCategoryName));
       }
     }
-    // Fallback to previous logic: category with the highest priority (lowest 
priority number)
-    return getHighestPriorityCategory();
-  }
 
-  /**
-   * Returns the category with the highest priority, i.e. the lowest priority 
value (ascending order).
-   */
-  private Category getHighestPriorityCategory()
-      throws IOException {
-    try (Connection conn = dataSource.getConnection(); PreparedStatement ps = 
conn.prepareStatement(
-        String.format(GET_HIGHEST_ERROR_CATEGORY_STATEMENT, 
errorCategoriesTable))) {
-      try (ResultSet rs = ps.executeQuery()) {
-        if (rs.next()) {
-          return new Category(rs.getString(1), rs.getInt(2));
-        }
-      }
-    } catch (SQLException e) {
-      throw new IOException("Failed to get category", e);
+    // 2. No configuration provided - use lowest priority category as fallback
+    ErrorCategory lowestPriorityCategory = getLowestPriorityCategory();
+    if (lowestPriorityCategory == null) {
+      throw new IOException("No error categories found in database");
     }
-    return null;
-  }
 
-  /**
-   * Checks if the is_default column exists in the categories table.
-   */
-  private boolean hasIsDefaultColumn()
-      throws IOException {
-    try (Connection conn = dataSource.getConnection()) {
-      try (ResultSet rs = conn.getMetaData().getColumns(null, null, 
errorCategoriesTable, "is_default")) {
-        return rs.next();
-      }
-    } catch (SQLException e) {
-      throw new IOException("Failed to check for is_default column", e);
-    }
+    log.debug("No default category configured, using lowest priority category: 
{}",
+        lowestPriorityCategory.getCategoryName());
+    return lowestPriorityCategory;
   }
 
   /**
-   * Returns the default category using is_default column, or null if not 
found.
+   * Returns the category with the lowest priority, i.e. the highes priority 
value (descending order).

Review Comment:
   corrected.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 975842)
    Time Spent: 4h 20m  (was: 4h 10m)

> Implement Error Classification based on execution issues
> --------------------------------------------------------
>
>                 Key: GOBBLIN-2211
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-2211
>             Project: Apache Gobblin
>          Issue Type: Bug
>          Components: gobblin-service
>            Reporter: Abhishek Jain
>            Assignee: Abhishek Tiwari
>            Priority: Major
>          Time Spent: 4h 20m
>  Remaining Estimate: 0h
>
> Implement Error Classification to categorize the failure reason based on 
> issues encountered.



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

Reply via email to