test_class.declarator: fixture
test_class.modifier: private
test_class.original_string: private DocumentStoreFixture fixture;
test_class.type: DocumentStoreFixture
test_class.var_name: fixture
test_class.declarator: store
test_class.modifier: private
test_class.original_string: private DocumentStore store;
test_class.type: DocumentStore
test_class.var_name: store
test_class.declarator: gcSupport
test_class.modifier: private
test_class.original_string: private VersionGCSupport gcSupport;
test_class.type: VersionGCSupport
test_class.var_name: gcSupport
test_class.declarator: ids = Lists.newArrayList()
test_class.modifier: private
test_class.original_string: private List<String> ids = Lists.newArrayList();
test_class.type: List<String>
test_class.var_name: ids
test_class.file: oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupportTest.java
test_class.identifier: VersionGCSupportTest
test_case.body: @Test
      public void findOldest() {
          // see OAK-8476
          long secs = 123456;
          long offset = SECONDS.toMillis(secs);
          Revision r = new Revision(offset, 0, 1);
          String id = Utils.getIdFromPath("/doc-del");
          ids.add(id);
          UpdateOp op = new UpdateOp(id, true);
          NodeDocument.setModified(op, r);
          NodeDocument.setDeleted(op, r, true);
          store.create(Collection.NODES, Lists.newArrayList(op));
  
          long reportedsecs = gcSupport.getOldestDeletedOnceTimestamp(Clock.SIMPLE, 1) / SECONDS.toMillis(1);
          assertTrue("diff (s) should be < 5: " + Math.abs(secs - reportedsecs), Math.abs(secs - reportedsecs) < 5);
      }
test_case.class_method_signature: VersionGCSupportTest.findOldest()
test_case.full_signature: @Test public void findOldest()
test_case.identifier: findOldest
test_case.invocations: toMillis getIdFromPath add setModified setDeleted create newArrayList getOldestDeletedOnceTimestamp toMillis assertTrue abs abs
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void findOldest()
focal_class.declarator: LOG = LoggerFactory.getLogger(VersionGCSupport.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(VersionGCSupport.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: store
focal_class.modifier: private final
focal_class.original_string: private final DocumentStore store;
focal_class.type: DocumentStore
focal_class.var_name: store
focal_class.file: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java
focal_class.identifier: VersionGCSupport
focal_class.class_method_signature: VersionGCSupport.VersionGCSupport(DocumentStore store)
focal_class.full_signature: public  VersionGCSupport(DocumentStore store)
focal_class.identifier: VersionGCSupport
focal_class.modifiers: public
focal_class.parameters: (DocumentStore store)
focal_class.signature:  VersionGCSupport(DocumentStore store)
focal_class.class_method_signature: VersionGCSupport.getPossiblyDeletedDocs(final long fromModified,
                                                           final long toModified)
focal_class.full_signature: public Iterable<NodeDocument> getPossiblyDeletedDocs(final long fromModified,
                                                           final long toModified)
focal_class.identifier: getPossiblyDeletedDocs
focal_class.modifiers: public
focal_class.parameters: (final long fromModified,
                                                           final long toModified)
focal_class.return: Iterable<NodeDocument>
focal_class.signature: Iterable<NodeDocument> getPossiblyDeletedDocs(final long fromModified,
                                                           final long toModified)
focal_class.class_method_signature: VersionGCSupport.getDocumentStore()
focal_class.full_signature: @NotNull public DocumentStore getDocumentStore()
focal_class.identifier: getDocumentStore
focal_class.modifiers: @NotNull public
focal_class.parameters: ()
focal_class.return: DocumentStore
focal_class.signature: DocumentStore getDocumentStore()
focal_class.class_method_signature: VersionGCSupport.deleteSplitDocuments(Set<SplitDocType> gcTypes,
                                RevisionVector sweepRevs,
                                long oldestRevTimeStamp,
                                VersionGCStats stats)
focal_class.full_signature:  void deleteSplitDocuments(Set<SplitDocType> gcTypes,
                                RevisionVector sweepRevs,
                                long oldestRevTimeStamp,
                                VersionGCStats stats)
focal_class.identifier: deleteSplitDocuments
focal_class.parameters: (Set<SplitDocType> gcTypes,
                                RevisionVector sweepRevs,
                                long oldestRevTimeStamp,
                                VersionGCStats stats)
focal_class.return: void
focal_class.signature: void deleteSplitDocuments(Set<SplitDocType> gcTypes,
                                RevisionVector sweepRevs,
                                long oldestRevTimeStamp,
                                VersionGCStats stats)
focal_class.class_method_signature: VersionGCSupport.createCleanUp(Set<SplitDocType> gcTypes,
                                                   RevisionVector sweepRevs,
                                                   long oldestRevTimeStamp,
                                                   VersionGCStats stats)
focal_class.full_signature: protected SplitDocumentCleanUp createCleanUp(Set<SplitDocType> gcTypes,
                                                   RevisionVector sweepRevs,
                                                   long oldestRevTimeStamp,
                                                   VersionGCStats stats)
focal_class.identifier: createCleanUp
focal_class.modifiers: protected
focal_class.parameters: (Set<SplitDocType> gcTypes,
                                                   RevisionVector sweepRevs,
                                                   long oldestRevTimeStamp,
                                                   VersionGCStats stats)
focal_class.return: SplitDocumentCleanUp
focal_class.signature: SplitDocumentCleanUp createCleanUp(Set<SplitDocType> gcTypes,
                                                   RevisionVector sweepRevs,
                                                   long oldestRevTimeStamp,
                                                   VersionGCStats stats)
focal_class.class_method_signature: VersionGCSupport.identifyGarbage(final Set<SplitDocType> gcTypes,
                                                       final RevisionVector sweepRevs,
                                                       final long oldestRevTimeStamp)
focal_class.full_signature: protected Iterable<NodeDocument> identifyGarbage(final Set<SplitDocType> gcTypes,
                                                       final RevisionVector sweepRevs,
                                                       final long oldestRevTimeStamp)
focal_class.identifier: identifyGarbage
focal_class.modifiers: protected
focal_class.parameters: (final Set<SplitDocType> gcTypes,
                                                       final RevisionVector sweepRevs,
                                                       final long oldestRevTimeStamp)
focal_class.return: Iterable<NodeDocument>
focal_class.signature: Iterable<NodeDocument> identifyGarbage(final Set<SplitDocType> gcTypes,
                                                       final RevisionVector sweepRevs,
                                                       final long oldestRevTimeStamp)
focal_class.class_method_signature: VersionGCSupport.getOldestDeletedOnceTimestamp(Clock clock, long precisionMs)
focal_class.full_signature: public long getOldestDeletedOnceTimestamp(Clock clock, long precisionMs)
focal_class.identifier: getOldestDeletedOnceTimestamp
focal_class.modifiers: public
focal_class.parameters: (Clock clock, long precisionMs)
focal_class.return: long
focal_class.signature: long getOldestDeletedOnceTimestamp(Clock clock, long precisionMs)
focal_class.class_method_signature: VersionGCSupport.getDeletedOnceCount()
focal_class.full_signature: public long getDeletedOnceCount()
focal_class.identifier: getDeletedOnceCount
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getDeletedOnceCount()
focal_class.class_method_signature: VersionGCSupport.isDefaultNoBranchSplitNewerThan(NodeDocument doc,
                                                               RevisionVector sweepRevs)
focal_class.full_signature: protected static boolean isDefaultNoBranchSplitNewerThan(NodeDocument doc,
                                                               RevisionVector sweepRevs)
focal_class.identifier: isDefaultNoBranchSplitNewerThan
focal_class.modifiers: protected static
focal_class.parameters: (NodeDocument doc,
                                                               RevisionVector sweepRevs)
focal_class.return: boolean
focal_class.signature: boolean isDefaultNoBranchSplitNewerThan(NodeDocument doc,
                                                               RevisionVector sweepRevs)
focal_method.body: public long getOldestDeletedOnceTimestamp(Clock clock, long precisionMs) {
          long ts = 0;
          long now = clock.getTime();
          long duration =  (now - ts) / 2;
          Iterable<NodeDocument> docs;
  
          while (duration > precisionMs) {
              // check for delete candidates in [ ts, ts + duration]
              LOG.debug("find oldest _deletedOnce, check < {}", Utils.timestampToString(ts + duration));
              docs = getPossiblyDeletedDocs(ts, ts + duration);
              if (docs.iterator().hasNext()) {
                  // look if there are still nodes to be found in the lower half
                  duration /= 2;
              }
              else {
                  // so, there are no delete candidates older than "ts + duration"
                  ts = ts + duration;
                  duration /= 2;
              }
              Utils.closeIfCloseable(docs);
          }
          LOG.debug("find oldest _deletedOnce to be {}", Utils.timestampToString(ts));
          return ts;
      }
focal_method.class_method_signature: VersionGCSupport.getOldestDeletedOnceTimestamp(Clock clock, long precisionMs)
focal_method.full_signature: public long getOldestDeletedOnceTimestamp(Clock clock, long precisionMs)
focal_method.identifier: getOldestDeletedOnceTimestamp
focal_method.invocations: getTime debug timestampToString getPossiblyDeletedDocs hasNext iterator closeIfCloseable debug timestampToString
focal_method.modifiers: public
focal_method.parameters: (Clock clock, long precisionMs)
focal_method.return: long
focal_method.signature: long getOldestDeletedOnceTimestamp(Clock clock, long precisionMs)