Index: oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/OakEventFilterImpl.java
===================================================================
--- oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/OakEventFilterImpl.java	(revision 1782298)
+++ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/OakEventFilterImpl.java	(working copy)
@@ -384,35 +384,46 @@
         return includeAncestorRemove;
     }
 
+    /**
+     * This helper method goes through the provided globPath and adds
+     * each parent (ancestor)'s path to the ancestorPaths set.
+     * <p>
+     * OAK-5619 : this used to add "parent/*" type ancestor paths, however
+     * that was wrong: we must take the actual parents to which we want
+     * to listen to. The glob case looks slightly different:
+     * <ul>
+     *  <li>* : we treat this as a normal name</li>
+     *  <li>**: when a ** is hit, the loop through the elements can be stopped,
+     *  as ** includes all children already, so no further paths are needed.</li>
+     * </ul>
+     * @param ancestorPaths the set to which the ancestors of globPath will
+     * be added to
+     * @param globPath the input path that may contain globs
+     */
     static void addAncestorPaths(Set<String> ancestorPaths, String globPath) {
         if (globPath == null || !globPath.contains("/")) {
             return;
         }
-        // from /a/b/c         => add /*, /a/* and /a/b/*
-        // from /a/b/**        => add /*, /a/*
-        // from /a             => add /*, nothing
+        // from /a/b/c         => add /a, /a/b, /a/b/c
+        // from /a/b/**        => add /a, /a/b, /a/b/**
+        // from /a             => add /a
         // from /              => add nothing
-        // from /a/b/**/*.html => add /*, /a/*
-        // from /a/b/*/*.html  => add /*, /a/*
+        // from /a/b/**/*.html => add /a, /a/b, /a/b/**
+        // from /a/b/*/*.html  => add /a, /a/b, /a/b/*, /a/b/*/*.html
+        // from /a/b/*/d       => add /a, /a/b, /a/b/*, /a/b/*/d
+        // from /a/b/*/d/e     => add /a, /a/b, /a/b/*, /a/b/*/d, /a/b/*/d/e
 
         Iterator<String> it = PathUtils.elements(globPath).iterator();
         StringBuffer sb = new StringBuffer();
-        if (it.hasNext()) {
-            ancestorPaths.add("/*");
-        }
         while(it.hasNext()) {
             String element = it.next();
-            if (element.contains("*")) {
-                if (ancestorPaths.size() > 0) {
-                    ancestorPaths.remove(ancestorPaths.size()-1);
-                }
+            sb.append("/");
+            sb.append(element);
+            ancestorPaths.add(sb.toString());
+            if (element.equals("**")) {
+                // then we can stop as ** contains everything already
                 break;
-            } else if (!it.hasNext()) {
-                break;
             }
-            sb.append("/");
-            sb.append(element);
-            ancestorPaths.add(sb.toString() + "/*");
         }
     }
 
Index: oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/OakEventFilterImplTest.java
===================================================================
--- oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/OakEventFilterImplTest.java	(revision 1782298)
+++ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/OakEventFilterImplTest.java	(working copy)
@@ -33,17 +33,17 @@
         assertMatches(new String[] {}, "/");
         
         assertMatches(new String[] {"/*"}, "/*");
-        assertMatches(new String[] {"/*"}, "/**");
-        assertMatches(new String[] {"/*"}, "/a");
-        assertMatches(new String[] {"/*", "/a/*"}, "/a/b");
-        assertMatches(new String[] {"/*", "/a/*"}, "/a/*");
-        assertMatches(new String[] {"/*", "/a/*"}, "/a/**");
-        assertMatches(new String[] {"/*", "/a/*", "/a/b/*"}, "/a/b/c");
-        assertMatches(new String[] {"/*", "/a/*", "/a/b/*"}, "/a/b/*");
-        assertMatches(new String[] {"/*", "/a/*", "/a/b/*"}, "/a/b/**");
-        assertMatches(new String[] {"/*", "/a/*", "/a/b/*", "/a/b/c/*"}, "/a/b/c/d");
-        assertMatches(new String[] {"/*", "/a/*", "/a/b/*", "/a/b/c/*"}, "/a/b/c/*");
-        assertMatches(new String[] {"/*", "/a/*", "/a/b/*", "/a/b/c/*"}, "/a/b/c/**");
+        assertMatches(new String[] {"/**"}, "/**");
+        assertMatches(new String[] {"/a"}, "/a");
+        assertMatches(new String[] {"/a", "/a/b"}, "/a/b");
+        assertMatches(new String[] {"/a", "/a/*"}, "/a/*");
+        assertMatches(new String[] {"/a", "/a/**"}, "/a/**");
+        assertMatches(new String[] {"/a", "/a/b", "/a/b/c"}, "/a/b/c");
+        assertMatches(new String[] {"/a", "/a/b", "/a/b/*"}, "/a/b/*");
+        assertMatches(new String[] {"/a", "/a/b", "/a/b/**"}, "/a/b/**");
+        assertMatches(new String[] {"/a", "/a/b", "/a/b/c", "/a/b/c/d"}, "/a/b/c/d");
+        assertMatches(new String[] {"/a", "/a/b", "/a/b/c", "/a/b/c/*"}, "/a/b/c/*");
+        assertMatches(new String[] {"/a", "/a/b", "/a/b/c", "/a/b/c/**"}, "/a/b/c/**");
     }
 
     private void assertMatches(String[] expectedPaths, String globPath) {
Index: oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java
===================================================================
--- oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java	(revision 1782350)
+++ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationTest.java	(working copy)
@@ -108,7 +108,6 @@
 import org.apache.jackrabbit.oak.plugins.observation.filter.Selectors;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -1547,7 +1546,6 @@
      * NOT to get any event if an unrelated parent is removed
      */
     @Test
-    @Ignore("OAK-5619")
     public void includeAncestorsRemove_Unrelated() throws Exception {
         doIncludeAncestorsRemove_Unrelated(
                 new String[] {"/a/b/c/d"}, 
@@ -2299,7 +2297,7 @@
         oef.withIncludeAncestorsRemove()
                 .withNodeTypeAggregate(new String[] { "oak:Unstructured" }, new String[] { "", "jcr:content" } )
                 .withIncludeGlobPaths("/**/*.jsp");
-        doTestAggregate6(oef, new String[] {"/"}, new String[] {"/*", "/**/*.jsp", "/**/*.jsp/**"});
+        doTestAggregate6(oef, new String[] {"/"}, new String[] {"/**", "/**/*.jsp", "/**/*.jsp/**"});
 
         oef = FilterFactory.wrap(new JackrabbitEventFilter());
         oef.setEventTypes(ALL_EVENTS);
@@ -2307,14 +2305,14 @@
         oef.withIncludeAncestorsRemove()
                 .withNodeTypeAggregate(new String[] { "oak:Unstructured" }, new String[] { "", "jcr:content" } )
                 .withIncludeGlobPaths("/**/*.jsp");
-        doTestAggregate6(oef, new String[] {"/"}, new String[] {"/*", "/**/*.jsp", "/**/*.jsp/**"});
+        doTestAggregate6(oef, new String[] {"/"}, new String[] {"/**", "/**/*.jsp", "/**/*.jsp/**"});
         
         oef = FilterFactory.wrap(new JackrabbitEventFilter());
         oef.setEventTypes(ALL_EVENTS);
         oef.withIncludeAncestorsRemove()
                 .withNodeTypeAggregate(new String[] { "oak:Unstructured" }, new String[] { "", "jcr:content" } )
                 .withIncludeGlobPaths("**/*.jsp");
-        doTestAggregate6(oef, new String[] {"/"}, new String[] {"/*", "**/*.jsp", "**/*.jsp/**"});
+        doTestAggregate6(oef, new String[] {"/"}, new String[] {"/**", "**/*.jsp", "**/*.jsp/**"});
 
         oef = FilterFactory.wrap(new JackrabbitEventFilter());
         oef.setEventTypes(ALL_EVENTS);
@@ -2335,7 +2333,7 @@
         oef.withIncludeAncestorsRemove()
                 .withNodeTypeAggregate(new String[] { "oak:Unstructured" }, new String[] { "", "jcr:content" } )
                 .withIncludeGlobPaths("/parent/**/*.jsp");
-        doTestAggregate6(oef, new String[] {"/"}, new String[] {"/*", "/parent/*", "/parent/**/*.jsp", "/parent/**/*.jsp/**"});
+        doTestAggregate6(oef, new String[] {"/"}, new String[] {"/parent", "/parent/**", "/parent/**/*.jsp", "/parent/**/*.jsp/**"});
         
         oef = FilterFactory.wrap(new JackrabbitEventFilter());
         oef.setEventTypes(ALL_EVENTS);
@@ -2356,7 +2354,7 @@
         oef.withIncludeAncestorsRemove()
                 .withNodeTypeAggregate(new String[] { "oak:Unstructured" }, new String[] { "", "jcr:content" } )
                 .withIncludeGlobPaths("/parent/**/*.jsp", "/foo/bar/**");
-        doTestAggregate6(oef, new String[] {"/"}, new String[] {"/*", "/foo/*", "/foo/bar/*", "/foo/bar/**", "/parent/*", "/parent/**/*.jsp", "/parent/**/*.jsp/**"});
+        doTestAggregate6(oef, new String[] {"/"}, new String[] {"/parent", "/foo", "/foo/bar", "/foo/bar/**", "/parent/**", "/parent/**/*.jsp", "/parent/**/*.jsp/**"});
     }
 
     private void doTestAggregate6(OakEventFilter oef, String[] expectedSubTrees, String[] expectedPrefilterPaths)
