Uploaded image for project: 'Grouper'
  1. Grouper
  2. GRP-3951

failsafe not working if no groups returned

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • 2.6.9
    • None
    • None
    • None

    Description

      Joel Rettinger  3:33 PM
      After upgrading to 2.6.8 from 2.6.5, loader jobs of type SQL_GROUP_LIST, including the recent memberships loader and the recent memberships change log consumer, are throwing SQL errors when the group query doesn't return any groups:
      java.lang.RuntimeException: org.postgresql.util.PSQLException: ERROR: syntax error at or near ")"
        Position: 214,
      sql: select count(1) from grouper_memberships gm, grouper_groups gg, grouper_fields gf  where gm.mship_type = 'immediate' and gg.id = gm.owner_group_id  and gf.id = gm.field_id and gf.name = 'members' and gg.name  in (), 
          at edu.internet2.middleware.grouperClient.jdbc.GcDbAccess.callbackResultSet(GcDbAccess.java:2362)
          at edu.internet2.middleware.grouperClient.jdbc.GcDbAccess.selectList(GcDbAccess.java:1759)
          at edu.internet2.middleware.grouperClient.jdbc.GcDbAccess.selectList(GcDbAccess.java:1633)
          at edu.internet2.middleware.grouperClient.jdbc.GcDbAccess.select(GcDbAccess.java:1583)
          at edu.internet2.middleware.grouper.app.loader.GrouperLoaderType.syncGroupList(GrouperLoaderType.java:1631)
      ....
      The recent memberships error goes away if I set up a group with a recent memberships group and loader. If I then delete the recent memberships group, the error comes back.
      Oddly this only happens in one of our 2 test environments. I tried deleting the grouperRecentMembershipsLoader group and let it get recreated, in both environments, but that didn't change the state of errors/no-errors for those jobs in either environment.
      Is there a configuration or setup I'm missing? I ran all the tasks mentioned in the upgrade notes.
      I think the issue may be in the GrouperUtil.batchNumberOfBatches method, which always returns at least "1" because of the rounding down of the int value "(count - 1) / batchSize" ? - maybe just return zero if count == 0 also.
        public static int batchNumberOfBatches(int count, int batchSize) {
          if (batchSize == 0)

      {       return 0;     }

          int batches = 1 + ((count - 1) / batchSize);
          return batches;

        }
      in gsh:
      groovy:000> GrouperUtil.batchNumberOfBatches(0,800)
      ===> 1

      Attachments

        Activity

          People

            chris.hyzer@at.internet2.edu Chris Hyzer (upenn.edu)
            chris.hyzer@at.internet2.edu Chris Hyzer (upenn.edu)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: