Uploaded image for project: 'Sentry (Retired)'
  1. Sentry (Retired)
  2. SENTRY-2185

Performance Issue: Saving MAuthzPathsMapping should be done in batch for path full snapshot

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.1.0
    • None
    • Sentry
    • None

    Description

      From the code below, for each MAuthzPathsMapping, there is a query to save each MAuthzPathsMapping instance. Need to save the changes in batch. 

        public void persistFullPathsImage(final Map<String, Collection<String>> authzPaths,
            final long notificationID) throws Exception {
          tm.executeTransactionWithRetry(
                  pm -> {
                    pm.setDetachAllOnCommit(false); // No need to detach objects
                    deleteNotificationsSince(pm, notificationID + 1);
      
                    // persist the notidicationID
                    pm.makePersistent(new MSentryHmsNotification(notificationID));
      
                    // persist the full snapshot
                    long snapshotID = getCurrentAuthzPathsSnapshotID(pm);
                    long nextSnapshotID = snapshotID + 1;
                    pm.makePersistent(new MAuthzPathsSnapshotId(nextSnapshotID));
                    LOGGER.info("Attempting to commit new HMS snapshot with ID = {}", nextSnapshotID);
                    for (Map.Entry<String, Collection<String>> authzPath : authzPaths.entrySet()) {
                      pm.makePersistent(new MAuthzPathsMapping(nextSnapshotID, authzPath.getKey(), authzPath.getValue()));
                    }
                    return null;
                  });
        }

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              linaataustin Na Li
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: