Package com.flaptor.indextank.rpc

Examples of com.flaptor.indextank.rpc.IndexLogInfo


        new Thread(this).start();
        new DiscoveryThread().start();
    }
   
    public IndexLogInfo getIndexInfo(String code) {
        IndexLogInfo info = new IndexLogInfo();
        IndexLog log = new IndexLog(code, root, IndexLog.DEFAULT_SEGMENT_SIZE);
        List<Segment> optimizedSegments = log.getOptimizedSegments();
        int optimizedCount = 0;
        long lastTimestamp = 0;
        for (Segment segment : optimizedSegments) {
            info.add_to_optimized_segments(segment.getInfo());
            optimizedCount = segment.recordCount;
            lastTimestamp = segment.timestamp;
        }
        info.set_optimized_record_count(optimizedCount);
        info.set_last_optimization_timestamp(lastTimestamp);
       
        long unoptimizedCount = 0;
        int unoptimizedSegments = 0;
        boolean unsortedSegments = false;
        for (Segment segment : log.getSegments()) {
            if (segment.timestamp > lastTimestamp) {
                unoptimizedCount += segment.recordCount;
                if (segment.isSorted()) {
                    unoptimizedSegments++;
                    info.add_to_sorted_segments(segment.getInfo());
                } else {
                    unsortedSegments = true;
                    info.add_to_unsorted_segments(segment.getInfo());
                }
            }
        }
        if (unsortedSegments) unoptimizedSegments++;
        info.set_unoptimized_record_count(unoptimizedCount);
        info.set_unoptimized_segments(unoptimizedSegments);
       
        return info;
    }
View Full Code Here


                if (IndexTankUtil.isMaster() && root.getSafeToReadFile().exists()) {
                    try {
                        for (File file : path.listFiles()) {
                            if (!IndexLog.isLog(file)) continue;
                            String code = file.getName();
                            IndexLogInfo info = getIndexInfo(code);
                            int segments = info.get_unoptimized_segments();
                            long opt = info.get_optimized_record_count();
                            long unopt = info.get_unoptimized_record_count();
                            if (segments > 4) {
                                float ratio;
                                ratio = opt == 0 ? 2 : unopt / opt;
                                // flat ratios at two to avoid aberrations at the beginning of an index history
                                ratio = Math.max(ratio, 2);
View Full Code Here

TOP

Related Classes of com.flaptor.indextank.rpc.IndexLogInfo

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.