Stefan Egli created OAK-9130:
--------------------------------

             Summary: DocumentDiscoveryLiteService.hasBacklog regression 
(inverted version check)
                 Key: OAK-9130
                 URL: https://issues.apache.org/jira/browse/OAK-9130
             Project: Jackrabbit Oak
          Issue Type: Bug
          Components: documentmk
    Affects Versions: 1.16.0, 1.14.0, 1.10.3, 1.8.13
            Reporter: Stefan Egli
            Assignee: Stefan Egli


It looks like OAK-8139 has introduced a regression in the version check logic 
of DocumentDiscoveryLiteService.hasBacklog :

[Before the 
change|https://github.com/apache/jackrabbit-oak/blame/65f45f7c11d52f76e72645df968f16e4f990fea0/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentDiscoveryLiteService.java#L514]
 the logic was:
{noformat}
                    Version actual = Version.parseVersion((String) oakVersion);
                    Version introduced = Version.parseVersion("1.3.5");
                    if (actual.compareTo(introduced)>=0) {
                        warn = true;
                    }
{noformat}

[After the 
change|https://github.com/apache/jackrabbit-oak/blob/jackrabbit-oak-1.10.6/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentDiscoveryLiteService.java#L514]
 the logis is:
{noformat}
                    warn = versionPredates("1.3.5", (String) oakVersion);
{noformat}
with {{versionPredates}} logic as follows:
{noformat}
    static boolean versionPredates(String base, String compare) {
        Version one = Version.parseVersion(substSnapshotPrefix(compare));
        Version two = Version.parseVersion(substSnapshotPrefix(base));
        return two.compareTo(one) > 0;
    }
{noformat}

The behaviour of {{versionPredates}} can eg. be easily seen in the test:
{noformat}
assertTrue(DocumentDiscoveryLiteService.versionPredates("1.3.5", "1.0.0"));
{noformat}

So before the change the log.warn would be issued for versions *newer or equal* 
to 1.3.5, where as after the change the log.warn is issued for versions *lower* 
than 1.3.5.

This inverts only the log.warn filtering with no other side-effects.

/cc [~reschke]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to