From: <tho...@us...> - 2012-12-12 17:53:30
|
Revision: 6764 http://bigdata.svn.sourceforge.net/bigdata/?rev=6764&view=rev Author: thompsonbry Date: 2012-12-12 17:53:16 +0000 (Wed, 12 Dec 2012) Log Message: ----------- => done: DumpJournal w/o -pages should give the table w/o the averages per node/leaf, etc. This required some GIST changes. In particular, I added dumpPages(recursive:boolean) to ICheckpointProtocol, factored out an ICheckpoint interface, made IndexSegmentCheckpoint an implementation of the ICheckpoint interface and made IndexSegment implement ICheckpointProtocol. Bug fix to DumpJournal where it was closing stdout. => DumpJournal w/ prefix (StatusServlet) Any &dumpNamespace=NAMESPACE URL query parameters will be used to dump only the specified namespaces. The namespace parameter here is a *prefix*. Any index having any of the specified prefixes will be dumped. When &dumpPages is also specified, the pages for the indices covered by the namespace prefix will be dumped. For example, this will only dump the statement indices for the "kb" triple store instance. http://localhost:8080/status?dumpJournal&dumpNamespace=kb.spo While this will dump the indices for two different KBs (if they exist). http://localhost:8080/status?dumpJournal&dumpNamespace=kb1&dumpNamespace=kb2 => done. index.html - added link for the VoID graph of the known KBs. => done. Sparql endpoint for tenants does provide their ServiceDescription. The trailing /sparql path component was not being recognized and the URL was being treated as a linked data query and turned into a DESCRIBE of that sparql endpoint rather than a SERVICE DESCRIPTION request for that end point. @see https://sourceforge.net/apps/trac/bigdata/ticket/585 (GIST) Modified Paths: -------------- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/bop/solutions/SolutionSetStream.java branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/AbstractBTree.java branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/Checkpoint.java branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/ICheckpointProtocol.java branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/ISimpleTreeIndexAccess.java branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/IndexSegment.java branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/IndexSegmentCheckpoint.java branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/PageStats.java branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/htree/HTree.java branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/journal/DumpJournal.java branches/BIGDATA_RELEASE_1_2_0/bigdata/src/test/com/bigdata/htree/TestHTreeWithMemStore.java branches/BIGDATA_RELEASE_1_2_0/bigdata/src/test/com/bigdata/journal/TestDumpJournal.java branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/RESTServlet.java branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/StatusServlet.java branches/BIGDATA_RELEASE_1_2_0/bigdata-war/src/html/index.html Added Paths: ----------- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/BaseIndexStats.java branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/ICheckpoint.java Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/bop/solutions/SolutionSetStream.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/bop/solutions/SolutionSetStream.java 2012-12-10 14:43:49 UTC (rev 6763) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/bop/solutions/SolutionSetStream.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -40,6 +40,7 @@ import com.bigdata.bop.IBindingSet; import com.bigdata.bop.IConstant; import com.bigdata.bop.IVariable; +import com.bigdata.btree.BaseIndexStats; import com.bigdata.btree.Checkpoint; import com.bigdata.btree.IndexMetadata; import com.bigdata.io.SerializerUtil; @@ -459,6 +460,11 @@ } + @Override + public BaseIndexStats dumpPages(final boolean recursive) { + return new BaseIndexStats(this); + } + /* * I've commented out the AccessPath and Predicate abstractions for now. * They were not required to implement the SPARQL CACHE mechanism, but Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/AbstractBTree.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/AbstractBTree.java 2012-12-10 14:43:49 UTC (rev 6763) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/AbstractBTree.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -136,7 +136,8 @@ * @see KeyBuilder */ abstract public class AbstractBTree implements IIndex, IAutoboxBTree, - ILinearList, IBTreeStatistics, ILocalBTreeView, ISimpleTreeIndexAccess { + ILinearList, IBTreeStatistics, ILocalBTreeView, ISimpleTreeIndexAccess, + ICheckpointProtocol { /** * The index is already closed. @@ -1507,8 +1508,14 @@ } @Override - public PageStats dumpPages() { + public BaseIndexStats dumpPages(final boolean recursive) { + if(!recursive) { + + return new BaseIndexStats(this); + + } + final BTreePageStats stats = new BTreePageStats(); dumpPages(this, getRoot(), stats); Added: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/BaseIndexStats.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/BaseIndexStats.java (rev 0) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/BaseIndexStats.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -0,0 +1,166 @@ +/** + +Copyright (C) SYSTAP, LLC 2006-2007. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +package com.bigdata.btree; + + +/** + * Basic stats that are available for all index types and whose collection does + * not require visitation of the index pages. + * + * @author <a href="mailto:tho...@us...">Bryan Thompson</a> + */ +public class BaseIndexStats { + + /** The type of index. */ + public IndexTypeEnum indexType; + /** + * The name associated with the index -or- <code>null</code> if the index is + * not named. + */ + public String name; + /** + * The current branching factor for the index. + * + * TODO GIST: [m] is BTree specific. The [addressBits] concept is the + * parallel for the HTree. This field should probably be moved into the + * concrete instances of the {@link PageStats} class. + */ + public int m; + /** The #of entries in the index. */ + public long ntuples; + /** The height (aka depth) of the index */ + public int height; + /** The #of nodes visited. */ + public long nnodes; + /** The #of leaves visited. */ + public long nleaves; + + /** + * Zero-arg constructor does NOT initialize the fields. + */ + public BaseIndexStats() { + + } + + /** + * Initializes the fields for the specified index. + */ + public BaseIndexStats(final ICheckpointProtocol ndx) { + + if (ndx == null) + throw new IllegalArgumentException(); + + final ICheckpoint checkpoint = ndx.getCheckpoint(); + + final IndexMetadata metadata = ndx.getIndexMetadata(); + + this.indexType = checkpoint.getIndexType(); + + this.name = metadata.getName(); + + switch (indexType) { + case BTree: + this.m = metadata.getBranchingFactor(); + break; + case HTree: + m = ((HTreeIndexMetadata) metadata).getAddressBits(); + break; + case Stream: + m = 0; // N/A + break; + default: + throw new AssertionError("Unknown indexType=" + indexType); + } + + /* + * Note: The "height" of the HTree must be computed dynamically since + * the HTree is not a balanced tree. It will be reported as ZERO (0) + * using this logic. + */ + this.height = checkpoint.getHeight(); + + this.ntuples = checkpoint.getEntryCount(); + + this.nnodes = checkpoint.getNodeCount(); + + this.nleaves = checkpoint.getLeafCount(); + + } + + /** + * Return the header row for a table. + * + * @return The header row. + */ + public String getHeaderRow() { + + final StringBuilder sb = new StringBuilder(); + + sb.append("name"); + sb.append('\t'); + sb.append("indexType"); + sb.append('\t'); + sb.append("m"); + sb.append('\t'); + sb.append("height"); + sb.append('\t'); + sb.append("nnodes"); + sb.append('\t'); + sb.append("nleaves"); + sb.append('\t'); + sb.append("nentries"); + + return sb.toString(); + } + + /** + * Return a row of data for an index as aggregated by this {@link PageStats} + * object. + * + * @see #getHeaderRow() + */ + public String getDataRow() { + + final BaseIndexStats stats = this; + + final StringBuilder sb = new StringBuilder(); + + sb.append(name); + sb.append('\t'); + sb.append(indexType); + sb.append('\t'); + sb.append(stats.m); + sb.append('\t'); + sb.append(stats.height); + sb.append('\t'); + sb.append(stats.nnodes); + sb.append('\t'); + sb.append(stats.nleaves); + sb.append('\t'); + sb.append(stats.ntuples); + + return sb.toString(); + } + +} Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/Checkpoint.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/Checkpoint.java 2012-12-10 14:43:49 UTC (rev 6763) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/Checkpoint.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -51,7 +51,7 @@ * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id$ */ -public class Checkpoint implements Externalizable { +public class Checkpoint implements ICheckpoint, Externalizable { /** * @@ -80,16 +80,6 @@ */ private IndexTypeEnum indexType; - /** - * The address used to read this {@link Checkpoint} record from the - * store. - * <p> - * Note: This is set as a side-effect by {@link #write(IRawStore)}. - * - * @throws IllegalStateException - * if the {@link Checkpoint} record has not been written on - * a store. - */ final public long getCheckpointAddr() { if (addrCheckpoint == 0L) { @@ -102,57 +92,30 @@ } - /** - * Return <code>true</code> iff the checkpoint address is defined. - */ final public boolean hasCheckpointAddr() { - return addrCheckpoint != 0L; + return addrCheckpoint != 0L; } - /** - * Address that can be used to read the {@link IndexMetadata} record for - * the index from the store. - */ final public long getMetadataAddr() { return addrMetadata; } - /** - * Address of the root node or leaf of the {@link BTree}. - * - * @return The address of the root -or- <code>0L</code> iff the btree - * does not have a root. - */ final public long getRootAddr() { return addrRoot; } - /** - * Address of the {@link IBloomFilter}. - * - * @return The address of the bloom filter -or- <code>0L</code> iff the - * btree does not have a bloom filter. - */ final public long getBloomFilterAddr() { return addrBloomFilter; } - /** - * The height of a B+Tree. ZERO(0) means just a root leaf. Values greater - * than zero give the #of levels of abstract nodes. There is always one - * layer of leaves which is not included in this value. - * - * @return The global depth and ZERO (0) unless the checkpoint record is for - * an {@link IndexTypeEnum#BTree} - */ public final int getHeight() { switch (indexType) { @@ -164,12 +127,6 @@ } - /** - * The global depth of the root directory (HTree only). - * - * @return The global depth and ZERO (0) unless the checkpoint record is for - * an {@link IndexTypeEnum#HTree} - */ public final int getGlobalDepth() { switch (indexType) { @@ -181,59 +138,37 @@ } - /** - * The #of non-leaf nodes (B+Tree) or directories (HTree). - */ public final long getNodeCount() { return nnodes; } - /** - * The #of leaves (B+Tree) or hash buckets (HTree). - */ public final long getLeafCount() { return nleaves; } - /** - * The #of index entries (aka tuple count). - */ public final long getEntryCount() { return nentries; } - /** - * Return the value of the B+Tree local counter stored in the - * {@link Checkpoint} record. - */ public final long getCounter() { return counter; } - /** - * Return the value of the next record version number to be assigned that is - * stored in the {@link Checkpoint} record. This number is incremented each - * time a node or leaf is written onto the backing store. The initial value - * is ZERO (0). The first value assigned to a node or leaf will be ZERO (0). - */ public final long getRecordVersion() { return counter; } - /** - * The type of index for this checkpoint record. - */ - public IndexTypeEnum getIndexType() { + public final IndexTypeEnum getIndexType() { return indexType; Added: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/ICheckpoint.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/ICheckpoint.java (rev 0) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/ICheckpoint.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -0,0 +1,128 @@ +/** + +Copyright (C) SYSTAP, LLC 2006-2007. All rights reserved. + +Contact: + SYSTAP, LLC + 4501 Tower Road + Greensboro, NC 27410 + lic...@bi... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +/* + * Created on Nov 15, 2006 + */ +package com.bigdata.btree; + +import com.bigdata.rawstore.IRawStore; + +/** + * Metadata for an index checkpoint record. + * + * @author <a href="mailto:tho...@us...">Bryan Thompson</a> + */ +public interface ICheckpoint { + + /** + * The address used to read this {@link Checkpoint} record from the store. + * <p> + * Note: This is set as a side-effect by {@link #write(IRawStore)}. + * + * @throws IllegalStateException + * if the {@link Checkpoint} record has not been written on a + * store. + */ + long getCheckpointAddr(); + + /** + * Return <code>true</code> iff the checkpoint address is defined. + */ + boolean hasCheckpointAddr(); + + /** + * Address that can be used to read the {@link IndexMetadata} record for the + * index from the store. + */ + long getMetadataAddr(); + + /** + * Address of the root node or leaf of the {@link BTree}. + * + * @return The address of the root -or- <code>0L</code> iff the index does + * not have a root page. + */ + long getRootAddr(); + + /** + * Address of the {@link IBloomFilter}. + * + * @return The address of the bloom filter -or- <code>0L</code> iff the + * index does not have a bloom filter. + */ + long getBloomFilterAddr(); + + /** + * The height of a B+Tree. ZERO(0) means just a root leaf. Values greater + * than zero give the #of levels of abstract nodes. There is always one + * layer of leaves which is not included in this value. + * + * @return The global depth and ZERO (0) unless the checkpoint record is for + * an {@link IndexTypeEnum#BTree} + */ + int getHeight(); + + /** + * The global depth of the root directory (HTree only). + * + * @return The global depth and ZERO (0) unless the checkpoint record is for + * an {@link IndexTypeEnum#HTree} + */ + int getGlobalDepth(); + + /** + * The #of non-leaf nodes (B+Tree) or directories (HTree). + */ + long getNodeCount(); + + /** + * The #of leaves (B+Tree) or hash buckets (HTree). + */ + long getLeafCount(); + + /** + * The #of index entries (aka tuple count). + */ + long getEntryCount(); + + /** + * Return the value of the B+Tree local counter stored in the + * {@link Checkpoint} record. + */ + long getCounter(); + + /** + * Return the value of the next record version number to be assigned that is + * stored in the {@link Checkpoint} record. This number is incremented each + * time a node or leaf is written onto the backing store. The initial value + * is ZERO (0). The first value assigned to a node or leaf will be ZERO (0). + */ + long getRecordVersion(); + + /** + * The type of index for this checkpoint record. + */ + IndexTypeEnum getIndexType(); + +} Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/ICheckpointProtocol.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/ICheckpointProtocol.java 2012-12-10 14:43:49 UTC (rev 6763) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/ICheckpointProtocol.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -56,12 +56,12 @@ public long getRecordVersion(); /** - * Returns the most recent {@link Checkpoint} record. + * Returns the most recent {@link ICheckpoint} record. * - * @return The most recent {@link Checkpoint} record and never + * @return The most recent {@link ICheckpoint} record and never * <code>null</code>. */ - public Checkpoint getCheckpoint(); + public ICheckpoint getCheckpoint(); /** * The address at which the most recent {@link IndexMetadata} record was @@ -241,5 +241,17 @@ * @see #reopen() */ public boolean isOpen(); + + /** + * Reports statistics for the index. + * + * @param recursive + * When <code>true</code>, also collects statistics on the pages + * (nodes and leaves) using a low-level approach. + * + * @return Some interesting statistics about the index (and optionally the + * pages in that index) which the caller can print out. + */ + BaseIndexStats dumpPages(boolean recursive); } Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/ISimpleTreeIndexAccess.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/ISimpleTreeIndexAccess.java 2012-12-10 14:43:49 UTC (rev 6763) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/ISimpleTreeIndexAccess.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -78,15 +78,4 @@ */ int getHeight(); - /** - * Visits pages (nodes and leaves) using a low-level approach. - * - * @param ndx - * The index. - * - * @return Some interesting statistics about the pages in that index which - * the caller can print out. - */ - PageStats dumpPages(); - } Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/IndexSegment.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/IndexSegment.java 2012-12-10 14:43:49 UTC (rev 6763) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/IndexSegment.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -37,7 +37,6 @@ import com.bigdata.service.Event; import com.bigdata.service.EventResource; import com.bigdata.service.EventType; -import com.bigdata.striterator.ICloseableIterator; /** * An index segment is read-only btree corresponding to some key range of a @@ -122,6 +121,7 @@ // // } + @Override final public int getHeight() { // Note: fileStore.checkpoint is now final. reopen() is not required. // reopen(); @@ -130,6 +130,7 @@ } + @Override final public long getNodeCount() { // Note: fileStore.checkpoint is now final. reopen() is not required. // reopen(); @@ -138,6 +139,7 @@ } + @Override final public long getLeafCount() { // Note: fileStore.checkpoint is now final. reopen() is not required. // reopen(); @@ -146,6 +148,7 @@ } + @Override final public long getEntryCount() { // Note: fileStore.checkpoint is now final. reopen() is not required. // reopen(); @@ -154,6 +157,58 @@ } + @Override + final public ICheckpoint getCheckpoint() { + + return fileStore.getCheckpoint(); + + } + + @Override + public long getRecordVersion() { + return getCheckpoint().getRecordVersion(); + } + + @Override + public long getMetadataAddr() { + return getCheckpoint().getMetadataAddr(); + } + + @Override + public long getRootAddr() { + return getCheckpoint().getRootAddr(); + } + + @Override + public void setLastCommitTime(long lastCommitTime) { + throw new UnsupportedOperationException(ERROR_READ_ONLY); + } + + @Override + public long writeCheckpoint() { + throw new UnsupportedOperationException(ERROR_READ_ONLY); + } + + @Override + public Checkpoint writeCheckpoint2() { + throw new UnsupportedOperationException(ERROR_READ_ONLY); + } + + @Override + public IDirtyListener getDirtyListener() { + throw new UnsupportedOperationException(ERROR_READ_ONLY); + } + + @Override + public void setDirtyListener(IDirtyListener listener) { + throw new UnsupportedOperationException(ERROR_READ_ONLY); + } + + @Override + public long handleCommit(long commitTime) { + throw new UnsupportedOperationException(ERROR_READ_ONLY); + } + /** * {@inheritDoc} * <p> Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/IndexSegmentCheckpoint.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/IndexSegmentCheckpoint.java 2012-12-10 14:43:49 UTC (rev 6763) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/IndexSegmentCheckpoint.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -57,7 +57,7 @@ * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id$ */ -public class IndexSegmentCheckpoint { +public class IndexSegmentCheckpoint implements ICheckpoint { /** * Logger. @@ -1033,4 +1033,94 @@ return sb.toString(); } + /** + * {@inheritDoc} + * <p> + * Note: The checkpoint is assembled from the root block by the constructor. + * There is no address from which it can be re-read. + * + * @return <code>0L</code> + */ + @Override + public long getCheckpointAddr() { + return 0L; + } + + /** + * {@inheritDoc} + * <p> + * Note: The checkpoint is assembled from the root block by the constructor. + * There is no address from which it can be re-read. + * + * @return <code>false</code> + */ + @Override + public boolean hasCheckpointAddr() { + return false; + } + + @Override + public long getMetadataAddr() { + return addrMetadata; + } + + @Override + public long getRootAddr() { + return addrRoot; + } + + @Override + public long getBloomFilterAddr() { + return addrBloom; + } + + @Override + public int getHeight() { + return height; + } + + @Override + public int getGlobalDepth() { + return 0; // ZERO since not HTree. + } + + @Override + public long getNodeCount() { + return nnodes; + } + + @Override + public long getLeafCount() { + return nleaves; + } + + @Override + public long getEntryCount() { + return nentries; + } + + /** + * {@inheritDoc} + * <p> + * Note: There is no counter associated with an {@link IndexSegment}. The + * counter is only available for the {@link BTree}. + * + * @return <code>0L</code> + */ + @Override + public long getCounter() { + return 0; + } + + @Override + public long getRecordVersion() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public IndexTypeEnum getIndexType() { + return IndexTypeEnum.BTree; + } + } Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/PageStats.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/PageStats.java 2012-12-10 14:43:49 UTC (rev 6763) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/btree/PageStats.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -29,33 +29,10 @@ /** * Class reports various summary statistics for nodes and leaves. */ -abstract public class PageStats { +abstract public class PageStats extends BaseIndexStats { /** Number of nodes/leaves visited so far. */ public long nvisited; - /** The type of index. */ - public IndexTypeEnum indexType; - /** - * The name associated with the index -or- <code>null</code> if the index is - * not named. - */ - public String name; - /** - * The current branching factor for the index. - * - * TODO GIST: [m] is BTree specific. The [addressBits] concept is the - * parallel for the HTree. This field should probably be moved into the - * concrete instances of the {@link PageStats} class. - */ - public int m; - /** The #of entries in the index. */ - public long ntuples; - /** The height (aka depth) of the index */ - public int height; - /** The #of nodes visited. */ - public long nnodes; - /** The #of leaves visited. */ - public long nleaves; /** The #of bytes in the raw records for the nodes visited. */ public long nodeBytes; /** The #of bytes in the raw records for the leaves visited. */ @@ -178,7 +155,8 @@ * * @return The header row. */ - public static String getHeaderRow() { + @Override + public String getHeaderRow() { final StringBuilder sb = new StringBuilder(); @@ -242,6 +220,7 @@ * * @see #getHeaderRow() */ + @Override public String getDataRow() { final PageStats stats = this; Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/htree/HTree.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/htree/HTree.java 2012-12-10 14:43:49 UTC (rev 6763) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/htree/HTree.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -42,6 +42,7 @@ import com.bigdata.btree.AbstractNode; import com.bigdata.btree.BTree; import com.bigdata.btree.BTreeCounters; +import com.bigdata.btree.BaseIndexStats; import com.bigdata.btree.BytesUtil; import com.bigdata.btree.Checkpoint; import com.bigdata.btree.HTreeIndexMetadata; @@ -54,7 +55,6 @@ import com.bigdata.btree.IndexTypeEnum; import com.bigdata.btree.Leaf; import com.bigdata.btree.Node; -import com.bigdata.btree.PageStats; import com.bigdata.btree.ReadOnlyCounter; import com.bigdata.btree.UnisolatedReadWriteIndex; import com.bigdata.btree.keys.IKeyBuilder; @@ -1698,8 +1698,14 @@ } @Override - public PageStats dumpPages() { + public BaseIndexStats dumpPages(final boolean recursive) { + if (!recursive) { + + return new BaseIndexStats(this); + + } + final HTreePageStats stats = new HTreePageStats(); getRoot().dumpPages(stats); Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/journal/DumpJournal.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/journal/DumpJournal.java 2012-12-10 14:43:49 UTC (rev 6763) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/java/com/bigdata/journal/DumpJournal.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -44,13 +44,12 @@ import org.apache.log4j.Logger; import com.bigdata.btree.AbstractBTree; +import com.bigdata.btree.BaseIndexStats; import com.bigdata.btree.BytesUtil; import com.bigdata.btree.DumpIndex; import com.bigdata.btree.ICheckpointProtocol; -import com.bigdata.btree.ISimpleTreeIndexAccess; import com.bigdata.btree.ITupleIterator; import com.bigdata.btree.IndexTypeEnum; -import com.bigdata.btree.PageStats; import com.bigdata.htree.AbstractHTree; import com.bigdata.io.SerializerUtil; import com.bigdata.rawstore.Bytes; @@ -342,7 +341,8 @@ } finally { - w.close(); + // Note: DO NOT close stdout! +// w.close(); } } @@ -649,9 +649,8 @@ final Iterator<String> nitr = journal.indexNameScan(null/* prefix */, commitRecord.getTimestamp()); - final Map<String, PageStats> pageStats = dumpPages ? new TreeMap<String, PageStats>() - : null; - + final Map<String, BaseIndexStats> pageStats = new TreeMap<String, BaseIndexStats>(); + while (nitr.hasNext()) { // a registered index. @@ -726,19 +725,14 @@ * then we could generate (parts of) this table very quickly. As it * stands, we have to actually scan the pages in the index. */ - if (ndx instanceof ISimpleTreeIndexAccess) { + { - if (pageStats != null) { + final BaseIndexStats stats = ndx.dumpPages(dumpPages); - final PageStats stats = ((ISimpleTreeIndexAccess) ndx) - .dumpPages(); + out.println("\t" + stats); - out.println("\t" + stats); + pageStats.put(name, stats); - pageStats.put(name, stats); - - } - if (dumpIndices) { if (ndx instanceof AbstractBTree) { @@ -757,18 +751,18 @@ } // while(itr) (next index) - if (pageStats != null) { + { /* * Write out the header. */ - out.println(PageStats.getHeaderRow()); + boolean first = true; - for (Map.Entry<String, PageStats> e : pageStats.entrySet()) { + for (Map.Entry<String, BaseIndexStats> e : pageStats.entrySet()) { final String name = e.getKey(); - final PageStats stats = e.getValue(); + final BaseIndexStats stats = e.getValue(); if (stats == null) { @@ -787,6 +781,14 @@ } + if (first) { + + out.println(stats.getHeaderRow()); + + first = false; + + } + /* * Write out the stats for this index. */ Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/test/com/bigdata/htree/TestHTreeWithMemStore.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/test/com/bigdata/htree/TestHTreeWithMemStore.java 2012-12-10 14:43:49 UTC (rev 6763) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/test/com/bigdata/htree/TestHTreeWithMemStore.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -34,13 +34,13 @@ import org.apache.log4j.Logger; import com.bigdata.btree.BTreeCounters; +import com.bigdata.btree.BaseIndexStats; import com.bigdata.btree.BytesUtil; import com.bigdata.btree.DefaultTupleSerializer; import com.bigdata.btree.HTreeIndexMetadata; import com.bigdata.btree.ITuple; import com.bigdata.btree.ITupleIterator; import com.bigdata.btree.ITupleSerializer; -import com.bigdata.btree.PageStats; import com.bigdata.btree.keys.ASCIIKeyBuilderFactory; import com.bigdata.btree.keys.IKeyBuilder; import com.bigdata.btree.keys.KeyBuilder; @@ -472,7 +472,7 @@ htree.writeCheckpoint(); // Verify that we can compute the page stats. - final PageStats stats = htree.dumpPages(); + final BaseIndexStats stats = htree.dumpPages(true/*recursive*/); if (log.isInfoEnabled()) log.info(stats.toString()); Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata/src/test/com/bigdata/journal/TestDumpJournal.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata/src/test/com/bigdata/journal/TestDumpJournal.java 2012-12-10 14:43:49 UTC (rev 6763) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata/src/test/com/bigdata/journal/TestDumpJournal.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -265,6 +265,11 @@ .dumpJournal(true/* dumpHistory */, true/* dumpPages */, true/* dumpIndices */, false/* showTuples */); + // test again w/o dumpPages + new DumpJournal(src) + .dumpJournal(true/* dumpHistory */, false/* dumpPages */, + true/* dumpIndices */, false/* showTuples */); + } finally { src.destroy(); Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/RESTServlet.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/RESTServlet.java 2012-12-10 14:43:49 UTC (rev 6763) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/RESTServlet.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -128,11 +128,16 @@ /* * Look for linked data GET requests. + * + * Note: URIs ending in /sparql are *assumed* to be SPARQL end points on + * this server. A GET against a SPARQL end point is a SERVICE + * DESCRIPTION request (not a DESCRIBE) and will be handled by the + * QueryServlet. */ final String pathInfo = req.getPathInfo(); - if (pathInfo != null) { + if (pathInfo != null && !pathInfo.endsWith("/sparql")) { final URI uri = new URIImpl(req.getRequestURL().toString()); Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/StatusServlet.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/StatusServlet.java 2012-12-10 14:43:49 UTC (rev 6763) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/StatusServlet.java 2012-12-12 17:53:16 UTC (rev 6764) @@ -32,6 +32,7 @@ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -107,6 +108,15 @@ private static final String DUMP_PAGES = "dumpPages"; /** + * Restrict a low-level dump of the journal to only the indices having the + * specified namespace prefix. The {@link #DUMP_JOURNAL} option MUST also be + * specified. + * + * @see DumpJournal + */ + private static final String DUMP_NAMESPACE = "dumpNamespace"; + + /** * The name of a request parameter used to request a display of the * currently running queries. Legal values for this request parameter are * either {@value #DETAILS} or no value. @@ -332,11 +342,35 @@ true/* autoFlush */); out.print("<pre>\n"); - - final DumpJournal dump = new DumpJournal((Journal) getIndexManager()); - final List<String> namespaces = Collections.emptyList(); - + final DumpJournal dump = new DumpJournal( + (Journal) getIndexManager()); + + final List<String> namespaces; + + // Add in any specified namespace(s) (defaults to all). + { + + final String[] a = req.getParameterValues(DUMP_NAMESPACE); + + if (a == null) { + + namespaces = Collections.emptyList(); + + } else { + + namespaces = new LinkedList<String>(); + + for (String namespace : a) { + + namespaces.add(namespace); + + } + + } + + } + final boolean dumpHistory = false; final boolean dumpPages = req.getParameter(DUMP_PAGES) != null; Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata-war/src/html/index.html =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata-war/src/html/index.html 2012-12-10 14:43:49 UTC (rev 6763) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata-war/src/html/index.html 2012-12-12 17:53:16 UTC (rev 6764) @@ -22,6 +22,8 @@ <dd>This page.</dd> <dt>http://hostname:port/bigdata/sparql</dt> <dd>The SPARQL REST API (<a href="sparql">Service Description</a>).</dd> +<dt>http://hostname:port/bigdata/namespace</dt> +<dd>VoID <a href="namespace">graph of available KBs</a> from this service.</dd> <dt>http://hostname:port/bigdata/status</dt> <dd>A <a href="status">status</a> page.</dd> <dt>http://hostname:port/bigdata/counters</dt> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |