Package net.yacy.kelondro.index

Examples of net.yacy.kelondro.index.RowSet


     * return an index container
     * because they may get very large, it is wise to deallocate some memory before calling next()
     */
    public ReferenceContainer<ReferenceType> next0() {
        if (this.blobs == null) return null;
        RowSet row;
        Map.Entry<byte[], byte[]> entry;
        while (this.blobs.hasNext()) {
            entry = this.blobs.next();
            try {
                row = RowSet.importRowSet(entry.getValue(), this.factory.getRow());
View Full Code Here


            // initialize index and copy table
            final int  records = Math.max(fileSize, initialSpace);
            final long neededRAM4table = (records) * ((rowdef.objectsize) + 4L) * 3L;
            this.table = ((exceed134217727 || neededRAM4table < maxarraylength) &&
                     (useTailCache && MemoryControl.available() > neededRAM4table + 200 * 1024 * 1024)) ?
                    new RowSet(this.taildef, records) : null;
            Log.logInfo("TABLE", "initialization of " + tablefile.getName() + ". table copy: " + ((this.table == null) ? "no" : "yes") + ", available RAM: " + (MemoryControl.available() / 1024 / 1024) + "MB, needed: " + (neededRAM4table/1024/1024 + 200) + "MB, allocating space for " + records + " entries");
            final long neededRAM4index = 400 * 1024 * 1024 + records * (rowdef.primaryKeyLength + 4) * 3 / 2;
            if (!MemoryControl.request(neededRAM4index, false)) {
                // despite calculations seemed to show that there is enough memory for the table AND the index
                // there is now not enough memory left for the index. So delete the table again to free the memory
View Full Code Here

     * @throws
     */
    public synchronized List<RowCollection> removeDoubles() throws IOException, RowSpaceExceededException {
        assert this.file.size() == this.index.size() : "file.size() = " + this.file.size() + ", index.size() = " + this.index.size();
        final List<RowCollection> report = new ArrayList<RowCollection>();
        RowSet rows;
        final TreeSet<Long> d = new TreeSet<Long>();
        final byte[] b = new byte[this.rowdef.objectsize];
        Row.Entry inconsistentEntry;
        // iterate over all entries that have inconsistent index references
        long lastlog = System.currentTimeMillis();
        List<long[]> doubles;
        try {
            doubles = this.index.removeDoubles();
        } catch (final RowSpaceExceededException e) {
            if (this.table == null) throw e;
            this.table = null;
            doubles = this.index.removeDoubles();
        }
        for (final long[] is: doubles) {
            // 'is' is the set of all indexes, that have the same reference
            // we collect that entries now here
            rows = new RowSet(this.rowdef, is.length);
            for (final long L : is) {
                assert (int) L < this.file.size() : "L.intValue() = " + (int) L + ", file.size = " + this.file.size(); // prevent ooBounds Exception
                d.add(L);
                if ((int) L >= this.file.size()) continue; // prevent IndexOutOfBoundsException
                this.file.get((int) L, b, 0); // TODO: fix IndexOutOfBoundsException here
                inconsistentEntry = this.rowdef.newEntry(b);
                try {
                    rows.addUnique(inconsistentEntry);
                } catch (final RowSpaceExceededException e) {
                    if (this.table == null) throw e;
                    this.table = null;
                    rows.addUnique(inconsistentEntry);
                }
            }
            report.add(rows);
        }
        // finally delete the affected rows, but start with largest id first, otherwise we overwrite wrong entries
View Full Code Here

        if (fos != null) try { fos.close(); } catch (final IOException e) {}

        this.file = new BufferedRecords(new Records(f, this.rowdef.objectsize), this.buffersize);

        // initialize index and copy table
        this.table = (this.table == null) ? null : new RowSet(this.taildef);
        this.index.clear();
    }
View Full Code Here

        }
    }
   
    public static Index selectTableType(final String dbe, final String tablename, final Row testRow) throws Exception {
        if (dbe.equals("kelondroRowSet")) {
            return new RowSet(testRow, 0);
        }
        if (dbe.equals("kelondroSplitTable")) {
            final File tablepath = new File(tablename).getParentFile();
            return new SplitTable(tablepath, new File(tablename).getName(), testRow, true, true);
        }
View Full Code Here

    }
   
    public ZURL(final SolrChardingConnector solrConnector) {
        this.solrConnector = solrConnector;
        // creates a new ZUR in RAM
        this.urlIndex = new RowSet(rowdef);
        this.stack = new ConcurrentLinkedQueue<byte[]>();
    }
View Full Code Here

    }

    public ZURL(final SolrShardingConnector solrConnector) {
        this.solrConnector = solrConnector;
        // creates a new ZUR in RAM
        this.urlIndex = new RowSet(rowdef);
        this.stack = new ConcurrentLinkedQueue<byte[]>();
    }
View Full Code Here

        }
    }

    public static Index selectTableType(final String dbe, final String tablename, final Row testRow) throws Exception {
        if (dbe.equals("kelondroRowSet")) {
            return new RowSet(testRow, 0);
        }
        if (dbe.equals("kelondroSplitTable")) {
            final File tablepath = new File(tablename).getParentFile();
            return new SplitTable(tablepath, new File(tablename).getName(), testRow, true, true);
        }
View Full Code Here

     * return an index container
     * because they may get very large, it is wise to deallocate some memory before calling next()
     */
    public ReferenceContainer<ReferenceType> next0() {
        if (this.blobs == null) return null;
        RowSet row;
        Map.Entry<byte[], byte[]> entry;
        while (this.blobs.hasNext()) {
            entry = this.blobs.next();
            if (entry == null) break;
            try {
View Full Code Here

            // initialize index and copy table
            final int  records = Math.max(fileSize, initialSpace);
            final long neededRAM4table = (records) * ((rowdef.objectsize) + 4L) * 3L;
            this.table = ((exceed134217727 || neededRAM4table < maxarraylength) &&
                     (useTailCache && MemoryControl.available() > neededRAM4table + 200 * 1024 * 1024)) ?
                    new RowSet(this.taildef, records) : null;
            Log.logInfo("TABLE", "initialization of " + tablefile.getName() + ". table copy: " + ((this.table == null) ? "no" : "yes") + ", available RAM: " + (MemoryControl.available() / 1024 / 1024) + "MB, needed: " + (neededRAM4table/1024/1024 + 200) + "MB, allocating space for " + records + " entries");
            final long neededRAM4index = 400 * 1024 * 1024 + records * (rowdef.primaryKeyLength + 4) * 3 / 2;
            if (!MemoryControl.request(neededRAM4index, false)) {
                // despite calculations seemed to show that there is enough memory for the table AND the index
                // there is now not enough memory left for the index. So delete the table again to free the memory
View Full Code Here

TOP

Related Classes of net.yacy.kelondro.index.RowSet

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.