From: <tho...@us...> - 2010-08-04 12:26:53
|
Revision: 3404 http://bigdata.svn.sourceforge.net/bigdata/?rev=3404&view=rev Author: thompsonbry Date: 2010-08-04 12:26:44 +0000 (Wed, 04 Aug 2010) Log Message: ----------- Javadoc edits on OverflowManager and StoreManager, both of which initialize a thread pool in their ctors. Btree.load() was modified to report more information if it is unable to load a Checkpoint or IndexMetadata record. AbstractResourceManagerBootstrapTestCase was turning off the write cache (for dated reasons). The current WORMStrategy has a bug which prevents correct operation when the write cache is disabled (this is fixed in the HA branch). That bug was causing failures in the com.bigdata.resources.TestAll() suite. Modified Paths: -------------- trunk/bigdata/src/java/com/bigdata/btree/BTree.java trunk/bigdata/src/java/com/bigdata/resources/OverflowManager.java trunk/bigdata/src/java/com/bigdata/resources/StoreManager.java trunk/bigdata/src/test/com/bigdata/resources/AbstractResourceManagerBootstrapTestCase.java Modified: trunk/bigdata/src/java/com/bigdata/btree/BTree.java =================================================================== --- trunk/bigdata/src/java/com/bigdata/btree/BTree.java 2010-08-04 11:32:44 UTC (rev 3403) +++ trunk/bigdata/src/java/com/bigdata/btree/BTree.java 2010-08-04 12:26:44 UTC (rev 3404) @@ -1525,45 +1525,63 @@ } - /** - * Load an instance of a {@link BTree} or derived class from the store. The - * {@link BTree} or derived class MUST declare a constructor with the - * following signature: <code> + /** + * Load an instance of a {@link BTree} or derived class from the store. The + * {@link BTree} or derived class MUST declare a constructor with the + * following signature: <code> * * <i>className</i>(IRawStore store, Checkpoint checkpoint, BTreeMetadata metadata, boolean readOnly) * * </code> - * - * @param store - * The store. - * @param addrCheckpoint - * The address of a {@link Checkpoint} record for the index. - * @param readOnly - * When <code>true</code> the {@link BTree} will be marked as - * read-only. Marking has some advantages relating to the locking - * scheme used by {@link Node#getChild(int)} since the root node - * is known to be read-only at the time that it is allocated as - * per-child locking is therefore in place for all nodes in the - * read-only {@link BTree}. It also results in much higher - * concurrency for {@link AbstractBTree#touch(AbstractNode)}. - * - * @return The {@link BTree} or derived class loaded from that - * {@link Checkpoint} record. - */ + * + * @param store + * The store. + * @param addrCheckpoint + * The address of a {@link Checkpoint} record for the index. + * @param readOnly + * When <code>true</code> the {@link BTree} will be marked as + * read-only. Marking has some advantages relating to the locking + * scheme used by {@link Node#getChild(int)} since the root node + * is known to be read-only at the time that it is allocated as + * per-child locking is therefore in place for all nodes in the + * read-only {@link BTree}. It also results in much higher + * concurrency for {@link AbstractBTree#touch(AbstractNode)}. + * + * @return The {@link BTree} or derived class loaded from that + * {@link Checkpoint} record. + * + * @throws IllegalArgumentException + * if store is <code>null</code>. + */ @SuppressWarnings("unchecked") public static BTree load(final IRawStore store, final long addrCheckpoint, final boolean readOnly) { + if (store == null) + throw new IllegalArgumentException(); + /* * Read checkpoint record from store. */ - final Checkpoint checkpoint = Checkpoint.load(store, addrCheckpoint); + final Checkpoint checkpoint; + try { + checkpoint = Checkpoint.load(store, addrCheckpoint); + } catch (Throwable t) { + throw new RuntimeException("Could not load Checkpoint: store=" + + store + ", addrCheckpoint=" + + store.toString(addrCheckpoint), t); + } - /* - * Read metadata record from store. - */ - final IndexMetadata metadata = IndexMetadata.read(store, checkpoint - .getMetadataAddr()); + /* + * Read metadata record from store. + */ + final IndexMetadata metadata; + try { + metadata = IndexMetadata.read(store, checkpoint.getMetadataAddr()); + } catch (Throwable t) { + throw new RuntimeException("Could not read IndexMetadata: store=" + + store + ", checkpoint=" + checkpoint, t); + } if (log.isInfoEnabled()) { Modified: trunk/bigdata/src/java/com/bigdata/resources/OverflowManager.java =================================================================== --- trunk/bigdata/src/java/com/bigdata/resources/OverflowManager.java 2010-08-04 11:32:44 UTC (rev 3403) +++ trunk/bigdata/src/java/com/bigdata/resources/OverflowManager.java 2010-08-04 12:26:44 UTC (rev 3404) @@ -1704,7 +1704,7 @@ } if(overflowEnabled) { - + // @todo defer allocation until init() outside of ctor. overflowService = Executors.newFixedThreadPool(1, new DaemonThreadFactory((serviceName == null ? "" : serviceName + "-") Modified: trunk/bigdata/src/java/com/bigdata/resources/StoreManager.java =================================================================== --- trunk/bigdata/src/java/com/bigdata/resources/StoreManager.java 2010-08-04 11:32:44 UTC (rev 3403) +++ trunk/bigdata/src/java/com/bigdata/resources/StoreManager.java 2010-08-04 12:26:44 UTC (rev 3404) @@ -674,7 +674,7 @@ protected final long accelerateOverflowThreshold; /** - * Used to run the {@link Startup}. + * Used to run the {@link Startup}. @todo defer to init() outside of ctor. Also, defer {@link Startup} until init() outside of ctor. */ private final ExecutorService startupService = Executors .newSingleThreadExecutor(new DaemonThreadFactory @@ -1420,7 +1420,7 @@ log.info("Waiting for concurrency manager"); for (int i = 0; i < 5; i++) { try { - getConcurrencyManager(); + getConcurrencyManager(); break; } catch (IllegalStateException ex) { Thread.sleep(100/* ms */); } Modified: trunk/bigdata/src/test/com/bigdata/resources/AbstractResourceManagerBootstrapTestCase.java =================================================================== --- trunk/bigdata/src/test/com/bigdata/resources/AbstractResourceManagerBootstrapTestCase.java 2010-08-04 11:32:44 UTC (rev 3403) +++ trunk/bigdata/src/test/com/bigdata/resources/AbstractResourceManagerBootstrapTestCase.java 2010-08-04 12:26:44 UTC (rev 3404) @@ -59,14 +59,15 @@ Properties properties = new Properties(super.getProperties()); - log.info("Setting " + Options.DATA_DIR + "=" + dataDir); - + if (log.isInfoEnabled()) + log.info("Setting " + Options.DATA_DIR + "=" + dataDir); + properties.setProperty( com.bigdata.resources.ResourceManager.Options.DATA_DIR, dataDir .toString()); - // disable the write cache to avoid memory leak in the test suite. - properties.setProperty(Options.WRITE_CACHE_ENABLED, "false"); +// // disable the write cache to avoid memory leak in the test suite. +// properties.setProperty(Options.WRITE_CACHE_ENABLED, "false"); return properties; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |