Author: mreutegg Date: Wed Nov 22 16:33:50 2017 New Revision: 1816067 URL: http://svn.apache.org/viewvc?rev=1816067&view=rev Log: OAK-4518: ConcurrentAddReferenceTest fails occasionally
Merged revisions 1750656,1753481 from trunk Added: jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentReadAndAddTest.java - copied, changed from r1750656, jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentReadAndAddTest.java Modified: jackrabbit/oak/branches/1.4/ (props changed) jackrabbit/oak/branches/1.4/oak-core/ (props changed) jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractJournalTest.java jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGCDeletionTest.java jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/JournalIT.java Propchange: jackrabbit/oak/branches/1.4/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Nov 22 16:33:50 2017 @@ -1,4 +1,4 @@ /jackrabbit/oak/branches/1.0:1665962 /jackrabbit/oak/branches/1.6:1802566 -/jackrabbit/oak/trunk:1733615,1733875,1733913,1733929,1734230,1734254,1734279,1734941,1735052,1735081,1735109,1735141,1735267,1735405,1735484,1735549,1735564,1735588,1735622,1735638,1735919,1735983,1736176,1737309-1737310,1737334,1737349,1737998,1738004,1738136,1738138,1738207,1738234,1738252,1738775,1738795,1738833,1738950,1738957,1738963,1739712,1739760,1739867,1739894,1739959-1739960,1740114,1740116,1740250,1740333,1740349,1740360,1740625-1740626,1740774,1740837,1740879,1740971,1741016,1741032,1741339,1741343,1742077,1742117,1742125,1742363,1742520,1742888,1742916,1743097,1743172,1743343,1743674,1744265,1744292,1744589,1744670,1744672,1744959,1745038,1745127,1745197,1745336,1745368,1746086,1746117,1746342,1746345,1746408,1746634,1746696,1746981,1747198,1747200,1747341-1747342,1747380,1747387,1747406,1747492,1747512,1747654,1748505,1748553,1748722,1748870,1749275,1749350,1749424,1749443,1749464,1749475,1749645,1749662,1749815,1749872,1749875,1749899,1750052,1750076-1750077,1750287 ,1750457,1750462,1750465,1750495,1750626,1750809,1750886-1750887,1751396,1751410,1751419,1751445-1751446,1751478,1751748,1751753,1751755,1751871,1752198,1752202,1752259,1752273-1752274,1752283,1752292,1752438,1752447-1752448,1752508,1752596,1752616,1752659,1752672,1753262,1753331-1753332,1753335-1753336,1753355,1753444,1754117,1754239,1755157,1755191,1756505-1756506,1756520,1756580,1757119,1757166,1758213,1758713,1759433,1759754,1759795,1759826,1760326,1760340,1760373,1760387,1760486,1760492,1760494,1760661-1760662,1760677,1760701,1760709,1760946,1761412,1761444,1761571,1761762,1761787,1761866,1761876,1762453,1762463,1762612,1762632,1762635,1762825,1763347,1763355-1763356,1763378,1763465,1763735,1764475,1764678,1764705,1764814,1764898,1765817,1765983,1766071,1766390,1766423,1766496,1766519,1766554,1766644,1767025,1767265,1767502,1767704,1768446,1768637,1769078,1769939-1769940,1770694,1770982,1771022,1771093,1771098,1771739,1771852,1771870,1771902,1772155,1772162,1772228,1772593,1772 768,1772906,1773190,1774141,1774256,1774497,1774787,1775474,1775622,1775628,1775757,1778112,1778423,1778968,1779137,1779478,1780388,1780424,1780538,1780543,1781068,1781075,1781386,1781846,1781907,1782476,1782966,1783066,1783089,1783104-1783105,1783110,1783619,1783720,1783738,1783773,1783855,1783891,1784023,1784034,1784130,1784251,1784551,1784574,1784689,1785283,1785838,1785946,1787074,1787217,1787425,1789056,1792463,1792742,1793013,1793088,1793644,1795314,1795330,1795475,1795488,1795491,1795613,1795618,1796144,1798035,1798834,1799219,1799389,1799924,1800974,1801011,1801013,1802548,1802973,1803026,1807308,1808125,1808128,1808142,1808240,1808246,1809024,1809026,1809163,1811380,1811655,1811952,1811963,1811986,1814189,1814332,1814397 +/jackrabbit/oak/trunk:1733615,1733875,1733913,1733929,1734230,1734254,1734279,1734941,1735052,1735081,1735109,1735141,1735267,1735405,1735484,1735549,1735564,1735588,1735622,1735638,1735919,1735983,1736176,1737309-1737310,1737334,1737349,1737998,1738004,1738136,1738138,1738207,1738234,1738252,1738775,1738795,1738833,1738950,1738957,1738963,1739712,1739760,1739867,1739894,1739959-1739960,1740114,1740116,1740250,1740333,1740349,1740360,1740625-1740626,1740774,1740837,1740879,1740971,1741016,1741032,1741339,1741343,1742077,1742117,1742125,1742363,1742520,1742888,1742916,1743097,1743172,1743343,1743674,1744265,1744292,1744589,1744670,1744672,1744959,1745038,1745127,1745197,1745336,1745368,1746086,1746117,1746342,1746345,1746408,1746634,1746696,1746981,1747198,1747200,1747341-1747342,1747380,1747387,1747406,1747492,1747512,1747654,1748505,1748553,1748722,1748870,1749275,1749350,1749424,1749443,1749464,1749475,1749645,1749662,1749815,1749872,1749875,1749899,1750052,1750076-1750077,1750287 ,1750457,1750462,1750465,1750495,1750626,1750656,1750809,1750886-1750887,1751396,1751410,1751419,1751445-1751446,1751478,1751748,1751753,1751755,1751871,1752198,1752202,1752259,1752273-1752274,1752283,1752292,1752438,1752447-1752448,1752508,1752596,1752616,1752659,1752672,1753262,1753331-1753332,1753335-1753336,1753355,1753444,1753481,1754117,1754239,1755157,1755191,1756505-1756506,1756520,1756580,1757119,1757166,1758213,1758713,1759433,1759754,1759795,1759826,1760326,1760340,1760373,1760387,1760486,1760492,1760494,1760661-1760662,1760677,1760701,1760709,1760946,1761412,1761444,1761571,1761762,1761787,1761866,1761876,1762453,1762463,1762612,1762632,1762635,1762825,1763347,1763355-1763356,1763378,1763465,1763735,1764475,1764678,1764705,1764814,1764898,1765817,1765983,1766071,1766390,1766423,1766496,1766519,1766554,1766644,1767025,1767265,1767502,1767704,1768446,1768637,1769078,1769939-1769940,1770694,1770982,1771022,1771093,1771098,1771739,1771852,1771870,1771902,1772155,1772162,1772 228,1772593,1772768,1772906,1773190,1774141,1774256,1774497,1774787,1775474,1775622,1775628,1775757,1778112,1778423,1778968,1779137,1779478,1780388,1780424,1780538,1780543,1781068,1781075,1781386,1781846,1781907,1782476,1782966,1783066,1783089,1783104-1783105,1783110,1783619,1783720,1783738,1783773,1783855,1783891,1784023,1784034,1784130,1784251,1784551,1784574,1784689,1785283,1785838,1785946,1787074,1787217,1787425,1789056,1792463,1792742,1793013,1793088,1793644,1795314,1795330,1795475,1795488,1795491,1795613,1795618,1796144,1798035,1798834,1799219,1799389,1799924,1800974,1801011,1801013,1802548,1802973,1803026,1807308,1808125,1808128,1808142,1808240,1808246,1809024,1809026,1809163,1811380,1811655,1811952,1811963,1811986,1814189,1814332,1814397 /jackrabbit/trunk:1345480 Propchange: jackrabbit/oak/branches/1.4/oak-core/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Nov 22 16:33:50 2017 @@ -1,5 +1,5 @@ /jackrabbit/oak/branches/1.0/oak-core:1665962 /jackrabbit/oak/branches/1.6/oak-core:1802566 -/jackrabbit/oak/trunk/oak-core:1733615,1733875,1733913,1733929,1734230,1734254,1734279,1734941,1735052,1735081,1735109,1735141,1735267,1735405,1735484,1735549,1735564,1735588,1735622,1735638,1735919,1735983,1736176,1737309-1737310,1737334,1737349,1737998,1738004,1738136,1738138,1738207,1738234,1738252,1738775,1738795,1738833,1738950,1738957,1738963,1739712,1739760,1739867,1739894,1739959-1739960,1740114,1740116,1740250,1740333,1740349,1740360,1740625-1740626,1740774,1740837,1740879,1740971,1741016,1741032,1741339,1741343,1742077,1742117,1742125,1742363,1742520,1742888,1742916,1743097,1743172,1743343,1743674,1744265,1744292,1744589,1744670,1744672,1744959,1745038,1745127,1745197,1745336,1745368,1746086,1746117,1746342,1746345,1746408,1746634,1746696,1746981,1747198,1747200,1747341-1747342,1747380,1747387,1747406,1747492,1747512,1747654,1748505,1748553,1748722,1748870,1749275,1749350,1749424,1749443,1749464,1749475,1749645,1749662,1749815,1749872,1749875,1749899,1750052,1750076-175007 7,1750287,1750457,1750462,1750465,1750495,1750626,1750809,1750886-1750887,1751396,1751410,1751419,1751445-1751446,1751478,1751748,1751753,1751755,1751871,1752198,1752202,1752259,1752273-1752274,1752283,1752292,1752438,1752447-1752448,1752508,1752596,1752616,1752659,1752672,1753262,1753331-1753332,1753335-1753336,1753355,1753444,1754117,1754239,1755157,1755191,1756505-1756506,1756520,1756580,1757119,1757166,1758213,1758713,1759433,1759754,1759795,1759826,1760326,1760340,1760373,1760387,1760486,1760492,1760494,1760661-1760662,1760677,1760701,1760709,1760946,1761412,1761444,1761571,1761762,1761787,1761866,1761876,1762453,1762463,1762612,1762632,1762635,1762825,1763347,1763355-1763356,1763378,1763465,1763735,1764475,1764678,1764705,1764814,1764898,1765817,1765983,1766071,1766390,1766423,1766496,1766519,1766554,1766644,1767025,1767265,1767502,1767704,1768446,1768637,1769078,1769939-1769940,1770694,1770982,1771022,1771093,1771098,1771739,1771852,1771870,1771902,1772155,1772162,1772228,177 2593,1772768,1772906,1773190,1774141,1774256,1774497,1774787,1775474,1775622,1775628,1775757,1778112,1778423,1778968,1779137,1779478,1780388,1780424,1780538,1780543,1781068,1781075,1781386,1781846,1781907,1782476,1782966,1783066,1783089,1783104-1783105,1783110,1783619,1783720,1783738,1783773,1783855,1783891,1784023,1784034,1784130,1784251,1784551,1784574,1784689,1785283,1785838,1785946,1787074,1787217,1787425,1789056,1792463,1792742,1793013,1793088,1793644,1795314,1795330,1795475,1795488,1795491,1795613,1795618,1796144,1798035,1798834,1799219,1799389,1799924,1800974,1801011,1801013,1802548,1802973,1803026,1807308,1808125,1808128,1808142,1808240,1808246,1809024,1809026,1809163,1811380,1811952,1811963,1811986,1814332 +/jackrabbit/oak/trunk/oak-core:1733615,1733875,1733913,1733929,1734230,1734254,1734279,1734941,1735052,1735081,1735109,1735141,1735267,1735405,1735484,1735549,1735564,1735588,1735622,1735638,1735919,1735983,1736176,1737309-1737310,1737334,1737349,1737998,1738004,1738136,1738138,1738207,1738234,1738252,1738775,1738795,1738833,1738950,1738957,1738963,1739712,1739760,1739867,1739894,1739959-1739960,1740114,1740116,1740250,1740333,1740349,1740360,1740625-1740626,1740774,1740837,1740879,1740971,1741016,1741032,1741339,1741343,1742077,1742117,1742125,1742363,1742520,1742888,1742916,1743097,1743172,1743343,1743674,1744265,1744292,1744589,1744670,1744672,1744959,1745038,1745127,1745197,1745336,1745368,1746086,1746117,1746342,1746345,1746408,1746634,1746696,1746981,1747198,1747200,1747341-1747342,1747380,1747387,1747406,1747492,1747512,1747654,1748505,1748553,1748722,1748870,1749275,1749350,1749424,1749443,1749464,1749475,1749645,1749662,1749815,1749872,1749875,1749899,1750052,1750076-175007 7,1750287,1750457,1750462,1750465,1750495,1750626,1750656,1750809,1750886-1750887,1751396,1751410,1751419,1751445-1751446,1751478,1751748,1751753,1751755,1751871,1752198,1752202,1752259,1752273-1752274,1752283,1752292,1752438,1752447-1752448,1752508,1752596,1752616,1752659,1752672,1753262,1753331-1753332,1753335-1753336,1753355,1753444,1753481,1754117,1754239,1755157,1755191,1756505-1756506,1756520,1756580,1757119,1757166,1758213,1758713,1759433,1759754,1759795,1759826,1760326,1760340,1760373,1760387,1760486,1760492,1760494,1760661-1760662,1760677,1760701,1760709,1760946,1761412,1761444,1761571,1761762,1761787,1761866,1761876,1762453,1762463,1762612,1762632,1762635,1762825,1763347,1763355-1763356,1763378,1763465,1763735,1764475,1764678,1764705,1764814,1764898,1765817,1765983,1766071,1766390,1766423,1766496,1766519,1766554,1766644,1767025,1767265,1767502,1767704,1768446,1768637,1769078,1769939-1769940,1770694,1770982,1771022,1771093,1771098,1771739,1771852,1771870,1771902,1772155,177 2162,1772228,1772593,1772768,1772906,1773190,1774141,1774256,1774497,1774787,1775474,1775622,1775628,1775757,1778112,1778423,1778968,1779137,1779478,1780388,1780424,1780538,1780543,1781068,1781075,1781386,1781846,1781907,1782476,1782966,1783066,1783089,1783104-1783105,1783110,1783619,1783720,1783738,1783773,1783855,1783891,1784023,1784034,1784130,1784251,1784551,1784574,1784689,1785283,1785838,1785946,1787074,1787217,1787425,1789056,1792463,1792742,1793013,1793088,1793644,1795314,1795330,1795475,1795488,1795491,1795613,1795618,1796144,1798035,1798834,1799219,1799389,1799924,1800974,1801011,1801013,1802548,1802973,1803026,1807308,1808125,1808128,1808142,1808240,1808246,1809024,1809026,1809163,1811380,1811952,1811963,1811986,1814332 /jackrabbit/oak/trunk/oak-store-document:1809866,1811575,1811702,1811709,1815450,1815466 /jackrabbit/trunk/oak-core:1345480 Modified: jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java?rev=1816067&r1=1816066&r2=1816067&view=diff ============================================================================== --- jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java (original) +++ jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java Wed Nov 22 16:33:50 2017 @@ -514,7 +514,6 @@ public class DocumentMK { private int prevDocCachePercentage = DEFAULT_PREV_DOC_CACHE_PERCENTAGE; private int childrenCachePercentage = DEFAULT_CHILDREN_CACHE_PERCENTAGE; private int diffCachePercentage = DEFAULT_DIFF_CACHE_PERCENTAGE; - private int docChildrenCachePercentage = DEFAULT_DOC_CHILDREN_CACHE_PERCENTAGE; private int cacheSegmentCount = DEFAULT_CACHE_SEGMENT_COUNT; private int cacheStackMoveDistance = DEFAULT_CACHE_STACK_MOVE_DISTANCE; private boolean useSimpleRevision; @@ -821,23 +820,34 @@ public class DocumentMK { public Builder memoryCacheDistribution(int nodeCachePercentage, int prevDocCachePercentage, int childrenCachePercentage, - int docChildrenCachePercentage, int diffCachePercentage) { checkArgument(nodeCachePercentage >= 0); checkArgument(prevDocCachePercentage >= 0); checkArgument(childrenCachePercentage>= 0); - checkArgument(docChildrenCachePercentage >= 0); checkArgument(diffCachePercentage >= 0); checkArgument(nodeCachePercentage + prevDocCachePercentage + childrenCachePercentage + - docChildrenCachePercentage + diffCachePercentage < 100); + diffCachePercentage < 100); this.nodeCachePercentage = nodeCachePercentage; this.prevDocCachePercentage = prevDocCachePercentage; this.childrenCachePercentage = childrenCachePercentage; - this.docChildrenCachePercentage = docChildrenCachePercentage; this.diffCachePercentage = diffCachePercentage; return this; } + /** + * @deprecated Use {@link #memoryCacheDistribution(int, int, int, int)} + * instead. As of 1.4.19, this method ignores the + * {@code docChildrenCachePercentage}. + */ + public Builder memoryCacheDistribution(int nodeCachePercentage, + int prevDocCachePercentage, + int childrenCachePercentage, + int docChildrenCachePercentage, + int diffCachePercentage) { + return memoryCacheDistribution(nodeCachePercentage, + prevDocCachePercentage, childrenCachePercentage, diffCachePercentage); + } + public long getNodeCacheSize() { return memoryCacheSize * nodeCachePercentage / 100; } @@ -852,11 +862,7 @@ public class DocumentMK { public long getDocumentCacheSize() { return memoryCacheSize - getNodeCacheSize() - getPrevDocumentCacheSize() - getChildrenCacheSize() - - getDiffCacheSize() - getDocChildrenCacheSize(); - } - - public long getDocChildrenCacheSize() { - return memoryCacheSize * docChildrenCachePercentage / 100; + - getDiffCacheSize(); } public long getDiffCacheSize() { @@ -1004,10 +1010,6 @@ public class DocumentMK { return buildCache(CacheType.CHILDREN, getChildrenCacheSize(), null, null); } - public Cache<StringValue, NodeDocument.Children> buildDocChildrenCache() { - return buildCache(CacheType.DOC_CHILDREN, getDocChildrenCacheSize(), null, null); - } - public Cache<PathRev, StringValue> buildMemoryDiffCache() { return buildCache(CacheType.DIFF, getMemoryDiffCacheSize(), null, null); } Modified: jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java?rev=1816067&r1=1816066&r2=1816067&view=diff ============================================================================== --- jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java (original) +++ jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java Wed Nov 22 16:33:50 2017 @@ -33,7 +33,6 @@ import static org.apache.jackrabbit.oak. import static org.apache.jackrabbit.oak.plugins.document.JournalEntry.fillExternalChanges; import static org.apache.jackrabbit.oak.plugins.document.UpdateOp.Key; import static org.apache.jackrabbit.oak.plugins.document.UpdateOp.Operation; -import static org.apache.jackrabbit.oak.plugins.document.util.Utils.asStringValueIterable; import static org.apache.jackrabbit.oak.plugins.document.util.Utils.getIdFromPath; import static org.apache.jackrabbit.oak.plugins.document.util.Utils.pathToId; @@ -48,7 +47,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.NavigableSet; import java.util.Set; import java.util.TimeZone; import java.util.concurrent.Callable; @@ -68,7 +66,6 @@ import javax.management.NotCompliantMBea import com.google.common.base.Function; import com.google.common.base.Predicate; -import com.google.common.base.Predicates; import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import com.google.common.cache.Cache; @@ -97,7 +94,6 @@ import org.apache.jackrabbit.oak.commons import org.apache.jackrabbit.oak.json.BlobSerializer; import org.apache.jackrabbit.oak.plugins.document.util.LeaseCheckDocumentStoreWrapper; import org.apache.jackrabbit.oak.plugins.document.util.LoggingDocumentStoreWrapper; -import org.apache.jackrabbit.oak.plugins.document.util.StringValue; import org.apache.jackrabbit.oak.plugins.document.util.TimingDocumentStoreWrapper; import org.apache.jackrabbit.oak.plugins.document.util.Utils; import org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore; @@ -316,14 +312,6 @@ public final class DocumentNodeStore private final CacheStats nodeChildrenCacheStats; /** - * Child doc cache. - * - * Key: StringValue, value: Children - */ - private final Cache<StringValue, NodeDocument.Children> docChildrenCache; - private final CacheStats docChildrenCacheStats; - - /** * The change log to keep track of commits for diff operations. */ private final DiffCache diffCache; @@ -457,10 +445,6 @@ public final class DocumentNodeStore nodeChildrenCacheStats = new CacheStats(nodeChildrenCache, "Document-NodeChildren", builder.getWeigher(), builder.getChildrenCacheSize()); - docChildrenCache = builder.buildDocChildrenCache(); - docChildrenCacheStats = new CacheStats(docChildrenCache, "Document-DocChildren", - builder.getWeigher(), builder.getDocChildrenCacheSize()); - diffCache = builder.getDiffCache(); checkpoints = new Checkpoints(this); @@ -768,10 +752,6 @@ public final class DocumentNodeStore return nodeChildrenCacheStats; } - public CacheStats getDocChildrenCacheStats() { - return docChildrenCacheStats; - } - @Nonnull public Iterable<CacheStats> getDiffCacheStats() { return diffCache.getStats(); @@ -795,10 +775,6 @@ public final class DocumentNodeStore return changes; } - void invalidateDocChildrenCache() { - docChildrenCache.invalidateAll(); - } - void invalidateNodeChildrenCache() { nodeChildrenCache.invalidateAll(); } @@ -886,6 +862,7 @@ public final class DocumentNodeStore } } + @Nonnull DocumentNodeState.Children getChildren(@Nonnull final AbstractDocumentNodeState parent, @Nullable final String name, final int limit) @@ -1008,71 +985,7 @@ public final class DocumentNodeStore } else { from = Utils.getKeyLowerLimit(path); } - if (name != null || limit > NUM_CHILDREN_CACHE_LIMIT) { - // do not use cache when there is a lower bound name - // or more than 16k child docs are requested - return store.query(Collection.NODES, from, to, limit); - } - final StringValue key = new StringValue(path); - // check cache - NodeDocument.Children c = docChildrenCache.getIfPresent(key); - if (c == null) { - c = new NodeDocument.Children(); - List<NodeDocument> docs = store.query(Collection.NODES, from, to, limit); - for (NodeDocument doc : docs) { - String p = doc.getPath(); - c.childNames.add(PathUtils.getName(p)); - } - c.isComplete = docs.size() < limit; - docChildrenCache.put(key, c); - return docs; - } else if (c.childNames.size() < limit && !c.isComplete) { - // fetch more and update cache - String lastName = c.childNames.get(c.childNames.size() - 1); - String lastPath = concat(path, lastName); - String low = Utils.getIdFromPath(lastPath); - int remainingLimit = limit - c.childNames.size(); - List<NodeDocument> docs = store.query(Collection.NODES, - low, to, remainingLimit); - NodeDocument.Children clone = c.clone(); - for (NodeDocument doc : docs) { - String p = doc.getPath(); - clone.childNames.add(PathUtils.getName(p)); - } - clone.isComplete = docs.size() < remainingLimit; - docChildrenCache.put(key, clone); - c = clone; - } - Iterable<NodeDocument> head = filter(transform(c.childNames, - new Function<String, NodeDocument>() { - @Override - public NodeDocument apply(String name) { - String p = concat(path, name); - NodeDocument doc = store.find(Collection.NODES, Utils.getIdFromPath(p)); - if (doc == null) { - docChildrenCache.invalidate(key); - } - return doc; - } - }), Predicates.notNull()); - Iterable<NodeDocument> it; - if (c.isComplete) { - it = head; - } else { - // OAK-2420: 'head' may have null documents when documents are - // concurrently removed from the store. concat 'tail' to fetch - // more documents if necessary - final String last = getIdFromPath(concat( - path, c.childNames.get(c.childNames.size() - 1))); - Iterable<NodeDocument> tail = new Iterable<NodeDocument>() { - @Override - public Iterator<NodeDocument> iterator() { - return store.query(NODES, last, to, limit).iterator(); - } - }; - it = Iterables.concat(head, tail); - } - return Iterables.limit(it, limit); + return store.query(Collection.NODES, from, to, limit); } /** @@ -1279,41 +1192,6 @@ public final class DocumentNodeStore w.tag('^').key(PathUtils.getName(p)).object().endObject(); } cacheEntry.append(path, w.toString()); - - // update docChildrenCache - if (!added.isEmpty()) { - StringValue docChildrenKey = new StringValue(path); - NodeDocument.Children docChildren = docChildrenCache.getIfPresent(docChildrenKey); - if (docChildren != null) { - int currentSize = docChildren.childNames.size(); - NavigableSet<String> names = Sets.newTreeSet(docChildren.childNames); - // incomplete cache entries must not be updated with - // names at the end of the list because there might be - // a next name in DocumentStore smaller than the one added - if (!docChildren.isComplete) { - for (String childPath : added) { - String name = PathUtils.getName(childPath); - if (names.higher(name) != null) { - names.add(Utils.unshareString(name)); - } - } - } else { - // add all - for (String childPath : added) { - names.add(Utils.unshareString(PathUtils.getName(childPath))); - } - } - // any changes? - if (names.size() != currentSize) { - // create new cache entry with updated names - boolean complete = docChildren.isComplete; - docChildren = new NodeDocument.Children(); - docChildren.isComplete = complete; - docChildren.childNames.addAll(names); - docChildrenCache.put(docChildrenKey, docChildren); - } - } - } } /** @@ -2013,33 +1891,13 @@ public final class DocumentNodeStore if (externalSort == null) { // if no externalSort available, then invalidate the classic way: everything stats.cacheStats = store.invalidateCache(); - docChildrenCache.invalidateAll(); } else { try { externalSort.sort(); stats.cacheStats = store.invalidateCache(pathToId(externalSort)); - // OAK-3002: only invalidate affected items (using journal) - long origSize = docChildrenCache.size(); - if (origSize == 0) { - // if docChildrenCache is empty, don't bother - // calling invalidateAll either way - // (esp calling invalidateAll(Iterable) will - // potentially iterate over all keys even though - // there's nothing to be deleted) - LOG.trace("backgroundRead: docChildrenCache nothing to invalidate"); - } else { - // however, if the docChildrenCache is not empty, - // use the invalidateAll(Iterable) variant, - // passing it a Iterable<StringValue>, as that's - // what is contained in the cache - docChildrenCache.invalidateAll(asStringValueIterable(externalSort)); - long newSize = docChildrenCache.size(); - LOG.trace("backgroundRead: docChildrenCache invalidation result: orig: {}, new: {} ", origSize, newSize); - } } catch (Exception ioe) { LOG.error("backgroundRead: got IOException during external sorting/cache invalidation (as a result, invalidating entire cache): "+ioe, ioe); stats.cacheStats = store.invalidateCache(); - docChildrenCache.invalidateAll(); } } stats.cacheInvalidationTime = clock.getTime() - time; Modified: jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java?rev=1816067&r1=1816066&r2=1816067&view=diff ============================================================================== --- jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java (original) +++ jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java Wed Nov 22 16:33:50 2017 @@ -25,7 +25,6 @@ import static org.apache.jackrabbit.oak. import static org.apache.jackrabbit.oak.osgi.OsgiUtil.lookupFrameworkThenConfiguration; import static org.apache.jackrabbit.oak.plugins.document.DocumentMK.Builder.DEFAULT_CHILDREN_CACHE_PERCENTAGE; import static org.apache.jackrabbit.oak.plugins.document.DocumentMK.Builder.DEFAULT_DIFF_CACHE_PERCENTAGE; -import static org.apache.jackrabbit.oak.plugins.document.DocumentMK.Builder.DEFAULT_DOC_CHILDREN_CACHE_PERCENTAGE; import static org.apache.jackrabbit.oak.plugins.document.DocumentMK.Builder.DEFAULT_NODE_CACHE_PERCENTAGE; import static org.apache.jackrabbit.oak.plugins.document.DocumentMK.Builder.DEFAULT_PREV_DOC_CACHE_PERCENTAGE; import static org.apache.jackrabbit.oak.spi.blob.osgi.SplitBlobStoreService.ONLY_STANDALONE_TARGET; @@ -190,12 +189,6 @@ public class DocumentNodeStoreService { ) private static final String PROP_DIFF_CACHE_PERCENTAGE = "diffCachePercentage"; - @Property(intValue = DocumentMK.Builder.DEFAULT_DOC_CHILDREN_CACHE_PERCENTAGE, - label = "Document Children Cache", - description = "Percentage of cache to be allocated towards Document children cache" - ) - private static final String PROP_DOC_CHILDREN_CACHE_PERCENTAGE = "docChildrenCachePercentage"; - @Property(intValue = DocumentMK.Builder.DEFAULT_CACHE_SEGMENT_COUNT, label = "LIRS Cache Segment Count", description = "The number of segments in the LIRS cache " + @@ -398,7 +391,6 @@ public class DocumentNodeStoreService { int nodeCachePercentage = toInteger(prop(PROP_NODE_CACHE_PERCENTAGE), DEFAULT_NODE_CACHE_PERCENTAGE); int prevDocCachePercentage = toInteger(prop(PROP_PREV_DOC_CACHE_PERCENTAGE), DEFAULT_NODE_CACHE_PERCENTAGE); int childrenCachePercentage = toInteger(prop(PROP_CHILDREN_CACHE_PERCENTAGE), DEFAULT_CHILDREN_CACHE_PERCENTAGE); - int docChildrenCachePercentage = toInteger(prop(PROP_DOC_CHILDREN_CACHE_PERCENTAGE), DEFAULT_DOC_CHILDREN_CACHE_PERCENTAGE); int diffCachePercentage = toInteger(prop(PROP_DIFF_CACHE_PERCENTAGE), DEFAULT_DIFF_CACHE_PERCENTAGE); int blobCacheSize = toInteger(prop(PROP_BLOB_CACHE_SIZE), DEFAULT_BLOB_CACHE_SIZE); String persistentCache = PropertiesUtil.toString(prop(PROP_PERSISTENT_CACHE), DEFAULT_PERSISTENT_CACHE); @@ -412,7 +404,6 @@ public class DocumentNodeStoreService { nodeCachePercentage, prevDocCachePercentage, childrenCachePercentage, - docChildrenCachePercentage, diffCachePercentage). setCacheSegmentCount(cacheSegmentCount). setCacheStackMoveDistance(cacheStackMoveDistance). @@ -663,13 +654,6 @@ public class DocumentNodeStoreService { CacheStatsMBean.TYPE, store.getNodeChildrenCacheStats().getName()) ); - registrations.add( - registerMBean(whiteboard, - CacheStatsMBean.class, - store.getDocChildrenCacheStats(), - CacheStatsMBean.TYPE, - store.getDocChildrenCacheStats().getName()) - ); for (CacheStats cs : store.getDiffCacheStats()) { registrations.add( registerMBean(whiteboard, Modified: jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java?rev=1816067&r1=1816066&r2=1816067&view=diff ============================================================================== --- jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java (original) +++ jackrabbit/oak/branches/1.4/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java Wed Nov 22 16:33:50 2017 @@ -156,7 +156,6 @@ public class VersionGarbageCollector { stats.deleteDeletedDocs.start(); gc.removeDocuments(stats); - nodeStore.invalidateDocChildrenCache(); stats.deleteDeletedDocs.stop(); } finally { gc.close(); Modified: jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractJournalTest.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractJournalTest.java?rev=1816067&r1=1816066&r2=1816067&view=diff ============================================================================== --- jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractJournalTest.java (original) +++ jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractJournalTest.java Wed Nov 22 16:33:50 2017 @@ -60,10 +60,6 @@ public abstract class AbstractJournalTes mks.clear(); } - protected static void invalidateDocChildrenCache(DocumentNodeStore store) { - store.invalidateDocChildrenCache(); - } - protected static void renewClusterIdLease(DocumentNodeStore store) { store.renewClusterIdLease(); } Copied: jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentReadAndAddTest.java (from r1750656, jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentReadAndAddTest.java) URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentReadAndAddTest.java?p2=jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentReadAndAddTest.java&p1=jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentReadAndAddTest.java&r1=1750656&r2=1816067&rev=1816067&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentReadAndAddTest.java (original) +++ jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentReadAndAddTest.java Wed Nov 22 16:33:50 2017 @@ -33,13 +33,11 @@ import org.apache.jackrabbit.oak.spi.sta import org.apache.jackrabbit.oak.spi.state.NodeBuilder; import org.apache.jackrabbit.oak.spi.state.NodeState; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import static org.junit.Assert.assertEquals; -@Ignore public class ConcurrentReadAndAddTest { @Rule Modified: jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGCDeletionTest.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGCDeletionTest.java?rev=1816067&r1=1816066&r2=1816067&view=diff ============================================================================== --- jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGCDeletionTest.java (original) +++ jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGCDeletionTest.java Wed Nov 22 16:33:50 2017 @@ -272,14 +272,18 @@ public class VersionGCDeletionTest { final Semaphore queries = new Semaphore(0); final CountDownLatch ready = new CountDownLatch(1); MemoryDocumentStore ms = new MemoryDocumentStore() { + @Nonnull @Override - public <T extends Document> T find(Collection<T> collection, - String key) { - if (Thread.currentThread() != currentThread) { + public <T extends Document> List<T> query(Collection<T> collection, + String fromKey, + String toKey, + int limit) { + if (collection == Collection.NODES + && Thread.currentThread() != currentThread) { ready.countDown(); queries.acquireUninterruptibly(); } - return super.find(collection, key); + return super.query(collection, fromKey, toKey, limit); } }; store = new DocumentMK.Builder().clock(clock) @@ -337,7 +341,7 @@ public class VersionGCDeletionTest { VersionGCStats stats = gc.gc(30, MINUTES); assertEquals(90, stats.deletedDocGCCount); - queries.release(200); + queries.release(2); List<String> names = f.get(); assertEquals(expected, names); Modified: jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/JournalIT.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/JournalIT.java?rev=1816067&r1=1816066&r2=1816067&view=diff ============================================================================== --- jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/JournalIT.java (original) +++ jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/JournalIT.java Wed Nov 22 16:33:50 2017 @@ -42,7 +42,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; public class JournalIT extends AbstractJournalTest { @@ -69,8 +68,7 @@ public class JournalIT extends AbstractJ final DocumentNodeStore ns2 = createMK(2, 0).getNodeStore(); LOG.info("cache size 1: " + getCacheElementCount(ns1.getDocumentStore())); - // invalidate both caches under test first - invalidateDocChildrenCache(ns1); + // invalidate cache under test first ns1.getDocumentStore().invalidateCache(); { @@ -164,8 +162,7 @@ public class JournalIT extends AbstractJ final DocumentNodeStore ns1 = createMK(1, 0).getNodeStore(); final DocumentNodeStore ns2 = createMK(2, 0).getNodeStore(); - // invalidate both caches under test first - invalidateDocChildrenCache(ns1); + // invalidate cache under test first ns1.getDocumentStore().invalidateCache(); // first create child node in instance 1