kishore gopalakrishna created HELIX-572:
-------------------------------------------

             Summary: External view is recreated every time for bucketized 
resource
                 Key: HELIX-572
                 URL: https://issues.apache.org/jira/browse/HELIX-572
             Project: Apache Helix
          Issue Type: Bug
          Components: helix-core
    Affects Versions: 0.6.4, 0.7.1
            Reporter: kishore gopalakrishna
            Assignee: kishore gopalakrishna
            Priority: Critical
             Fix For: 0.6.5, 0.7.2


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
{code}
   case EXTERNALVIEW:
        if (value.getBucketSize() == 0) {
          records.add(value.getRecord());
        } else {
          _baseDataAccessor.remove(path, options);
{code}

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.

{code}
@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);
    }

{code}












--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to