Uploaded image for project: 'Apache Helix'
  1. Apache Helix
  2. HELIX-572

External view is recreated every time for bucketized resource

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 0.7.1, 0.6.4
    • 0.6.5
    • helix-core
    • None

    Description

      If the resource is bucketized, controller first deletes the existing external view and then recreates it. First of all this is inefficient and triggers a lot of unwanted changes.

      The code is i here ZKHelixDataAccessor

         case EXTERNALVIEW:
              if (value.getBucketSize() == 0) {
                records.add(value.getRecord());
              } else {
                _baseDataAccessor.remove(path, options);
      

      Second, the external view change listeners stops listening to further changes. This may or may not happen all the time, but the probability of occurrence is pretty high.

      After EV is deleted, the listener gets a callback. The callback is handled by zkcallbackhandler. When it gets a callback, it tries to set the watch again but the path may or may not exist (depending on how fast the controller recreated the external view). If the path exists there is not problem, but if it does not, we assume that the parent node is deleted and remove the listener and invoke FINALIZE. Again this would not have happened if the resource was not bucketized.

      @Override
        public void handleChildChange(String parentPath, List<String> currentChilds) {
          try {
            updateNotificationTime(System.nanoTime());
            if (parentPath != null && parentPath.startsWith(_path)) {
              NotificationContext changeContext = new NotificationContext(_manager);
      
              if (currentChilds == null) {
                // parentPath has been removed
                if (parentPath.equals(_path)) {
                  // _path has been removed, remove this listener
                  _manager.removeListener(_propertyKey, _listener);
                }
                changeContext.setType(NotificationContext.Type.FINALIZE);
              } else {
                changeContext.setType(NotificationContext.Type.CALLBACK);
              }
              changeContext.setPathChanged(_path);
              invoke(changeContext);
            }
          } catch (Exception e) {
            String msg =
                "exception in handling child-change. instance: " + _instanceName + ", parentPath: "
                    + parentPath + ", listener: " + _listener;
            ZKExceptionHandler.getInstance().handle(msg, e);
          }
      
      

      Attachments

        Activity

          People

            k4j kishore gopalakrishna
            k4j kishore gopalakrishna
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: