Alexander Kolbasov created SENTRY-1931:
------------------------------------------

             Summary: NameNode only gets full snapshot once
                 Key: SENTRY-1931
                 URL: https://issues.apache.org/jira/browse/SENTRY-1931
             Project: Sentry
          Issue Type: Bug
          Components: Sentry
    Affects Versions: 2.0.0
            Reporter: Alexander Kolbasov
            Assignee: Sergio Peña
             Fix For: 2.0.0


SENTRY-1815 introduced the notion of ImageID, but it turns out that it doesn't 
work quite as expected.

The problem is that when we send partial update the image number isn't set:

{code}
  public List<PathsUpdate> retrieveDelta(long seqNum) throws Exception {
      ...
      List<PathsUpdate> updates = new ArrayList<>(mSentryPathChanges.size());
      for (MSentryPathChange mSentryPathChange : mSentryPathChanges) {
        // Gets the changeID from the persisted MSentryPathChange.
        long changeID = mSentryPathChange.getChangeID();
        // Creates a corresponding PathsUpdate and deserialize the
        // persisted delta update in JSON format to TPathsUpdate with
        // associated changeID.
        PathsUpdate pathsUpdate = new PathsUpdate();
        pathsUpdate.JSONDeserialize(mSentryPathChange.getPathChange());
        pathsUpdate.setSeqNum(changeID);
        updates.add(pathsUpdate);
      }
      return updates;
    }
  }
{code}

When it isn't set, thrift uses -1 as the default (as specified in our Thrift 
file).

The code in {{UpdateableAuthzPaths.updatePartial}} does this:

{code}
  @Override
  public void updatePartial(Iterable<PathsUpdate> updates, ReadWriteLock lock) {
      for (PathsUpdate update : updates) {
        applyPartialUpdate(update);
        seqNum.set(update.getSeqNum());
        imgNum.set(update.getImgNum()); // Here
      }
  }
{code}

so we set imgNum to -1 when we receive any partial update and then we always 
request for all updates from -1 and never receive a full update.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to