Package org.apache.jackrabbit.oak.plugins.segment

Examples of org.apache.jackrabbit.oak.plugins.segment.SegmentId


        }

        RecordId id = null;
        while (id == null && !heads.isEmpty()) {
            RecordId last = heads.removeLast();
            SegmentId segmentId = last.getSegmentId();
            if (containsSegment(
                    segmentId.getMostSignificantBits(),
                    segmentId.getLeastSignificantBits())) {
                id = last;
            } else {
                log.warn("Unable to access revision {}, rewinding...", last);
            }
        }
View Full Code Here


        }

        RecordId id = null;
        while (id == null && !heads.isEmpty()) {
            RecordId last = heads.removeLast();
            SegmentId segmentId = last.getSegmentId();
            if (containsSegment(
                    segmentId.getMostSignificantBits(),
                    segmentId.getLeastSignificantBits())) {
                id = last;
            } else {
                log.warn("Unable to access revision {}, rewinding...", last);
            }
        }
View Full Code Here

                    Set<SegmentId> garbage = newHashSet(idmap.keySet());
                    Queue<SegmentId> queue = Queues.newArrayDeque();
                    queue.add(store.getHead().getRecordId().getSegmentId());
                    while (!queue.isEmpty()) {
                        SegmentId id = queue.remove();
                        if (garbage.remove(id)) {
                            queue.addAll(idmap.get(id));
                        }
                    }
                    dataCount = 0;
                    dataSize = 0;
                    bulkCount = 0;
                    bulkSize = 0;
                    for (SegmentId id : garbage) {
                        if (id.isDataSegmentId()) {
                            dataCount++;
                            dataSize += id.getSegment().size();
                        } else if (id.isBulkSegmentId()) {
                            bulkCount++;
                            bulkSize += id.getSegment().size();
                        }
                    }
                    System.out.println("Available for garbage collection:");
                    System.out.format(
                            "%6dMB in %6d data segments%n",
                            dataSize / (1024 * 1024), dataCount);
                    System.out.format(
                            "%6dMB in %6d bulk segments%n",
                            bulkSize / (1024 * 1024), bulkCount);
                } else {
                    Pattern pattern = Pattern.compile(
                            "([0-9a-f-]+)|([0-9a-f-]+:[0-9a-f]+)?(/.*)?");
                    for (int i = 1; i < args.length; i++) {
                        Matcher matcher = pattern.matcher(args[i]);
                        if (!matcher.matches()) {
                            System.err.println("Unknown argument: " + args[i]);
                        } else if (matcher.group(1) != null) {
                            UUID uuid = UUID.fromString(matcher.group(1));
                            SegmentId id = store.getTracker().getSegmentId(
                                    uuid.getMostSignificantBits(),
                                    uuid.getLeastSignificantBits());
                            System.out.println(id.getSegment());
                        } else {
                            RecordId id = store.getHead().getRecordId();
                            if (matcher.group(2) != null) {
                                id = RecordId.fromString(
                                        store.getTracker(), matcher.group(2));
View Full Code Here

        }

        RecordId id = null;
        while (id == null && !heads.isEmpty()) {
            RecordId last = RecordId.fromString(tracker, heads.removeLast());
            SegmentId segmentId = last.getSegmentId();
            if (containsSegment(
                    segmentId.getMostSignificantBits(),
                    segmentId.getLeastSignificantBits())) {
                id = last;
            } else {
                log.warn("Unable to access revision {}, rewinding...", last);
            }
        }
View Full Code Here

            Matcher matcher = pattern.matcher(args[i]);
            if (!matcher.matches()) {
                System.err.println("Unknown argument: " + args[i]);
            } else if (matcher.group(1) != null) {
                UUID uuid = UUID.fromString(matcher.group(1));
                SegmentId id = store.getTracker().getSegmentId(
                        uuid.getMostSignificantBits(),
                        uuid.getLeastSignificantBits());
                System.out.println(id.getSegment());
            } else {
                RecordId id1 = store.getHead().getRecordId();
                RecordId id2 = null;
                if (matcher.group(2) != null) {
                    id1 = RecordId.fromString(store.getTracker(),
View Full Code Here

        Set<SegmentId> garbage = newHashSet(idmap.keySet());
        Queue<SegmentId> queue = Queues.newArrayDeque();
        queue.add(store.getHead().getRecordId().getSegmentId());
        while (!queue.isEmpty()) {
            SegmentId id = queue.remove();
            if (garbage.remove(id)) {
                queue.addAll(idmap.get(id));
            }
        }
        dataCount = 0;
        dataSize = 0;
        bulkCount = 0;
        bulkSize = 0;
        for (SegmentId id : garbage) {
            if (id.isDataSegmentId()) {
                dataCount++;
                dataSize += id.getSegment().size();
            } else if (id.isBulkSegmentId()) {
                bulkCount++;
                bulkSize += id.getSegment().size();
            }
        }
        System.out.println("Available for garbage collection:");
        System.out.format(
                "%6dMB in %6d data segments%n",
View Full Code Here

            store.close();
        }
    }

    private static void collectSegments(SegmentNodeState s, Set<UUID> segmentIds) {
        SegmentId sid = s.getRecordId().getSegmentId();
        UUID id = new UUID(sid.getMostSignificantBits(),
                sid.getLeastSignificantBits());
        segmentIds.add(id);
        for (ChildNodeEntry cne : s.getChildNodeEntries()) {
            collectSegments((SegmentNodeState) cne.getNodeState(), segmentIds);
        }
        for (PropertyState propertyState : s.getProperties()) {
            sid = ((SegmentPropertyState) propertyState).getRecordId().getSegmentId();
            id = new UUID(sid.getMostSignificantBits(),
                    sid.getLeastSignificantBits());
            segmentIds.add(id);
        }
    }
View Full Code Here

        Set<String> localPaths = new TreeSet<String>();
        for (PropertyState ps : state.getProperties()) {
            if (ps instanceof SegmentPropertyState) {
                SegmentPropertyState sps = (SegmentPropertyState) ps;
                RecordId recordId = sps.getRecordId();
                SegmentId sid = recordId.getSegmentId();
                UUID id = new UUID(sid.getMostSignificantBits(),
                        sid.getLeastSignificantBits());
                if (uuids.contains(id)) {
                    localPaths.add(path + "@" + ps + " [SegmentPropertyState@"
                            + recordId + "]");
                }
                if (ps.getType().tag() == PropertyType.BINARY) {
                    for (int i = 0; i < ps.count(); i++) {
                        Blob b = ps.getValue(Type.BINARY, i);
                        for (SegmentId sbid : SegmentBlob.getBulkSegmentIds(b)) {
                            UUID bid = new UUID(sbid.getMostSignificantBits(),
                                    sbid.getLeastSignificantBits());
                            if (!bid.equals(id) && uuids.contains(bid)) {
                                localPaths.add(path + "@" + ps
                                        + " [SegmentPropertyState@" + recordId
                                        + "]");
                            }
                        }
                    }
                }
            }
        }

        RecordId stateId = state.getRecordId();
        SegmentId segmentId = stateId.getSegmentId();
        if (uuids.contains(new UUID(segmentId.getMostSignificantBits(),
                segmentId.getLeastSignificantBits()))) {
            localPaths.add(path + " [SegmentNodeState@" + stateId + "]");
        }

        RecordId templateId = SegmentNodeStateHelper.getTemplateId(state);
        SegmentId template = templateId.getSegmentId();
        if (uuids.contains(new UUID(template.getMostSignificantBits(), template
                .getLeastSignificantBits()))) {
            localPaths.add(path + "[Template@" + templateId + "]");
        }
        paths.addAll(localPaths);
        for (ChildNodeEntry ce : state.getChildNodeEntries()) {
View Full Code Here

        }

        RecordId id = null;
        while (id == null && !heads.isEmpty()) {
            RecordId last = RecordId.fromString(tracker, heads.removeLast());
            SegmentId segmentId = last.getSegmentId();
            if (containsSegment(
                    segmentId.getMostSignificantBits(),
                    segmentId.getLeastSignificantBits())) {
                id = last;
            } else {
                log.warn("Unable to access revision {}, rewinding...", last);
            }
        }
View Full Code Here

                Segment s = null;

                for (int i = 0; i < 10; i++) {
                    try {
                        s = store.readSegment(new SegmentId(store.getTracker(),
                                uuid.getMostSignificantBits(), uuid
                                .getLeastSignificantBits()));
                    } catch (IllegalStateException e) {
                        // segment not found
                        log.debug("waiting for segment. Got exception: " + e.getMessage());
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.plugins.segment.SegmentId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.