diff -Nru libdb-je-java-3.3.62/ant/internal.xml libdb-je-java-3.3.98/ant/internal.xml
--- libdb-je-java-3.3.62/ant/internal.xml 2008-01-17 05:41:40.000000000 +0000
+++ libdb-je-java-3.3.98/ant/internal.xml 2009-07-28 20:32:24.000000000 +0000
@@ -415,4 +415,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -Nru libdb-je-java-3.3.62/build.properties libdb-je-java-3.3.98/build.properties
--- libdb-je-java-3.3.62/build.properties 2007-10-24 11:47:30.000000000 +0000
+++ libdb-je-java-3.3.98/build.properties 2008-06-11 03:25:20.000000000 +0000
@@ -46,3 +46,9 @@
# when doing a full clover run of all tests.
##########################################################################
#clover.ignorefailure=true
+
+##########################################################################
+# Set logging.config.file to a configuration file which can change the
+# default logging configuration for all logging operations.
+##########################################################################
+#logging.config.file=rep.properties
diff -Nru libdb-je-java-3.3.62/build.xml libdb-je-java-3.3.98/build.xml
--- libdb-je-java-3.3.62/build.xml 2008-06-04 03:10:26.000000000 +0000
+++ libdb-je-java-3.3.98/build.xml 2010-01-22 00:29:56.000000000 +0000
@@ -805,6 +805,7 @@
errorProperty="unittest.failed"
failureProperty="unittest.failed"
haltOnFailure="false"
+ showoutput="true"
fork="yes">
+
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/collections/StoredMap.java libdb-je-java-3.3.98/src/com/sleepycat/collections/StoredMap.java
--- libdb-je-java-3.3.62/src/com/sleepycat/collections/StoredMap.java 2008-05-29 03:17:28.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/collections/StoredMap.java 2008-07-15 19:08:42.000000000 +0000
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000,2008 Oracle. All rights reserved.
*
- * $Id: StoredMap.java,v 1.55 2008/05/29 03:17:27 linda Exp $
+ * $Id: StoredMap.java,v 1.55.2.1 2008/07/15 19:08:41 mark Exp $
*/
package com.sleepycat.collections;
@@ -35,7 +35,8 @@
*
* @author Mark Hayes
*/
-public class StoredMap extends StoredContainer implements Map {
+public class StoredMap extends StoredContainer
+ implements ConcurrentMap {
private StoredKeySet keySet;
private StoredEntrySet entrySet;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/APILockedException.java libdb-je-java-3.3.98/src/com/sleepycat/je/APILockedException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/APILockedException.java 2008-05-20 17:52:34.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/APILockedException.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: APILockedException.java,v 1.5 2008/05/20 17:52:34 linda Exp $
+ * $Id: APILockedException.java,v 1.5.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/BtreeStats.java libdb-je-java-3.3.98/src/com/sleepycat/je/BtreeStats.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/BtreeStats.java 2008-01-24 14:59:28.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/BtreeStats.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: BtreeStats.java,v 1.15 2008/01/24 14:59:27 linda Exp $
+ * $Id: BtreeStats.java,v 1.15.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/CacheMode.java libdb-je-java-3.3.98/src/com/sleepycat/je/CacheMode.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/CacheMode.java 2008-05-29 03:17:28.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/CacheMode.java 2010-03-26 13:23:54.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: CacheMode.java,v 1.2 2008/05/29 03:17:28 linda Exp $
+ * $Id: CacheMode.java,v 1.2.2.4 2010/03/26 13:23:54 mark Exp $
*/
package com.sleepycat.je;
@@ -77,10 +77,39 @@
*
The record will have the same hotness as other records accessed with
* this cache mode. Its relative hotness will not be reduced over time as
* other records are accessed. It can only become colder over time if it
- * is subsequently accessed with the {@code DEFAULT} cache mode.
+ * is subsequently accessed with the {@code DEFAULT} or {@code MAKE_COLD}
+ * cache mode.
*
*
This cache mode is normally used when the application intends to
* access this record again soon.
*/
- KEEP_HOT
+ KEEP_HOT,
+
+ /**
+ * The record is assigned "maximum coldness" by the operation where this
+ * cache mode is specified.
+ *
+ *
The record will have the same hotness as other records accessed with
+ * this cache mode. It is very likely that this record will be evicted
+ * from the cache if space is needed. It can only become warmer over time
+ * if it is subsequently accessed with the {@code DEFAULT} or
+ * {@code KEEP_HOT} cache mode.
+ *
+ *
This cache mode is normally used when the application does not intend
+ * to access this record again soon.
+ */
+ MAKE_COLD,
+
+ /**
+ * The record (leaf node) is evicted as soon as possible after the
+ * operation where this cache mode is specified. If the record cannot be
+ * evicted immediately, it is assigned "maximum coldness" as if {@code
+ * MAKE_COLD} were used.
+ *
+ *
This cache mode is normally used when the application prefers to read
+ * the record from the log file when it is accessed again, rather than have
+ * it take up space in the JE cache and potentially cause expensive Java
+ * GC.
+ */
+ EVICT_LN
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/CheckpointConfig.java libdb-je-java-3.3.98/src/com/sleepycat/je/CheckpointConfig.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/CheckpointConfig.java 2008-05-29 03:38:24.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/CheckpointConfig.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: CheckpointConfig.java,v 1.19 2008/05/29 03:38:23 linda Exp $
+ * $Id: CheckpointConfig.java,v 1.20.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -121,4 +121,18 @@
public boolean getMinimizeRecoveryTime() {
return minimizeRecoveryTime;
}
+
+ /**
+ * Returns the values for each configuration attribute.
+ *
+ * @return the values for each configuration attribute.
+ */
+ @Override
+ public String toString() {
+ return "minutes=" + minutes +
+ "\nkBytes=" + kbytes +
+ "\nforce=" + force +
+ "\nminimizeRecoveryTime=" + minimizeRecoveryTime +
+ "\n";
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/BaseLocalUtilizationTracker.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/BaseLocalUtilizationTracker.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/BaseLocalUtilizationTracker.java 2008-05-15 01:52:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/BaseLocalUtilizationTracker.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: BaseLocalUtilizationTracker.java,v 1.8 2008/05/15 01:52:40 linda Exp $
+ * $Id: BaseLocalUtilizationTracker.java,v 1.8.2.4 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je.cleaner;
@@ -91,12 +91,16 @@
fileEntries.next();
Long fileNum = fileEntry.getKey();
- DbFileSummary localSummary = fileEntry.getValue();
DbFileSummary dbFileSummary =
db.getDbFileSummary(fileNum, true /*willModify*/);
- dbFileSummary.add(localSummary);
+ if (dbFileSummary != null) {
+ DbFileSummary localSummary = fileEntry.getValue();
+ dbFileSummary.add(localSummary);
+ }
}
}
+ /* Ensure that DbTree.releaseDb is called. [#16329] */
+ releaseDatabaseImpl(db);
/* This object is being discarded, subtract it from the budget. */
fileMap.subtractFromMemoryBudget();
}
@@ -104,30 +108,43 @@
/**
* Returns the DatabaseImpl from the database key, which is either the
- * DatabaseId or DatabaseImpl.
+ * DatabaseId or DatabaseImpl. The releaseDatabaseImpl must be called
+ * with the DatabaseImpl returned by this method.
*/
abstract DatabaseImpl databaseKeyToDatabaseImpl(Object databaseKey)
throws DatabaseException;
/**
+ * Must be called after calling databaseKeyToDatabaseImpl. The db
+ * parameter may be null, in which case no action is taken.
+ *
+ * If DbTree.getDb is called by the implementation of
+ * databaseKeyToDatabaseImpl, then DbTree.releaseDb must be called by the
+ * implementation of this method.
+ */
+ abstract void releaseDatabaseImpl(DatabaseImpl db);
+
+ /**
* Allocates DbFileSummary information locally in this object rather than
* in the DatabaseImpl.
*
* @param databaseKey is either a DatabaseId or DatabaseImpl depending on
* whether called from the RecoveryUtilizationTracker or
* LocalUtilizationTracker, respectively.
+ *
+ * @return the summary, or null if the databaseKey param is null.
*/
DbFileSummary getDbFileSummary(Object databaseKey, long fileNum) {
if (databaseKey != null) {
- DbFileSummaryMap fileMap =
- dbMap.get(databaseKey);
+ DbFileSummaryMap fileMap = dbMap.get(databaseKey);
if (fileMap == null) {
fileMap = new DbFileSummaryMap(true /* countParentMapEntry */);
fileMap.init(env);
dbMap.put(databaseKey, fileMap);
}
return fileMap.get
- (Long.valueOf(fileNum), true /* adjustMemBudget */);
+ (Long.valueOf(fileNum), true /*adjustMemBudget*/,
+ true /*checkResurrected*/, env.getFileManager());
} else {
return null;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/BaseUtilizationTracker.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/BaseUtilizationTracker.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/BaseUtilizationTracker.java 2008-05-15 01:52:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/BaseUtilizationTracker.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: BaseUtilizationTracker.java,v 1.10 2008/05/15 01:52:40 linda Exp $
+ * $Id: BaseUtilizationTracker.java,v 1.10.2.3 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je.cleaner;
@@ -105,13 +105,17 @@
if (isLNType(type)) {
fileSummary.totalLNCount += 1;
fileSummary.totalLNSize += size;
- dbFileSummary.totalLNCount += 1;
- dbFileSummary.totalLNSize += size;
+ if (dbFileSummary != null) {
+ dbFileSummary.totalLNCount += 1;
+ dbFileSummary.totalLNSize += size;
+ }
} else {
fileSummary.totalINCount += 1;
fileSummary.totalINSize += size;
- dbFileSummary.totalINCount += 1;
- dbFileSummary.totalINSize += size;
+ if (dbFileSummary != null) {
+ dbFileSummary.totalINCount += 1;
+ dbFileSummary.totalINSize += size;
+ }
}
}
/* Increment bytes and indicate whether to wakeup the cleaner. */
@@ -163,17 +167,19 @@
" type: " + type;
DbFileSummary dbFileSummary =
getDbFileSummary(databaseKey, fileNum);
- if (isLN) {
- dbFileSummary.obsoleteLNCount += 1;
- /* The size is optional when tracking obsolete LNs. */
- if (size > 0) {
- dbFileSummary.obsoleteLNSize += size;
- dbFileSummary.obsoleteLNSizeCounted += 1;
+ if (dbFileSummary != null) {
+ if (isLN) {
+ dbFileSummary.obsoleteLNCount += 1;
+ /* The size is optional when tracking obsolete LNs. */
+ if (size > 0) {
+ dbFileSummary.obsoleteLNSize += size;
+ dbFileSummary.obsoleteLNSizeCounted += 1;
+ }
+ } else {
+ dbFileSummary.obsoleteINCount += 1;
+ /* The size is not allowed when tracking obsolete INs. */
+ assert size == 0;
}
- } else {
- dbFileSummary.obsoleteINCount += 1;
- /* The size is not allowed when tracking obsolete INs. */
- assert size == 0;
}
}
}
@@ -250,6 +256,9 @@
* databaseKey as either the DatabaseImpl or a DatabaseId.
*
*
For the global tracker, must be called under the log write latch.
+ *
+ * @return the summary, or null if the DB should not be tracked because
+ * the file has been deleted.
*/
abstract DbFileSummary getDbFileSummary(Object databaseKey, long fileNum);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/Cleaner.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/Cleaner.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/Cleaner.java 2008-05-15 01:52:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/Cleaner.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Cleaner.java,v 1.213 2008/05/15 01:52:40 linda Exp $
+ * $Id: Cleaner.java,v 1.213.2.5 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je.cleaner;
@@ -22,6 +22,7 @@
import com.sleepycat.je.EnvironmentMutableConfig;
import com.sleepycat.je.EnvironmentStats;
import com.sleepycat.je.ExceptionListener;
+import com.sleepycat.je.RunRecoveryException;
import com.sleepycat.je.StatsConfig;
import com.sleepycat.je.cleaner.FileSelector.CheckpointStartCleanerState;
import com.sleepycat.je.config.EnvironmentParams;
@@ -100,7 +101,6 @@
* This could produce errors in counting, but avoids contention around stat
* updates.
*/
- int nBacklogFiles = 0;
long nCleanerRuns = 0;
long nCleanerDeletions = 0;
long nINsObsolete = 0;
@@ -141,11 +141,10 @@
boolean lazyMigration;
/**
- * All files that are to-be-cleaning or being-cleaned. Used to perform
- * proactive migration. Is read-only after assignment, so no
- * synchronization is needed.
+ * All files that are to-be-cleaned. Used to perform proactive migration.
+ * Is read-only after assignment, so no synchronization is needed.
*/
- private Set mustBeCleanedFiles = Collections.emptySet();
+ private Set toBeCleanedFiles = Collections.emptySet();
/**
* All files that are below the minUtilization threshold. Used to perform
@@ -291,6 +290,11 @@
return profile;
}
+ /** For unit testing. */
+ FileSelector getFileSelector() {
+ return fileSelector;
+ }
+
public boolean getFetchObsoleteSize() {
return fetchObsoleteSize;
}
@@ -393,7 +397,7 @@
public void loadStats(StatsConfig config, EnvironmentStats stat)
throws DatabaseException {
- stat.setCleanerBacklog(nBacklogFiles);
+ stat.setCleanerBacklog(getBacklog());
stat.setNCleanerRuns(nCleanerRuns);
stat.setNCleanerDeletions(nCleanerDeletions);
stat.setNINsObsolete(nINsObsolete);
@@ -443,13 +447,6 @@
}
/**
- * For unit testing.
- */
- void injectFileForCleaning(Long fileNum) {
- fileSelector.putBackFileForCleaning(fileNum);
- }
-
- /**
* Deletes all files that are safe-to-delete, if there are no read/only
* processes and concurrent backups.
*
@@ -594,13 +591,17 @@
}
}
- private void traceFileNotDeleted(Exception e, long fileNum) {
- Tracer.trace
- (env, "Cleaner", "deleteSafeToDeleteFiles",
+ private void traceFileNotDeleted(Throwable e, long fileNum)
+ throws DatabaseException {
+
+ String msg = "Cleaner deleteSafeToDeleteFiles" +
"Log file 0x" + Long.toHexString(fileNum) + " could not be " +
(expunge ? "deleted" : "renamed") +
- ". This operation will be retried at the next checkpoint.",
- e);
+ ". This operation will be retried at the next checkpoint." +
+ e.toString() +
+ " FileSelector: " + fileSelector;
+ Tracer.trace
+ (env, "Cleaner", "deleteSafeToDeleteFiles", msg, e);
}
/**
@@ -632,13 +633,16 @@
}
/**
- * Update the lowUtilizationFiles and mustBeCleanedFiles fields with new
- * read-only collections, and update the backlog file count.
+ * Update the lowUtilizationFiles and toBeCleanedFiles fields with new
+ * read-only collections.
*/
public void updateReadOnlyFileCollections() {
- mustBeCleanedFiles = fileSelector.getMustBeCleanedFiles();
+ toBeCleanedFiles = fileSelector.getToBeCleanedFiles();
lowUtilizationFiles = fileSelector.getLowUtilizationFiles();
- nBacklogFiles = fileSelector.getBacklog();
+ }
+
+ final int getBacklog() {
+ return toBeCleanedFiles.size();
}
/**
@@ -861,7 +865,7 @@
Long fileNum = Long.valueOf(DbLsn.getFileNumber(lsn));
if ((PROACTIVE_MIGRATION || isResident) &&
- mustBeCleanedFiles.contains(fileNum)) {
+ toBeCleanedFiles.contains(fileNum)) {
return false;
}
@@ -1065,7 +1069,7 @@
Long fileNum = Long.valueOf(DbLsn.getFileNumber(childLsn));
if ((PROACTIVE_MIGRATION || isResident) &&
- mustBeCleanedFiles.contains(fileNum)) {
+ toBeCleanedFiles.contains(fileNum)) {
/* Migrate because it will be cleaned soon. */
doMigration = true;
@@ -1533,5 +1537,6 @@
public void close() {
profile.close();
tracker.close();
+ fileSelector.close(env.getMemoryBudget());
}
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/DbFileSummary.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/DbFileSummary.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/DbFileSummary.java 2008-01-07 14:28:48.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/DbFileSummary.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbFileSummary.java,v 1.4 2008/01/07 14:28:47 cwl Exp $
+ * $Id: DbFileSummary.java,v 1.5.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je.cleaner;
@@ -222,6 +222,7 @@
return false;
}
+ @Override
public String toString() {
StringBuffer buf = new StringBuffer();
dumpLog(buf, true);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/DbFileSummaryMap.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/DbFileSummaryMap.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/DbFileSummaryMap.java 2008-05-15 01:52:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/DbFileSummaryMap.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,19 +1,22 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbFileSummaryMap.java,v 1.5 2008/05/15 01:52:40 linda Exp $
+ * $Id: DbFileSummaryMap.java,v 1.6.2.3 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je.cleaner;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import com.sleepycat.je.dbi.EnvironmentImpl;
import com.sleepycat.je.dbi.MemoryBudget;
+import com.sleepycat.je.log.FileManager;
public class DbFileSummaryMap {
@@ -64,18 +67,52 @@
* necessary.
*
*
Must be called under the log write latch.
+ *
+ * @param fileNum the file identifying the summary.
+ *
+ * @param adjustMemBudget see init().
+ *
+ * @param checkResurrected is true if this method should check fileNum and
+ * return null if the file does not exist.
+ *
+ * @param fileManager is used to check for resurrected files and may be null
+ * if checkResurrected is false.
*/
- public DbFileSummary get(Long fileNum, boolean adjustMemBudget) {
+ public DbFileSummary get(Long fileNum,
+ boolean adjustMemBudget,
+ boolean checkResurrected,
+ FileManager fileManager) {
assert adjustMemBudget == (budget != null);
+ /*
+ * Note that both calls below to isFileValid (which calls File.exists)
+ * only occur if the file number is less than the last file in the log,
+ * and the file is not already present in the map. When the file is
+ * not the last file, we are recording obsoleteness and the file should
+ * already be in the map. So we only incur the overhead of File.exists
+ * when resurrecting a file, which should be pretty rare.
+ */
DbFileSummary summary = map.get(fileNum);
if (summary == null) {
- summary = new DbFileSummary();
- map.put(fileNum, summary);
- memSize += FILE_ENTRY_OVERHEAD;
- if (adjustMemBudget) {
- budget.updateTreeAdminMemoryUsage(FILE_ENTRY_OVERHEAD);
+ if (checkResurrected &&
+ fileNum < fileManager.getCurrentFileNum() &&
+ !fileManager.isFileValid(fileNum)) {
+ /* Will return null. */
+ } else {
+ summary = new DbFileSummary();
+ Object oldVal = map.put(fileNum, summary);
+ assert oldVal == null;
+ memSize += FILE_ENTRY_OVERHEAD;
+ if (adjustMemBudget) {
+ budget.updateTreeAdminMemoryUsage(FILE_ENTRY_OVERHEAD);
+ }
+ /* Double-check that we never add a deleted file. */
+ assert fileManager == null ||
+ fileNum == fileManager.getCurrentFileNum() ||
+ fileManager.isFileValid(fileNum) :
+ "Resurrected file: 0x" + Long.toHexString(fileNum);
+
}
}
return summary;
@@ -126,7 +163,25 @@
return map.size();
}
+ @Override
public String toString() {
return map.toString();
}
+
+ /**
+ * Removes entries for deleted files that were created by JE 3.3.74 and
+ * earlier. [#16610]
+ */
+ public void repair(EnvironmentImpl env) {
+ Long[] existingFiles = env.getFileManager().getAllFileNumbers();
+ Iterator iter = map.keySet().iterator();
+ while (iter.hasNext()) {
+ Long fileNum = iter.next();
+ if (Arrays.binarySearch(existingFiles, fileNum) < 0) {
+ iter.remove();
+ budget.updateTreeAdminMemoryUsage(0 - FILE_ENTRY_OVERHEAD);
+ memSize -= FILE_ENTRY_OVERHEAD;
+ }
+ }
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/FileProcessor.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/FileProcessor.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/FileProcessor.java 2008-05-15 01:52:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/FileProcessor.java 2010-01-30 01:10:56.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: FileProcessor.java,v 1.42 2008/05/15 01:52:40 linda Exp $
+ * $Id: FileProcessor.java,v 1.44.2.5 2010/01/30 01:10:55 mark Exp $
*/
package com.sleepycat.je.cleaner;
@@ -121,6 +121,7 @@
/**
* Return the number of retries when a deadlock exception occurs.
*/
+ @Override
protected long nDeadlockRetries()
throws DatabaseException {
@@ -221,7 +222,7 @@
String traceMsg =
"CleanerRun " + runId +
" on file 0x" + Long.toHexString(fileNumValue) +
- " begins backlog=" + cleaner.nBacklogFiles;
+ " begins backlog=" + cleaner.getBacklog();
Tracer.trace(Level.INFO, env, traceMsg);
if (DEBUG_TRACING) {
System.out.println("\n" + traceMsg);
@@ -241,14 +242,14 @@
/*
* File was deleted. Although it is possible that the file was
* deleted externally it is much more likely that the file was
- * deleted normally after being cleaned earlier (this was
- * observed prior to JE 3.2.29), and that we are mistakedly
- * processing the file repeatedly. Since the file does not
- * exist, ignore the error so that the cleaner will continue.
- * The tracing below will indicate that the file was deleted.
- * Remove the file completely from the FileSelector and
- * UtilizationProfile so that we don't repeatedly attempt to
- * process it. [#15528]
+ * deleted normally after being cleaned earlier. This can
+ * occur when tracked obsolete information is collected and
+ * processed after the file has been cleaned and deleted.
+ * Since the file does not exist, ignore the error so that the
+ * cleaner will continue. The tracing below will indicate that
+ * the file was deleted. Remove the file completely from the
+ * FileSelector and UtilizationProfile so that we don't
+ * repeatedly attempt to process it. [#15528]
*/
fileDeleted = true;
profile.removeFile(fileNum, null /*databases*/);
@@ -368,7 +369,8 @@
* releaseDb after getDb with the dbCache, since the entire dbCache
* will be released at the end of thie method.
*/
- Map dbCache = new HashMap();
+ Map dbCache =
+ new HashMap();
DbTree dbMapTree = env.getDbTree();
try {
@@ -556,6 +558,27 @@
}
/**
+ * Unit testing. Simulates processing of a single LN.
+ */
+ void testProcessLN(LN targetLN,
+ long logLsn,
+ byte[] key,
+ byte[] dupKey,
+ DatabaseId dbId,
+ Map dbCache)
+ throws DatabaseException {
+
+ LookAheadCache lookAheadCache = new LookAheadCache(1);
+
+ lookAheadCache.add
+ (Long.valueOf(DbLsn.getFileOffset(logLsn)),
+ new LNInfo(targetLN, dbId, key, dupKey));
+
+ processLN(DbLsn.getFileNumber(logLsn), new TreeLocation(),
+ lookAheadCache, dbCache);
+ }
+
+ /**
* Processes the first LN in the look ahead cache and removes it from the
* cache. While the BIN is latched, look through the BIN for other LNs in
* the cache; if any match, process them to avoid a tree search later.
@@ -894,6 +917,11 @@
* the tree and log LSNs are equal. We will always restore the
* LN to the BIN slot here, and always log the dirty LN when
* logging the BIN.
+ *
+ * Also for temporary databases, make both the target LN and
+ * the BIN or IN parent dirty. Otherwise, when the BIN or IN is
+ * evicted in the future, it will be written to disk without
+ * flushing its dirty, migrated LNs. [#18227]
*/
if (isDupCountLN) {
ChildReference dclRef = parentDIN.getDupCountLNRef();
@@ -905,6 +933,7 @@
if (isTemporary) {
((LN) dclRef.getTarget()).setDirty();
dclRef.setLsn(DbLsn.NULL_LSN);
+ parentDIN.setDirty(true);
} else if (cleaner.lazyMigration) {
dclRef.setMigrate(true);
parentDIN.setDirty(true);
@@ -934,6 +963,7 @@
if (isTemporary) {
((LN) bin.getTarget(index)).setDirty();
bin.clearLsn(index);
+ bin.setDirty(true);
} else if (cleaner.lazyMigration) {
bin.setMigrate(index, true);
bin.setDirty(true);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/FileSelector.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/FileSelector.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/FileSelector.java 2008-05-15 01:52:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/FileSelector.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,13 +1,14 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: FileSelector.java,v 1.24 2008/05/15 01:52:40 linda Exp $
+ * $Id: FileSelector.java,v 1.24.2.10 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je.cleaner;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -20,6 +21,8 @@
import com.sleepycat.je.dbi.DatabaseId;
import com.sleepycat.je.dbi.MemoryBudget;
import com.sleepycat.je.tree.LN;
+import com.sleepycat.je.utilint.TestHook;
+import com.sleepycat.je.utilint.TestHookExecute;
/**
* Keeps track of the status of files for which cleaning is in progres.
@@ -131,6 +134,9 @@
*/
private Set lowUtilizationFiles;
+ /* For unit tests */
+ private TestHook fileChosenHook;
+
FileSelector() {
toBeCleanedFiles = new TreeSet();
cleanedFiles = new HashSet();
@@ -144,10 +150,14 @@
beingCleanedFiles = new HashSet();
}
+ /* For unit testing only. */
+ public void setFileChosenHook(TestHook hook) {
+ fileChosenHook = hook;
+ }
+
/**
* Returns the best file that qualifies for cleaning, or null if no file
- * qualifies. This method is not thread safe and should only be called
- * from the cleaner thread.
+ * qualifies.
*
* @param forceCleaning is true to always select a file, even if its
* utilization is above the minimum utilization threshold.
@@ -166,6 +176,15 @@
int maxBatchFiles)
throws DatabaseException {
+ /*
+ * Note that because it calls UtilizationProfile methods, this method
+ * itself cannot be synchronized. Synchronization is done elsewhere in
+ * the order [UtilizationProfile, FileSelector], so this method can't
+ * synchronize first on FileSelector and then call a UtilizationProfile
+ * method without causing a deadlock. However, it must synchronize
+ * while accessing private fields. Retries are performed when
+ * necessary to work around the lack of synchronization. See below.
+ */
Set newLowUtilizationFiles = calcLowUtilizationFiles ?
(new HashSet()) : null;
@@ -192,8 +211,23 @@
break;
}
+ assert TestHookExecute.doHookIfSet(fileChosenHook);
+
+ /*
+ * Because we don't synchronize on the FileSelector while calling
+ * UtilizationProfile.getBestFileForCleaning, another thread may
+ * have selected this file. Add the file only if not already being
+ * cleaned. [#17079]
+ *
+ * There is also a possibility that another thread will have
+ * already cleaned and deleted the file. In that case, we will
+ * return it and attempt to clean it again, but
+ * FileProcessor.doClean will detect this situation and recover.
+ */
synchronized (this) {
- toBeCleanedFiles.add(fileNum);
+ if (!isFileCleaningInProgress(fileNum)) {
+ toBeCleanedFiles.add(fileNum);
+ }
}
}
@@ -204,21 +238,32 @@
/*
* Select the cheapest file to clean from a copy of the to-be-cleaned
- * set. Then move the file from the to-be-cleaned set to the
+ * set. Move the selected file from the to-be-cleaned set to the
* being-cleaned set.
+ *
+ * Because we don't synchronize on the FileSelector while calling
+ * UtilizationProfile.getCheapestFileToClean, another thread may have
+ * selected this file. Select the file only if it is waiting to be
+ * cleaned. [#17079]
*/
SortedSet availableFiles;
synchronized (this) {
availableFiles = new TreeSet(toBeCleanedFiles);
}
- Long file = profile.getCheapestFileToClean(availableFiles);
- if (file != null) {
+ while (availableFiles.size() > 0) {
+ Long fileNum = profile.getCheapestFileToClean(availableFiles);
+ if (fileNum == null) {
+ return null;
+ }
synchronized (this) {
- toBeCleanedFiles.remove(file);
- beingCleanedFiles.add(file);
+ if (toBeCleanedFiles.remove(fileNum)) {
+ beingCleanedFiles.add(fileNum);
+ return fileNum;
+ }
+ availableFiles.remove(fileNum);
}
}
- return file;
+ return null;
}
/**
@@ -233,6 +278,15 @@
safeToDeleteFiles.contains(file);
}
+ private boolean isFileCleaningInProgress(Collection files) {
+ for (Long file : files) {
+ if (isFileCleaningInProgress(file)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* Removes all references to a file.
*/
@@ -252,8 +306,18 @@
* set to the to-be-cleaned set.
*/
synchronized void putBackFileForCleaning(Long fileNum) {
- toBeCleanedFiles.add(fileNum);
beingCleanedFiles.remove(fileNum);
+ assert !isFileCleaningInProgress(fileNum);
+ toBeCleanedFiles.add(fileNum);
+ }
+
+ /**
+ * For unit testing.
+ */
+ synchronized void injectFileForCleaning(Long fileNum) {
+ if (!isFileCleaningInProgress(fileNum)) {
+ toBeCleanedFiles.add(fileNum);
+ }
}
/**
@@ -263,11 +327,12 @@
synchronized void addCleanedFile(Long fileNum,
Set databases,
MemoryBudget budget) {
+ beingCleanedFiles.remove(fileNum);
+ assert !isFileCleaningInProgress(fileNum);
cleanedFiles.add(fileNum);
Set oldDatabases =
cleanedFilesDatabases.put(fileNum, databases);
adjustMemoryBudget(budget, oldDatabases, databases);
- beingCleanedFiles.remove(fileNum);
}
/**
@@ -280,20 +345,11 @@
}
/**
- * Returns a read-only copy of to-be-cleaned and being-cleaned files that
- * can be accessed without synchronization.
- */
- synchronized Set getMustBeCleanedFiles() {
- Set set = new HashSet(toBeCleanedFiles);
- set.addAll(beingCleanedFiles);
- return set;
- }
-
- /**
- * Returns the number of files waiting to-be-cleaned.
+ * Returns a read-only copy of to-be-cleaned files that can be accessed
+ * without synchronization.
*/
- synchronized int getBacklog() {
- return toBeCleanedFiles.size();
+ synchronized Set getToBeCleanedFiles() {
+ return new HashSet(toBeCleanedFiles);
}
/**
@@ -314,26 +370,30 @@
* When a checkpoint is complete, move the previously cleaned and
* fully-processed files to the checkpointed and safe-to-delete sets.
*/
- synchronized void updateFilesAtCheckpointEnd(
- CheckpointStartCleanerState info) {
+ synchronized void
+ updateFilesAtCheckpointEnd(CheckpointStartCleanerState info) {
if (!info.isEmpty()) {
Set previouslyCleanedFiles = info.getCleanedFiles();
if (previouslyCleanedFiles != null) {
+ cleanedFiles.removeAll(previouslyCleanedFiles);
+ assert !isFileCleaningInProgress(previouslyCleanedFiles) :
+ toString();
if (anyPendingDuringCheckpoint) {
checkpointedFiles.addAll(previouslyCleanedFiles);
} else {
safeToDeleteFiles.addAll(previouslyCleanedFiles);
}
- cleanedFiles.removeAll(previouslyCleanedFiles);
}
Set previouslyProcessedFiles =
info.getFullyProcessedFiles();
if (previouslyProcessedFiles != null) {
- safeToDeleteFiles.addAll(previouslyProcessedFiles);
fullyProcessedFiles.removeAll(previouslyProcessedFiles);
+ assert !isFileCleaningInProgress(previouslyProcessedFiles) :
+ toString();
+ safeToDeleteFiles.addAll(previouslyProcessedFiles);
}
updateProcessedFiles();
@@ -343,8 +403,10 @@
/**
* Adds the given LN info to the pending LN set.
*/
- synchronized boolean addPendingLN(LN ln, DatabaseId dbId,
- byte[] key, byte[] dupKey) {
+ synchronized boolean addPendingLN(LN ln,
+ DatabaseId dbId,
+ byte[] key,
+ byte[] dupKey) {
assert ln != null;
boolean added = pendingLNs.put
@@ -437,9 +499,18 @@
* finally been deleted.
*/
synchronized void removeDeletedFile(Long fileNum, MemoryBudget budget) {
- safeToDeleteFiles.remove(fileNum);
- Set oldDatabases = cleanedFilesDatabases.remove(fileNum);
- adjustMemoryBudget(budget, oldDatabases, null /*newDatabases*/);
+ /* Ensure that no remnants of a deleted file remain. [#17752] */
+ removeAllFileReferences(fileNum, budget);
+ }
+
+ /**
+ * Update memory budgets when the environment is closed and will never be
+ * accessed again.
+ */
+ synchronized void close(MemoryBudget budget) {
+ for (Set oldDatabases : cleanedFilesDatabases.values()) {
+ adjustMemoryBudget(budget, oldDatabases, null /*newDatabases*/);
+ }
}
/**
@@ -516,4 +587,19 @@
return fullyProcessedFiles;
}
}
+
+ @Override
+ public String toString() {
+ return "toBeCleanedFiles = " + toBeCleanedFiles +
+ " beingCleanedFiles = " + beingCleanedFiles +
+ " cleanedFiles = " + cleanedFiles +
+ " cleanedFilesDatabases = " + cleanedFilesDatabases +
+ " checkpointedFiles = " + checkpointedFiles +
+ " fullyProcessedFiles = " + fullyProcessedFiles +
+ " safeToDeleteFiles = " + safeToDeleteFiles +
+ " pendingLNs = " + pendingLNs +
+ " pendingDBs = " + pendingDBs +
+ " anyPendingDuringCheckpoint = " + anyPendingDuringCheckpoint +
+ " lowUtilizationFiles = " + lowUtilizationFiles;
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/FileSummary.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/FileSummary.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/FileSummary.java 2008-01-07 14:28:48.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/FileSummary.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: FileSummary.java,v 1.24 2008/01/07 14:28:47 cwl Exp $
+ * $Id: FileSummary.java,v 1.25.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.cleaner;
@@ -278,6 +278,7 @@
return false;
}
+ @Override
public String toString() {
StringBuffer buf = new StringBuffer();
dumpLog(buf, true);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/LNInfo.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/LNInfo.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/LNInfo.java 2008-01-07 14:28:48.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/LNInfo.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LNInfo.java,v 1.7 2008/01/07 14:28:47 cwl Exp $
+ * $Id: LNInfo.java,v 1.7.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.cleaner;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/LocalUtilizationTracker.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/LocalUtilizationTracker.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/LocalUtilizationTracker.java 2008-05-15 01:52:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/LocalUtilizationTracker.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LocalUtilizationTracker.java,v 1.4 2008/05/15 01:52:40 linda Exp $
+ * $Id: LocalUtilizationTracker.java,v 1.4.2.3 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.cleaner;
@@ -107,4 +107,11 @@
return (DatabaseImpl) databaseKey;
}
+
+ /**
+ * Do nothing, since DbTree.getDb was not called by
+ * databaseKeyToDatabaseImpl.
+ */
+ void releaseDatabaseImpl(DatabaseImpl db) {
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/OffsetList.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/OffsetList.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/OffsetList.java 2008-01-07 14:28:48.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/OffsetList.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: OffsetList.java,v 1.14 2008/01/07 14:28:47 cwl Exp $
+ * $Id: OffsetList.java,v 1.14.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.cleaner;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/PackedOffsets.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/PackedOffsets.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/PackedOffsets.java 2008-01-17 17:22:12.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/PackedOffsets.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PackedOffsets.java,v 1.15 2008/01/17 17:22:11 cwl Exp $
+ * $Id: PackedOffsets.java,v 1.16.2.3 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.cleaner;
@@ -32,6 +32,12 @@
* Creates an empty object.
*/
public PackedOffsets() {
+
+ /*
+ * Verify assumption in FileSummaryLN that a new PackedOffsets instance
+ * has no extra extra memory that must be budgeted.
+ */
+ assert getExtraMemorySize() == 0;
}
/**
@@ -223,6 +229,7 @@
return false;
}
+ @Override
public String toString() {
StringBuffer buf = new StringBuffer();
dumpLog(buf, true);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/RecoveryUtilizationTracker.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/RecoveryUtilizationTracker.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/RecoveryUtilizationTracker.java 2008-05-27 15:30:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/RecoveryUtilizationTracker.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: RecoveryUtilizationTracker.java,v 1.8 2008/05/27 15:30:35 mark Exp $
+ * $Id: RecoveryUtilizationTracker.java,v 1.9.2.3 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.cleaner;
@@ -134,6 +134,7 @@
* Overrides this method for recovery and returns whether the FileSummaryLN
* for the given file is prior to the given LSN.
*/
+ @Override
boolean isFileUncounted(Long fileNum, long lsn) {
long fsLsn = DbLsn.longToLsn(fileSummaryLsns.get(fileNum));
int cmpFsLsnToNewLsn = (fsLsn != DbLsn.NULL_LSN) ?
@@ -173,10 +174,20 @@
* Returns the DatabaseImpl from the database key, which in this case is
* the DatabaseId.
*/
+ @Override
DatabaseImpl databaseKeyToDatabaseImpl(Object databaseKey)
throws DatabaseException {
DatabaseId dbId = (DatabaseId) databaseKey;
return env.getDbTree().getDb(dbId);
}
+
+ /**
+ * Must release the database, since DbTree.getDb was called by
+ * databaseKeyToDatabaseImpl.
+ */
+ @Override
+ void releaseDatabaseImpl(DatabaseImpl db) {
+ env.getDbTree().releaseDb(db);
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/TrackedFileSummary.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/TrackedFileSummary.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/TrackedFileSummary.java 2008-03-25 03:26:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/TrackedFileSummary.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: TrackedFileSummary.java,v 1.16 2008/03/25 02:26:35 linda Exp $
+ * $Id: TrackedFileSummary.java,v 1.17.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.cleaner;
@@ -79,6 +79,7 @@
*
*
Must be called under the log write latch.
*/
+ @Override
public void reset() {
obsoleteOffsets = null;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/UtilizationProfile.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/UtilizationProfile.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/UtilizationProfile.java 2008-05-15 01:52:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/UtilizationProfile.java 2010-01-22 00:29:56.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: UtilizationProfile.java,v 1.84 2008/05/15 01:52:40 linda Exp $
+ * $Id: UtilizationProfile.java,v 1.84.2.5 2010/01/22 00:29:56 mark Exp $
*/
package com.sleepycat.je.cleaner;
@@ -218,21 +218,24 @@
Long bestFile = null;
int bestCost = Integer.MAX_VALUE;
+ final SortedMap currentFileSummaryMap =
+ getFileSummaryMap(true /*includeTrackedFiles*/);
+
for (Iterator iter = files.iterator(); iter.hasNext();) {
Long file = iter.next();
+ FileSummary summary = currentFileSummaryMap.get(file);
/*
- * Ignore files in the given set that are not in the profile. This
- * can occur with multiple cleaner threads because we don't hold a
- * synchronized lock during the entire execution of the
- * FileSelector.selectFileForCleaning method. [#14431]
+ * Return a file in the given set if it does not exist. Deleted
+ * files should be selected ASAP to remove them from the backlog.
+ * [#18179] For details, see where FileProcessor.doClean handles
+ * LogFileNotFoundException.
*/
- if (!fileSummaryMap.containsKey(file)) {
- continue;
+ if (summary == null) {
+ return file;
}
/* Calculate this file's cost to clean. */
- FileSummary summary = getFileSummary(file);
int thisCost = summary.getNonObsoleteCount();
/* Select this file if it has the lowest cost so far. */
@@ -701,6 +704,7 @@
/* Now delete all FileSummaryLNs. */
Locker locker = null;
CursorImpl cursor = null;
+ boolean clearedTrackedFile = false;
try {
locker = BasicLocker.createBasicLocker(env, false /*noWait*/,
true /*noAPIReadLock*/);
@@ -713,13 +717,15 @@
long fileNumVal = fileNum.longValue();
/* Search by file number. */
- if (!getFirstFSLN
+ OperationStatus status = OperationStatus.SUCCESS;
+ if (getFirstFSLN
(cursor, fileNumVal, keyEntry, dataEntry, LockType.WRITE)) {
- return;
+ status = OperationStatus.SUCCESS;
+ } else {
+ status = OperationStatus.NOTFOUND;
}
/* Delete all LNs for this file number. */
- OperationStatus status = OperationStatus.SUCCESS;
while (status == OperationStatus.SUCCESS) {
/* Perform eviction once per operation. */
@@ -739,6 +745,7 @@
/* Associate the tracked summary so it will be cleared. */
if (tfs != null) {
ln.setTrackedSummary(tfs);
+ clearedTrackedFile = true;
}
/*
@@ -763,6 +770,21 @@
locker.operationEnd();
}
}
+
+ /*
+ * If LN.setTrackedSummary was not called above, the file will not be
+ * removed from the UtilizationTracker. This can happen if a file is
+ * resurrected in the tracker after being cleaned, deleted and removed
+ * from the profile. We'll end up here because FileProcessor.doClean
+ * calls removeFile when it gets a LogFileNotFoundException. For this
+ * case we explicitly remove the file from the tracker below. [#16928]
+ */
+ if (!clearedTrackedFile) {
+ TrackedFileSummary tfs = tracker.getTrackedFile(fileNum);
+ if (tfs != null) {
+ env.getLogManager().removeTrackedFile(tfs);
+ }
+ }
}
/**
@@ -1247,10 +1269,12 @@
/**
* Insert the given LN with the given key values. This method is
* synchronized and may not perform eviction.
+ *
+ * Is public only for unit testing.
*/
- private synchronized void insertFileSummary(FileSummaryLN ln,
- long fileNum,
- int sequence)
+ public synchronized boolean insertFileSummary(FileSummaryLN ln,
+ long fileNum,
+ int sequence)
throws DatabaseException {
byte[] keyBytes = FileSummaryLN.makeFullKey(fileNum, sequence);
@@ -1275,10 +1299,17 @@
"Cleaner duplicate key sequence file=0x" +
Long.toHexString(fileNum) + " sequence=0x" +
Long.toHexString(sequence));
+ return false;
}
+ /* Account for FileSummaryLN's extra marshaled memory. [#17462] */
+ BIN bin = cursor.latchBIN();
+ ln.addExtraMarshaledMemorySize(bin);
+ cursor.releaseBIN();
+
/* Always evict after using a file summary LN. */
cursor.evict();
+ return true;
} finally {
if (cursor != null) {
cursor.close();
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/UtilizationTracker.java libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/UtilizationTracker.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/cleaner/UtilizationTracker.java 2008-05-13 01:44:50.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/cleaner/UtilizationTracker.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: UtilizationTracker.java,v 1.26 2008/05/13 01:44:49 cwl Exp $
+ * $Id: UtilizationTracker.java,v 1.27.2.3 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.cleaner;
@@ -50,6 +50,7 @@
super(env, cleaner);
}
+ @Override
public EnvironmentImpl getEnvironment() {
return env;
}
@@ -185,6 +186,9 @@
* database key.
*
*
Must be called under the log write latch.
+ *
+ * @return the summary, or null if the DB should not be tracked because
+ * the file has been deleted, or null if the databaseKey param is null.
*/
DbFileSummary getDbFileSummary(Object databaseKey, long fileNum) {
DatabaseImpl db = (DatabaseImpl) databaseKey;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/config/BooleanConfigParam.java libdb-je-java-3.3.98/src/com/sleepycat/je/config/BooleanConfigParam.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/config/BooleanConfigParam.java 2008-05-30 19:07:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/config/BooleanConfigParam.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: BooleanConfigParam.java,v 1.30 2008/05/30 19:07:40 mark Exp $
+ * $Id: BooleanConfigParam.java,v 1.31.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.config;
@@ -36,6 +36,7 @@
/**
* Make sure that value is a valid string for booleans.
*/
+ @Override
public void validateValue(String value)
throws IllegalArgumentException {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/config/ConfigParam.java libdb-je-java-3.3.98/src/com/sleepycat/je/config/ConfigParam.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/config/ConfigParam.java 2008-05-30 19:07:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/config/ConfigParam.java 2008-06-10 02:52:10.000000000 +0000
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000,2008 Oracle. All rights reserved.
*
- * $Id: ConfigParam.java,v 1.31 2008/05/30 19:07:40 mark Exp $
+ * $Id: ConfigParam.java,v 1.32 2008/06/10 02:52:09 cwl Exp $
*/
package com.sleepycat.je.config;
@@ -141,6 +141,7 @@
}
+ @Override
public String toString() {
return name;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/config/EnvironmentParams.java libdb-je-java-3.3.98/src/com/sleepycat/je/config/EnvironmentParams.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/config/EnvironmentParams.java 2008-05-30 19:07:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/config/EnvironmentParams.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,26 +1,20 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EnvironmentParams.java,v 1.106 2008/05/30 19:07:40 mark Exp $
+ * $Id: EnvironmentParams.java,v 1.108.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.config;
-import java.io.File;
-import java.io.FileWriter;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
-import java.util.TreeSet;
import com.sleepycat.je.EnvironmentConfig;
import com.sleepycat.je.dbi.EnvironmentImpl;
/**
- * Javadoc for this public class is generated
- * via the doc templates in the doc_src directory.
*/
public class EnvironmentParams {
@@ -33,7 +27,8 @@
new HashMap();
/*
- * Environment
+ * Only environment parameters that are part of the public API are
+ * represented by String constants in EnvironmentConfig.
*/
public static final LongConfigParam MAX_MEMORY =
new LongConfigParam(EnvironmentConfig.MAX_MEMORY,
@@ -82,7 +77,7 @@
false); // forReplication
/**
- * @deprecated As of 2.0, eviction is performed in-line.
+ * As of 2.0, eviction is performed in-line.
*
* If true, starts up the evictor. This parameter is false by default.
*/
@@ -173,7 +168,7 @@
false); // forReplication
/**
- * @deprecated As of 3.3, is true by default.
+ * Not part of the public API. As of 3.3, is true by default.
*
* If true (the default), use shared latches for Btree Internal Nodes (INs)
* to improve concurrency.
@@ -481,7 +476,7 @@
false); // forReplication
/**
- * @deprecated As of 2.0, eviction is performed in-line.
+ * Not part of public API. As of 2.0, eviction is performed in-line.
*
* At this percentage over the allotted cache, critical eviction will
* start.
@@ -692,7 +687,7 @@
false); // forReplication
/**
- * @deprecated as of 3.3, never intended for public use
+ * Not part of public API.
*
* If true, the cleaner tracks and stores detailed information that is used
* to decrease the cost of cleaning.
@@ -712,7 +707,7 @@
false); // forReplication
/**
- * @deprecated as of 3.0, since it applies to a very old bug.
+ * Not part of public API, since it applies to a very old bug.
*
* If true, detail information is discarded that was added by earlier
* versions of JE (specifically 2.0.42 and 2.0.54) if it may be invalid.
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/config/IntConfigParam.java libdb-je-java-3.3.98/src/com/sleepycat/je/config/IntConfigParam.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/config/IntConfigParam.java 2008-05-30 19:07:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/config/IntConfigParam.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: IntConfigParam.java,v 1.30 2008/05/30 19:07:40 mark Exp $
+ * $Id: IntConfigParam.java,v 1.31.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.config;
@@ -62,6 +62,7 @@
}
}
+ @Override
public void validateValue(String value)
throws IllegalArgumentException {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/config/LongConfigParam.java libdb-je-java-3.3.98/src/com/sleepycat/je/config/LongConfigParam.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/config/LongConfigParam.java 2008-05-30 19:07:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/config/LongConfigParam.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LongConfigParam.java,v 1.28 2008/05/30 19:07:40 mark Exp $
+ * $Id: LongConfigParam.java,v 1.29.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.config;
@@ -63,6 +63,7 @@
}
}
+ @Override
public void validateValue(String value)
throws IllegalArgumentException {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/config/package.html libdb-je-java-3.3.98/src/com/sleepycat/je/config/package.html
--- libdb-je-java-3.3.62/src/com/sleepycat/je/config/package.html 2008-01-07 14:28:48.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/config/package.html 2010-01-04 15:30:28.000000000 +0000
@@ -5,9 +5,9 @@
See the file LICENSE for redistribution information.
- Copyright (c) 2002,2008 Oracle. All rights reserved.
+ Copyright (c) 2002,2010 Oracle. All rights reserved.
- $Id: package.html,v 1.11 2008/01/07 14:28:47 cwl Exp $
+ $Id: package.html,v 1.11.2.2 2010/01/04 15:30:28 cwl Exp $
-->
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/config/ShortConfigParam.java libdb-je-java-3.3.98/src/com/sleepycat/je/config/ShortConfigParam.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/config/ShortConfigParam.java 2008-05-30 19:07:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/config/ShortConfigParam.java 2008-06-10 02:52:10.000000000 +0000
@@ -3,7 +3,7 @@
*
* Copyright (c) 2002,2006 Oracle. All rights reserved.
*
- * $Id: ShortConfigParam.java,v 1.25 2008/05/30 19:07:40 mark Exp $
+ * $Id: ShortConfigParam.java,v 1.26 2008/06/10 02:52:09 cwl Exp $
*/
package com.sleepycat.je.config;
@@ -61,6 +61,7 @@
}
}
+ @Override
public void validateValue(String value)
throws IllegalArgumentException {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/CursorConfig.java libdb-je-java-3.3.98/src/com/sleepycat/je/CursorConfig.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/CursorConfig.java 2008-04-07 22:28:30.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/CursorConfig.java 2010-03-22 21:53:34.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: CursorConfig.java,v 1.24 2008/04/07 22:28:29 mark Exp $
+ * $Id: CursorConfig.java,v 1.25.2.4 2010/03/22 21:53:33 mark Exp $
*/
package com.sleepycat.je;
@@ -115,11 +115,14 @@
}
/**
- * Configures read operations performed by the cursor to return modified
- * but not yet committed data.
+ * Configures read operations performed by the cursor to obey read
+ * committed isolation. Read committed isolation provides for cursor
+ * stability but not repeatable reads. Data items which have been
+ * previously read by this transaction may be deleted or modified by other
+ * transactions before the cursor is closed or the transaction completes.
*
* @param readCommitted If true, configure read operations performed by
- * the cursor to return modified but not yet committed data.
+ * the cursor to obey read commited isolation.
*
* @see LockMode#READ_COMMITTED
*/
@@ -129,10 +132,10 @@
/**
* Returns true if read operations performed by the cursor are configured
- * to return modified but not yet committed data.
+ * to obey read committed isolation.
*
* @return true if read operations performed by the cursor are configured
- * to return modified but not yet committed data.
+ * to obey read committed isolation.w
*
* @see LockMode#READ_COMMITTED
*/
@@ -151,4 +154,16 @@
return null;
}
}
+
+ /**
+ * Returns the values for each configuration attribute.
+ *
+ * @return the values for each configuration attribute.
+ */
+ @Override
+ public String toString() {
+ return "readUncommitted=" + readUncommitted +
+ "\nreadCommitted=" + readCommitted +
+ "\n";
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/Cursor.java libdb-je-java-3.3.98/src/com/sleepycat/je/Cursor.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/Cursor.java 2008-05-29 03:17:28.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/Cursor.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Cursor.java,v 1.215 2008/05/29 03:17:28 linda Exp $
+ * $Id: Cursor.java,v 1.216.2.5 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -186,8 +186,8 @@
assert locker != null;
- DatabaseImpl dbImpl = dbHandle.getDatabaseImpl();
- cursorImpl = new CursorImpl(dbImpl, locker, retainNonTxnLocks);
+ DatabaseImpl databaseImpl = dbHandle.getDatabaseImpl();
+ cursorImpl = new CursorImpl(databaseImpl, locker, retainNonTxnLocks);
/* Perform eviction for user cursors. */
cursorImpl.setAllowEviction(true);
@@ -200,14 +200,14 @@
cursorImpl.getLocker().isSerializableIsolation();
updateOperationsProhibited =
- (dbImpl.isTransactional() && !locker.isTransactional()) ||
+ (databaseImpl.isTransactional() && !locker.isTransactional()) ||
!dbHandle.isWritable();
- this.dbImpl = dbImpl;
+ this.dbImpl = databaseImpl;
this.dbHandle = dbHandle;
dbHandle.addCursor(this);
this.config = cursorConfig;
- this.logger = dbImpl.getDbEnvironment().getLogger();
+ this.logger = databaseImpl.getDbEnvironment().getLogger();
}
/**
@@ -427,7 +427,7 @@
*
If the key already appears in the database and duplicates are
* supported, the new data value is inserted at the correct sorted
* location. If the key already appears in the database and duplicates are
- * not supported, the existing key/data pair will be replaced.
+ * not supported, the data associated with the key will be replaced.
*
* @param key the key {@link com.sleepycat.je.DatabaseEntry
* DatabaseEntry} operated on.
@@ -637,7 +637,7 @@
}
/**
- * Moves the cursor to the first key/data pair of the database, and return
+ * Moves the cursor to the first key/data pair of the database, and returns
* that pair. If the first key has duplicate values, the first data item
* in the set of duplicates is returned.
*
@@ -681,7 +681,7 @@
}
/**
- * Moves the cursor to the last key/data pair of the database, and return
+ * Moves the cursor to the last key/data pair of the database, and returns
* that pair. If the last key has duplicate values, the last data item in
* the set of duplicates is returned.
*
@@ -725,9 +725,7 @@
}
/**
- * Moves the cursor to the next key/data pair and return that pair. If the
- * matching key has duplicate values, the first data item in the set of
- * duplicates is returned.
+ * Moves the cursor to the next key/data pair and returns that pair.
*
*
If the cursor is not yet initialized, move the cursor to the first
* key/data pair of the database, and return that pair. Otherwise, the
@@ -781,7 +779,7 @@
/**
* If the next key/data pair of the database is a duplicate data record for
* the current key/data pair, moves the cursor to the next key/data pair of
- * the database and return that pair.
+ * the database and returns that pair.
*
*
If this method fails for any reason, the position of the cursor will
* be unchanged.
@@ -823,9 +821,9 @@
}
/**
- * Moves the cursor to the next non-duplicate key/data pair and return that
- * pair. If the matching key has duplicate values, the first data item in
- * the set of duplicates is returned.
+ * Moves the cursor to the next non-duplicate key/data pair and returns
+ * that pair. If the matching key has duplicate values, the first data
+ * item in the set of duplicates is returned.
*
*
If the cursor is not yet initialized, move the cursor to the first
* key/data pair of the database, and return that pair. Otherwise, the
@@ -876,9 +874,7 @@
}
/**
- * Moves the cursor to the previous key/data pair and return that pair. If
- * the matching key has duplicate values, the last data item in the set of
- * duplicates is returned.
+ * Moves the cursor to the previous key/data pair and returns that pair.
*
*
If the cursor is not yet initialized, move the cursor to the last
* key/data pair of the database, and return that pair. Otherwise, the
@@ -932,7 +928,7 @@
/**
* If the previous key/data pair of the database is a duplicate data record
* for the current key/data pair, moves the cursor to the previous key/data
- * pair of the database and return that pair.
+ * pair of the database and returns that pair.
*
*
If this method fails for any reason, the position of the cursor will
* be unchanged.
@@ -974,7 +970,7 @@
}
/**
- * Moves the cursor to the previous non-duplicate key/data pair and return
+ * Moves the cursor to the previous non-duplicate key/data pair and returns
* that pair. If the matching key has duplicate values, the last data item
* in the set of duplicates is returned.
*
@@ -1027,7 +1023,7 @@
}
/**
- * Moves the cursor to the given key of the database, and return the datum
+ * Moves the cursor to the given key of the database, and returns the datum
* associated with the given key. If the matching key has duplicate
* values, the first data item in the set of duplicates is returned.
*
@@ -1072,10 +1068,10 @@
}
/**
- * Moves the cursor to the closest matching key of the database, and return
- * the data item associated with the matching key. If the matching key has
- * duplicate values, the first data item in the set of duplicates is
- * returned.
+ * Moves the cursor to the closest matching key of the database, and
+ * returns the data item associated with the matching key. If the matching
+ * key has duplicate values, the first data item in the set of duplicates
+ * is returned.
*
*
The returned key/data pair is for the smallest key greater than or
* equal to the specified key (as determined by the key comparison
@@ -1698,7 +1694,6 @@
SearchMode.SET_RANGE : SearchMode.BOTH_RANGE;
KeyChangeStatus result = null;
- boolean noNextKeyFound;
CursorImpl dup =
beginRead(false /* searchAndPosition will add cursor */);
@@ -1714,9 +1709,6 @@
(dup, key, data, searchLockType, advanceLockType, searchMode,
true /*advanceAfterRangeSearch*/);
- /* The keyChange value is independent of the status value. */
- noNextKeyFound = !result.keyChange;
-
/* If the key changed, then we do not have an exact match. */
if (result.keyChange && result.status == OperationStatus.SUCCESS) {
result.status = OperationStatus.NOTFOUND;
@@ -1726,8 +1718,11 @@
result.status == OperationStatus.SUCCESS);
}
- /* Lock the EOF node if no more records, whether or not more dups. */
- if (noNextKeyFound) {
+ /*
+ * Lock the EOF node if there was no exact match and we did not
+ * range-lock the next record.
+ */
+ if (result.status != OperationStatus.SUCCESS && !result.keyChange) {
cursorImpl.lockEofNode(LockType.RANGE_READ);
}
@@ -1928,7 +1923,7 @@
/*
* If we did not match the key (exactly) for
- * BOTH_RANGE, and advanceAfterSearchRangeBoth is
+ * BOTH_RANGE, and advanceAfterRangeSearch is
* false, then return NOTFOUND.
*/
status = OperationStatus.NOTFOUND;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/DatabaseConfig.java libdb-je-java-3.3.98/src/com/sleepycat/je/DatabaseConfig.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/DatabaseConfig.java 2008-05-29 03:38:24.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/DatabaseConfig.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DatabaseConfig.java,v 1.47 2008/05/29 03:38:23 linda Exp $
+ * $Id: DatabaseConfig.java,v 1.48.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -877,7 +877,7 @@
boolean dwMatch,
boolean btCmpMatch,
boolean dtCmpMatch) {
- StringBuffer ret = new StringBuffer
+ StringBuilder ret = new StringBuilder
("The following DatabaseConfig parameters for the\n" +
"cached Database do not match the parameters for the\n" +
"requested Database:\n");
@@ -1030,4 +1030,22 @@
return true;
}
+
+ /**
+ * Returns the values for each configuration attribute.
+ *
+ * @return the values for each configuration attribute.
+ */
+ @Override
+ public String toString() {
+ return "allowCreate=" + allowCreate +
+ "\nexclusiveCreate=" + exclusiveCreate +
+ "\ntransactional=" + transactional +
+ "\nreadOnly=" + readOnly +
+ "\nduplicatesAllowed=" + duplicatesAllowed +
+ "\ndeferredWrite=" + deferredWrite +
+ "\ntemporary=" + temporary +
+ "\nkeyPrefixingEnabled=" + keyPrefixingEnabled +
+ "\n";
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/DatabaseEntry.java libdb-je-java-3.3.98/src/com/sleepycat/je/DatabaseEntry.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/DatabaseEntry.java 2008-01-24 14:59:28.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/DatabaseEntry.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DatabaseEntry.java,v 1.47 2008/01/24 14:59:27 linda Exp $
+ * $Id: DatabaseEntry.java,v 1.48.2.3 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -104,7 +104,7 @@
/* FindBugs - ignore not "final" since a user can set this. */
/** @hidden
- * The maximum number of bytes to show when toString() is called.
+ * The maximum number of bytes to show when toString() is called.
*/
public static int MAX_DUMP_BYTES = 100;
@@ -115,12 +115,16 @@
* defaults to 100. MAX_DUMP_BYTES may be changed by an application if it
* wishes to cause more bytes to be formatted.
*/
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer(" MAX_DUMP_BYTES) {
@@ -426,6 +430,7 @@
* equal both entries must have the same partial properties: partial,
* partialOffset and partialLength.
*/
+ @Override
public boolean equals(Object o) {
if (!(o instanceof DatabaseEntry)) {
return false;
@@ -458,6 +463,7 @@
/**
* Returns a hash code based on the data value.
*/
+ @Override
public int hashCode() {
int hash = 0;
if (data != null) {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/DatabaseException.java libdb-je-java-3.3.98/src/com/sleepycat/je/DatabaseException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/DatabaseException.java 2008-05-29 03:38:24.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/DatabaseException.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DatabaseException.java,v 1.26 2008/05/29 03:38:23 linda Exp $
+ * $Id: DatabaseException.java,v 1.26.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/Database.java libdb-je-java-3.3.98/src/com/sleepycat/je/Database.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/Database.java 2008-05-30 14:04:16.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/Database.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Database.java,v 1.241 2008/05/30 14:04:15 mark Exp $
+ * $Id: Database.java,v 1.242.2.3 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -61,6 +61,7 @@
this.stateName = stateName;
}
+ @Override
public String toString() {
return "DbState." + stateName;
}
@@ -844,9 +845,10 @@
* Stores the key/data pair into the database.
*
*
If the key already appears in the database and duplicates are not
- * configured, the existing key/data pair will be replaced. If the key
- * already appears in the database and sorted duplicates are configured,
- * the new data value is inserted at the correct sorted location.
+ * configured, the data associated with the key will be replaced. If the
+ * key already appears in the database and sorted duplicates are
+ * configured, the new data value is inserted at the correct sorted
+ * location.
*
* @param txn For a transactional database, an explicit transaction may be
* specified, or null may be specified to use auto-commit. For a
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/DatabaseNotFoundException.java libdb-je-java-3.3.98/src/com/sleepycat/je/DatabaseNotFoundException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/DatabaseNotFoundException.java 2008-01-07 14:28:46.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/DatabaseNotFoundException.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DatabaseNotFoundException.java,v 1.9 2008/01/07 14:28:46 cwl Exp $
+ * $Id: DatabaseNotFoundException.java,v 1.9.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/DatabaseStats.java libdb-je-java-3.3.98/src/com/sleepycat/je/DatabaseStats.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/DatabaseStats.java 2008-01-07 14:28:46.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/DatabaseStats.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DatabaseStats.java,v 1.24 2008/01/07 14:28:46 cwl Exp $
+ * $Id: DatabaseStats.java,v 1.24.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/DatabaseTrigger.java libdb-je-java-3.3.98/src/com/sleepycat/je/DatabaseTrigger.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/DatabaseTrigger.java 2008-01-07 14:28:46.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/DatabaseTrigger.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DatabaseTrigger.java,v 1.11 2008/01/07 14:28:46 cwl Exp $
+ * $Id: DatabaseTrigger.java,v 1.11.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/DatabaseUtil.java libdb-je-java-3.3.98/src/com/sleepycat/je/DatabaseUtil.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/DatabaseUtil.java 2008-01-07 14:28:46.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/DatabaseUtil.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DatabaseUtil.java,v 1.36 2008/01/07 14:28:46 cwl Exp $
+ * $Id: DatabaseUtil.java,v 1.36.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/CursorImpl.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/CursorImpl.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/CursorImpl.java 2008-05-20 03:27:34.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/CursorImpl.java 2010-03-26 13:23:56.000000000 +0000
@@ -1,9 +1,9 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: CursorImpl.java,v 1.348 2008/05/20 03:27:34 linda Exp $
+ * $Id: CursorImpl.java,v 1.348.2.5 2010/03/26 13:23:55 mark Exp $
*/
package com.sleepycat.je.dbi;
@@ -115,8 +115,7 @@
*/
private static long lastAllocatedId = 0;
- private ThreadLocal
- treeStatsAccumulatorTL = new ThreadLocal();
+ private ThreadLocal treeStatsAccumulatorTL;
/*
* Allocate a new hashCode id. Doesn't need to be synchronized since it's
@@ -130,8 +129,16 @@
return thisId;
}
+ private void maybeInitTreeStatsAccumulator() {
+ if (treeStatsAccumulatorTL == null) {
+ treeStatsAccumulatorTL =
+ new ThreadLocal();
+ }
+ }
+
private TreeWalkerStatsAccumulator getTreeStatsAccumulator() {
if (EnvironmentImpl.getThreadLocalReferenceCount() > 0) {
+ maybeInitTreeStatsAccumulator();
return treeStatsAccumulatorTL.get();
} else {
return null;
@@ -416,6 +423,7 @@
}
public void setTreeStatsAccumulator(TreeWalkerStatsAccumulator tSA) {
+ maybeInitTreeStatsAccumulator();
treeStatsAccumulatorTL.set(tSA);
}
@@ -697,6 +705,10 @@
assert assertCursorState(false) : dumpToString(true);
+ if (cacheMode == CacheMode.EVICT_LN) {
+ evict();
+ }
+
removeCursor();
locker.unRegisterCursor(this);
@@ -1084,7 +1096,7 @@
}
/**
- * Insert the replicated LN. TODO: very similar to put(), refactor for
+ * Insert the replicated LN. TODO: very similar to put(), refactor for
* HA release.
*/
public OperationStatus putReplicatedLN(LNLogEntry lnEntry,
@@ -1116,7 +1128,7 @@
}
/**
- * Delete the replicated LN.
+ * Delete the replicated LN.
*/
public OperationStatus deleteReplicatedLN(LNLogEntry lnEntry,
ReplicationContext repContext)
@@ -1855,8 +1867,9 @@
}
/**
- * Position the cursor at the first or last record of the databaseImpl. It's
- * okay if this record is deleted. Returns with the target BIN latched.
+ * Position the cursor at the first or last record of the databaseImpl.
+ * It's okay if this record is deleted. Returns with the target BIN
+ * latched.
*
* @return true if a first or last position is found, false if the
* tree being searched is empty.
@@ -1949,7 +1962,7 @@
* An IN was found. Even if it's empty, let Cursor handle
* moving to the first non-deleted entry.
*/
- /*
+ /*
* assert (in instanceof DBIN);
* Will always be true since Tree.getFirst/LastNode always
* returns a DBIN.
@@ -2226,7 +2239,6 @@
* is still the correct LN, but our cursor is now down in a
* duplicate tree. [#14230].
*/
-
ln = lockResult.getLN();
if (ln == null) {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/DatabaseId.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/DatabaseId.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/DatabaseId.java 2008-05-06 18:23:48.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/DatabaseId.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DatabaseId.java,v 1.42 2008/05/06 18:23:48 linda Exp $
+ * $Id: DatabaseId.java,v 1.42.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.dbi;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/DatabaseImpl.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/DatabaseImpl.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/DatabaseImpl.java 2008-05-19 17:52:18.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/DatabaseImpl.java 2010-03-23 15:02:08.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DatabaseImpl.java,v 1.204 2008/05/19 17:52:17 linda Exp $
+ * $Id: DatabaseImpl.java,v 1.205.2.7 2010/03/23 15:02:07 cwl Exp $
*/
package com.sleepycat.je.dbi;
@@ -111,6 +111,8 @@
private static final byte IS_REPLICATED_BIT = 0x4; // isReplicated()
private static final byte NOT_REPLICATED_BIT = 0x8;// notReplicated()
private static final byte PREFIXING_ENABLED = 0x10;// getKeyPrefixing()
+ /* getUtilizationRepairDone() */
+ private static final byte UTILIZATION_REPAIR_DONE = 0x20;
private DatabaseId id; // unique id
private Tree tree;
@@ -168,7 +170,7 @@
/* For unit tests */
private TestHook pendingDeletedHook;
- /*
+ /*
* For debugging -- this gives the ability to force all non-internal
* databases to use key prefixing.
*
@@ -230,6 +232,12 @@
createdAtLogVersion = LogEntryType.LOG_VERSION;
+ /*
+ * New DB records do not need utilization repair. Set this before
+ * calling initWithEnvironment to avoid repair overhead.
+ */
+ setUtilizationRepairDone();
+
commonInit();
initWithEnvironment();
@@ -332,6 +340,19 @@
/* Budgets memory for the utilization info. */
dbFileSummaries.init(envImpl);
+
+ /*
+ * Repair utilization info if necessary. The repair flag will not be
+ * set for MapLNs written by JE 3.3.74 and earlier, and will be set for
+ * all MapLNs written thereafter. Make the utilization dirty to force
+ * the MapLN to be flushed. Even if no repair is performed, we want to
+ * write the updated flag. [#16610]
+ */
+ if (!getUtilizationRepairDone()) {
+ dbFileSummaries.repair(envImpl);
+ setDirtyUtilization();
+ setUtilizationRepairDone();
+ }
}
/**
@@ -508,6 +529,24 @@
flags |= NOT_REPLICATED_BIT;
}
+ /**
+ * Is public for unit testing.
+ */
+ public boolean getUtilizationRepairDone() {
+ return (flags & UTILIZATION_REPAIR_DONE) != 0;
+ }
+
+ private void setUtilizationRepairDone() {
+ flags |= UTILIZATION_REPAIR_DONE;
+ }
+
+ /**
+ * Is public for unit testing.
+ */
+ public void clearUtilizationRepairDone() {
+ flags &= ~UTILIZATION_REPAIR_DONE;
+ }
+
public int getNodeMaxEntries() {
return maxMainTreeEntriesPerNode;
}
@@ -543,7 +582,7 @@
val += 2 * MemoryBudget.byteArraySize
(duplicateComparatorBytes.length);
}
-
+
return val;
}
@@ -729,9 +768,9 @@
* garbage collected, due to eviction or recovery.
*/
public void releaseTreeAdminMemory() {
- /*
+ /*
* There's no need to account for INs which belong to this database,
- * because those are closed by the EnvironmentImpl when clearing
+ * because those are closed by the EnvironmentImpl when clearing
* the INList. Do adjust memory budget for utilization info.
*/
dbFileSummaries.subtractFromMemoryBudget();
@@ -860,7 +899,9 @@
dirtyUtilization = true;
}
assert dbFileSummaries != null;
- return dbFileSummaries.get(fileNum, true /* adjustMemBudget */);
+ return dbFileSummaries.get(fileNum, true /*adjustMemBudget*/,
+ true /*checkResurrected*/,
+ envImpl.getFileManager());
}
/**
@@ -1249,14 +1290,15 @@
new StatsAccumulator(out,
config.getShowProgressInterval(),
emptyStats) {
- void verifyNode(Node node) {
+ @Override
+ void verifyNode(Node node) {
- try {
- node.verify(null);
- } catch (DatabaseException INE) {
- progressStream.println(INE);
- }
+ try {
+ node.verify(null);
+ } catch (DatabaseException INE) {
+ progressStream.println(INE);
}
+ }
};
boolean ok = walkDatabaseTree(statsAcc, out, config.getPrintInfo());
statsAcc.copyToStats(emptyStats);
@@ -1304,6 +1346,11 @@
}
boolean done = false;
while (!done) {
+
+ /* Perform eviction before each cursor operation. */
+ envImpl.getEvictor().doCriticalEviction
+ (false /*backgroundIO*/);
+
try {
status = cursor.getNext
(key, foundData, LockType.NONE, true /*forward*/,
@@ -1405,7 +1452,7 @@
binsSeenByLevel = new long[MAX_LEVELS];
dinsSeenByLevel = new long[MAX_LEVELS];
dbinsSeenByLevel = new long[MAX_LEVELS];
-
+
this.useStats = useStats;
}
@@ -1613,8 +1660,6 @@
byte[] ignore2)
throws DatabaseException {
- assert childLsn != DbLsn.NULL_LSN;
-
/*
* Check if we've exceeded either the max time or max bytes
* allowed for this preload() call.
@@ -1733,7 +1778,7 @@
protected void releaseRootIN(IN root)
throws DatabaseException {
- root.releaseLatch();
+ root.releaseLatch();
}
/*
@@ -1811,20 +1856,20 @@
cacheBudget + " bytes.");
}
- PreloadStats stats = new PreloadStats();
+ PreloadStats pstats = new PreloadStats();
PreloadProcessor callback =
- new PreloadProcessor(envImpl, maxBytes, targetTime, stats);
+ new PreloadProcessor(envImpl, maxBytes, targetTime, pstats);
SortedLSNTreeWalker walker =
new PreloadLSNTreeWalker(this, callback, config);
walker.setPassNullLSNNodes(true);
try {
walker.walk();
} catch (HaltPreloadException HPE) {
- stats.setStatus(HPE.getStatus());
+ pstats.setStatus(HPE.getStatus());
}
assert LatchSupport.countLatchesHeld() == 0;
- return stats;
+ return pstats;
} catch (Error E) {
envImpl.invalidate(E);
throw E;
@@ -1902,9 +1947,9 @@
throws DatabaseException {
try {
- PreloadStats stats = new PreloadStats();
+ PreloadStats pstats = new PreloadStats();
- CountProcessor callback = new CountProcessor(envImpl, stats);
+ CountProcessor callback = new CountProcessor(envImpl, pstats);
ExceptionPredicate excPredicate = new CountExceptionPredicate();
SortedLSNTreeWalker walker =
new SortedLSNTreeWalker(this, false /* setDbState */,
@@ -1912,13 +1957,11 @@
excPredicate);
/* Don't descend down into the dup tree. Use the DupCountLN. */
walker.setProcessDupTree(false);
- if (isDurableDeferredWrite()) {
- walker.setPassNullLSNNodes(true);
- }
+ walker.setPassNullLSNNodes(true);
walker.walk();
assert LatchSupport.countLatchesHeld() == 0;
- return stats.getNLNsLoaded();
+ return pstats.getNLNsLoaded();
} catch (Error E) {
envImpl.invalidate(E);
throw E;
@@ -1958,7 +2001,7 @@
}
sb.append(">");
if (dbFileSummaries != null) {
- Iterator> entries =
+ Iterator> entries =
(Iterator>)
dbFileSummaries.entrySet().iterator();
while (entries.hasNext()) {
@@ -2000,7 +2043,8 @@
1; // createdAtLogVersion
size += LogUtils.getPackedIntLogSize(dbFileSummaries.size());
- Iterator> i =
+
+ Iterator> i =
(Iterator>)
dbFileSummaries.entrySet().iterator();
while (i.hasNext()) {
@@ -2027,7 +2071,7 @@
LogUtils.writePackedInt(logBuffer, maxDupTreeEntriesPerNode);
logBuffer.put(createdAtLogVersion);
LogUtils.writePackedInt(logBuffer, dbFileSummaries.size());
- Iterator> i =
+ Iterator> i =
(Iterator>)
dbFileSummaries.entrySet().iterator();
@@ -2095,8 +2139,8 @@
if (obj instanceof String) {
String className = (String)obj;
- Class extends Comparator> cls =
- (Class extends Comparator>)
+ Class extends Comparator> cls =
+ (Class extends Comparator>)
Class.forName(className);
btreeComparator = instantiateComparator(cls, "Btree");
@@ -2116,8 +2160,8 @@
(duplicateComparatorBytes, "Duplicate");
if (obj instanceof String) {
- Class extends Comparator> cls =
- (Class extends Comparator>)
+ Class extends Comparator> cls =
+ (Class extends Comparator>)
Class.forName((String) obj);
duplicateComparator =
@@ -2152,7 +2196,8 @@
for (int i = 0; i < nFiles; i += 1) {
long fileNum = LogUtils.readPackedLong(itemBuffer);
DbFileSummary summary = dbFileSummaries.get
- (Long.valueOf(fileNum), false /* adjustMemBudget */);
+ (Long.valueOf(fileNum), false /*adjustMemBudget*/,
+ false /*checkResurrected*/, null /*fileManager*/);
summary.readFromLog(itemBuffer, entryVersion);
}
}
@@ -2173,8 +2218,8 @@
id.dumpLog(sb, verbose);
tree.dumpLog(sb, verbose);
if (dbFileSummaries != null) {
- Iterator> entries =
- (Iterator>)
+ Iterator> entries =
+ (Iterator>)
dbFileSummaries.entrySet().iterator();
while (entries.hasNext()) {
@@ -2193,7 +2238,7 @@
static void dumpFlags(StringBuffer sb, boolean verbose, byte flags) {
sb.append(" dupsort=\"").append((flags & DUPS_ALLOWED_BIT) != 0);
sb.append("\" replicated=\"").append((flags & IS_REPLICATED_BIT) != 0);
- sb.append("\" temp=\"").append((flags & TEMPORARY_BIT)
+ sb.append("\" temp=\"").append((flags & TEMPORARY_BIT)
!= 0).append("\" ");
}
@@ -2215,7 +2260,7 @@
/**
* Used for log dumping.
*/
- private static String
+ private static String
getComparatorClassName(Comparator comparator) {
if (comparator != null) {
@@ -2229,8 +2274,8 @@
* Used both to read from the log and to validate a comparator when set in
* DatabaseConfig.
*/
- public static Comparator
- instantiateComparator(Class extends Comparator>
+ public static Comparator
+ instantiateComparator(Class extends Comparator>
comparatorClass,
String comparatorType)
throws LogException {
@@ -2255,7 +2300,7 @@
/**
* Used to validate a comparator when set in DatabaseConfig.
*/
- public static Comparator
+ public static Comparator
instantiateComparator(Comparator comparator,
String comparatorType)
throws DatabaseException {
@@ -2348,7 +2393,7 @@
Object obj = bytesToObject(comparatorBytes, comparatorType);
if (obj instanceof String) {
String className = (String)obj;
- Class extends Comparator> cls =
+ Class extends Comparator> cls =
(Class extends Comparator>)
Class.forName(className);
comparator = instantiateComparator(cls, comparatorType);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/DbConfigException.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/DbConfigException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/DbConfigException.java 2008-05-20 17:52:34.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/DbConfigException.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbConfigException.java,v 1.18 2008/05/20 17:52:34 linda Exp $
+ * $Id: DbConfigException.java,v 1.18.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.dbi;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/DbConfigManager.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/DbConfigManager.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/DbConfigManager.java 2008-05-30 19:07:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/DbConfigManager.java 2008-06-30 20:54:46.000000000 +0000
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000,2008 Oracle. All rights reserved.
*
- * $Id: DbConfigManager.java,v 1.47 2008/05/30 19:07:41 mark Exp $
+ * $Id: DbConfigManager.java,v 1.48 2008/06/30 20:54:46 linda Exp $
*/
package com.sleepycat.je.dbi;
@@ -192,7 +192,10 @@
/**
* Validate a collection of configurations at Environment and Replicator
* startup time. Check for valid configuration names and values.
+ * SuppressWarnings here because Enumeration doesn't work well with
+ * Properties in Java 1.5
*/
+ @SuppressWarnings("unchecked")
public static void validateProperties(Properties props,
boolean forReplication,
String configClassName,
@@ -253,7 +256,8 @@
* Apply the configurations specified in the je.properties file to override
* the programatically set configuration values held in the property bag.
*/
- public static void applyFileConfig(File envHome,
+ @SuppressWarnings("unchecked")
+ public static void applyFileConfig(File envHome,
Properties props,
boolean forReplication,
String errorClassName)
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/DbEnvState.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/DbEnvState.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/DbEnvState.java 2008-01-07 14:28:48.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/DbEnvState.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbEnvState.java,v 1.21 2008/01/07 14:28:48 cwl Exp $
+ * $Id: DbEnvState.java,v 1.22.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.dbi;
@@ -34,6 +34,7 @@
this.name = name;
}
+ @Override
public String toString() {
return name;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/DbTree.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/DbTree.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/DbTree.java 2008-05-21 14:49:14.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/DbTree.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbTree.java,v 1.205 2008/05/21 14:49:14 cwl Exp $
+ * $Id: DbTree.java,v 1.206.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.dbi;
@@ -1624,6 +1624,7 @@
return self.toString();
}
+ @Override
public String toString() {
return dumpString(0);
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/EnvironmentImpl.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/EnvironmentImpl.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/EnvironmentImpl.java 2008-05-30 19:07:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/EnvironmentImpl.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EnvironmentImpl.java,v 1.301 2008/05/30 19:07:41 mark Exp $
+ * $Id: EnvironmentImpl.java,v 1.301.2.8 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.dbi;
@@ -222,6 +222,13 @@
IS_DALVIK = "Dalvik".equals(System.getProperty("java.vm.name"));
}
+ public static final boolean IS_WINDOWS_7;
+
+ static {
+ String osName = System.getProperty("os.name");
+ IS_WINDOWS_7 = (osName != null && osName.startsWith("Windows 7"));
+ }
+
/*
* Timeout for waiting for API lockout to finish.
*/
@@ -300,8 +307,7 @@
}
}
- directNIO =
- configManager.getBoolean(EnvironmentParams.LOG_DIRECT_NIO);
+ directNIO = false;
fairLatches =
configManager.getBoolean(EnvironmentParams.ENV_FAIR_LATCHES);
isReadOnly =
@@ -351,7 +357,7 @@
/*
* The node sequence transient ids, but not the node ids, must be
* created before the DbTree is created because the transient node
- * id sequence is used during the creation of the dbtree.
+ * id sequence is used during the creation of the dbtree.
*/
nodeSequence = new NodeSequence();
nodeSequence.initTransientNodeId();
@@ -359,7 +365,7 @@
/*
* Instantiate a new, blank dbtree. If the environment already
* exists, recovery will recreate the dbMapTree from the log and
- * overwrite this instance.
+ * overwrite this instance.
*/
dbMapTree = new DbTree(this, replicationIntended);
@@ -501,9 +507,10 @@
* exists, recovery will recreate the dbMapTree from the log and
* overwrite this instance.
*/
- if (dbMapTree != null) {
- dbMapTree.close();
- }
+ if (dbMapTree != null) {
+ dbMapTree.close();
+ }
+
dbMapTree = new DbTree(this, replicationIntended);
mapTreeRootLsn = DbLsn.NULL_LSN;
referenceCount = 0;
@@ -835,7 +842,7 @@
false,
null);
LockGrantType grant = lr.getLockGrant();
-
+
if (grant == LockGrantType.DENIED) {
throw new APILockedException("API Lock timeout");
}
@@ -1446,7 +1453,7 @@
errors.println();
}
- /*
+ /*
* Close the memory budgets on these components before the
* INList is forcibly released and the treeAdmin budget is
* cleared.
@@ -1537,11 +1544,11 @@
return threadLocalReferenceCount;
}
- public static synchronized void incThreadLocalReferenceCount() {
+ static synchronized void incThreadLocalReferenceCount() {
threadLocalReferenceCount++;
}
- public static synchronized void decThreadLocalReferenceCount() {
+ static synchronized void decThreadLocalReferenceCount() {
threadLocalReferenceCount--;
}
@@ -1594,9 +1601,17 @@
}
long memoryUsage = memoryBudget.getVariableCacheUsage();
- if (memoryUsage!= 0) {
+ if (memoryUsage != 0) {
clean = false;
System.err.println("Local Cache Usage = " + memoryUsage);
+ System.err.println("Tree Memory Usage = " +
+ memoryBudget.getTreeMemoryUsage());
+ System.err.println("Admin Memory Usage = " +
+ memoryBudget.getAdminMemoryUsage());
+ System.err.println("Tree Admin Memory Usage = " +
+ memoryBudget.getTreeAdminMemoryUsage());
+ System.err.println("Lock Memory Usage = " +
+ memoryBudget.getLockMemoryUsage());
EnvironmentStats memoryStats = new EnvironmentStats();
memoryBudget.loadStats(new StatsConfig(),
memoryStats);
@@ -1666,6 +1681,11 @@
public int invokeCleaner()
throws DatabaseException {
+ if (isReadOnly || isMemOnly) {
+ throw new IllegalStateException
+ ("Log cleaning not allowed in a read-only or memory-only " +
+ "environment");
+ }
if (cleaner != null) {
return cleaner.doClean(true, // cleanMultipleFiles
false); // forceCleaning
@@ -1840,7 +1860,7 @@
return isMemOnly;
}
- /*
+ /*
* FUTURE: change this to be non-static. It's static now just to avoid
* passing down parameters in various places.
*/
@@ -1859,10 +1879,6 @@
return dbEviction;
}
- public boolean useDirectNIO() {
- return directNIO;
- }
-
public static int getAdler32ChunkSize() {
return adler32ChunkSize;
}
@@ -1916,7 +1932,7 @@
public NodeSequence getNodeSequence() {
return nodeSequence;
}
-
+
/**
* Clones the current configuration.
*/
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/GetMode.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/GetMode.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/GetMode.java 2008-01-07 14:28:48.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/GetMode.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: GetMode.java,v 1.10 2008/01/07 14:28:48 cwl Exp $
+ * $Id: GetMode.java,v 1.11.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.dbi;
@@ -32,6 +32,7 @@
return forward;
}
+ @Override
public String toString() {
return name;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/INList.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/INList.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/INList.java 2008-05-06 18:01:32.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/INList.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: INList.java,v 1.59 2008/05/06 18:01:32 linda Exp $
+ * $Id: INList.java,v 1.59.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.dbi;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/MemoryBudget.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/MemoryBudget.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/MemoryBudget.java 2008-05-29 13:50:08.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/MemoryBudget.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: MemoryBudget.java,v 1.85 2008/05/29 13:50:07 cwl Exp $
+ * $Id: MemoryBudget.java,v 1.86.2.4 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.dbi;
@@ -54,6 +54,7 @@
*
* _32 values are the same on Windows and Solaris.
* _64 values are from 1.5.0_05 on Solaris.
+ * _Dalvik values are from running the Sizeof test on Android.
*
* Specifically:
*
@@ -69,71 +70,90 @@
// 7
private final static int LONG_OVERHEAD_32 = 16;
private final static int LONG_OVERHEAD_64 = 24;
+ private final static int LONG_OVERHEAD_DALVIK = 24;
// 8
private final static int ARRAY_OVERHEAD_32 = 16;
private final static int ARRAY_OVERHEAD_64 = 24;
+ private final static int ARRAY_OVERHEAD_DALVIK = 24;
private final static int ARRAY_SIZE_INCLUDED_32 = 4;
private final static int ARRAY_SIZE_INCLUDED_64 = 0;
+ private final static int ARRAY_SIZE_INCLUDED_DALVIK = 4;
// 2
private final static int OBJECT_OVERHEAD_32 = 8;
private final static int OBJECT_OVERHEAD_64 = 16;
+ private final static int OBJECT_OVERHEAD_DALVIK = 16;
// (4 - ARRAY_OVERHEAD) / 256
// 64b: 4 is 2072
+ // Dalvik; 4 is 1048
private final static int OBJECT_ARRAY_ITEM_OVERHEAD_32 = 4;
private final static int OBJECT_ARRAY_ITEM_OVERHEAD_64 = 8;
+ private final static int OBJECT_ARRAY_ITEM_OVERHEAD_DALVIK = 4;
// 20
private final static int HASHMAP_OVERHEAD_32 = 120;
private final static int HASHMAP_OVERHEAD_64_15 = 216;
private final static int HASHMAP_OVERHEAD_64_16 = 218;
+ private final static int HASHMAP_OVERHEAD_DALVIK = 128;
// 21 - OBJECT_OVERHEAD - HASHMAP_OVERHEAD
// 64b: 21 is max(280,...,287) on Linux/Solaris 1.5/1.6
+ // Dalvik: 21 is 176
private final static int HASHMAP_ENTRY_OVERHEAD_32 = 24;
private final static int HASHMAP_ENTRY_OVERHEAD_64 = 55;
+ private final static int HASHMAP_ENTRY_OVERHEAD_DALVIK = 32;
// 22
private final static int HASHSET_OVERHEAD_32 = 136;
private final static int HASHSET_OVERHEAD_64 = 240;
+ private final static int HASHSET_OVERHEAD_DALVIK = 144;
// 23 - OBJECT_OVERHEAD - HASHSET_OVERHEAD
// 64b: 23 is max(304,...,311) on Linux/Solaris
+ // Dalvik: 23 is 192
private final static int HASHSET_ENTRY_OVERHEAD_32 = 24;
private final static int HASHSET_ENTRY_OVERHEAD_64 = 55;
+ private final static int HASHSET_ENTRY_OVERHEAD_DALVIK = 32;
// HASHMAP_OVERHEAD * 2
private final static int TWOHASHMAPS_OVERHEAD_32 = 240;
private final static int TWOHASHMAPS_OVERHEAD_64_15 = 432;
private final static int TWOHASHMAPS_OVERHEAD_64_16 = 436;
+ private final static int TWOHASHMAPS_OVERHEAD_DALVIK = 256;
// 34
private final static int TREEMAP_OVERHEAD_32_15 = 40;
private final static int TREEMAP_OVERHEAD_32_16 = 48;
private final static int TREEMAP_OVERHEAD_64_15 = 64;
private final static int TREEMAP_OVERHEAD_64_16 = 80;
+ private final static int TREEMAP_OVERHEAD_DALVIK = 40;
// 35 - OBJECT_OVERHEAD - TREEMAP_OVERHEAD
// 64b: 35 is 144 on 1.5 and 160 on 1.6, result is 64 for both
+ // Dalvik: 35 is 96
private final static int TREEMAP_ENTRY_OVERHEAD_32 = 32;
private final static int TREEMAP_ENTRY_OVERHEAD_64 = 64;
+ private final static int TREEMAP_ENTRY_OVERHEAD_DALVIK = 40;
// 36
private final static int MAPLN_OVERHEAD_32_15 = 640;
private final static int MAPLN_OVERHEAD_32_16 = 664;
private final static int MAPLN_OVERHEAD_64_15 = 1096;
private final static int MAPLN_OVERHEAD_64_16 = 1136;
+ private final static int MAPLN_OVERHEAD_DALVIK = 744;
// 9
private final static int LN_OVERHEAD_32 = 24;
private final static int LN_OVERHEAD_64 = 40;
+ private final static int LN_OVERHEAD_DALVIK = 32;
// 19
private final static int DUPCOUNTLN_OVERHEAD_32 = 24;
private final static int DUPCOUNTLN_OVERHEAD_64 = 48;
+ private final static int DUPCOUNTLN_OVERHEAD_DALVIK = 32;
// 12
// 64b: 12 is max(536, 539) on Linux/Solaris on 1.5
@@ -141,43 +161,52 @@
private final static int BIN_FIXED_OVERHEAD_32 = 370; // 344 in 1.5
private final static int BIN_FIXED_OVERHEAD_64_15 = 544;
private final static int BIN_FIXED_OVERHEAD_64_16 = 584;
+ private final static int BIN_FIXED_OVERHEAD_DALVIK = 458;
// 18
private final static int DIN_FIXED_OVERHEAD_32 = 377; // 352 in 1.5
private final static int DIN_FIXED_OVERHEAD_64_15 = 552;
private final static int DIN_FIXED_OVERHEAD_64_16 = 596;
+ private final static int DIN_FIXED_OVERHEAD_DALVIK = 451;
// 17
// 64b: 17 is max(592,593) on Linux/Solaris on 1.6
private final static int DBIN_FIXED_OVERHEAD_32 = 377; // 352 in 1.5
private final static int DBIN_FIXED_OVERHEAD_64_15 = 560;
private final static int DBIN_FIXED_OVERHEAD_64_16 = 600;
+ private final static int DBIN_FIXED_OVERHEAD_DALVIK = 458;
// 13
// 339 is max(312,339) on Solaris 1.5 vs 1.6
private final static int IN_FIXED_OVERHEAD_32 = 339; // 312 in 1.5
private final static int IN_FIXED_OVERHEAD_64_15 = 488;
private final static int IN_FIXED_OVERHEAD_64_16 = 528;
+ private final static int IN_FIXED_OVERHEAD_DALVIK = 402;
// 6
private final static int KEY_OVERHEAD_32 = 16;
private final static int KEY_OVERHEAD_64 = 24;
+ private final static int KEY_OVERHEAD_DALVIK = 16;
// 24
private final static int LOCKIMPL_OVERHEAD_32 = 24;
private final static int LOCKIMPL_OVERHEAD_64 = 48;
+ private final static int LOCKIMPL_OVERHEAD_DALVIK = 32;
// 42
private final static int THINLOCKIMPL_OVERHEAD_32 = 16;
private final static int THINLOCKIMPL_OVERHEAD_64 = 32;
+ private final static int THINLOCKIMPL_OVERHEAD_DALVIK = 24;
// 25
private final static int LOCKINFO_OVERHEAD_32 = 16;
private final static int LOCKINFO_OVERHEAD_64 = 32;
+ private final static int LOCKINFO_OVERHEAD_DALVIK = 24;
// 37
private final static int WRITE_LOCKINFO_OVERHEAD_32 = 32;
private final static int WRITE_LOCKINFO_OVERHEAD_64 = 40;
+ private final static int WRITE_LOCKINFO_OVERHEAD_DALVIK = 40;
/*
* Txn memory is the size for the Txn + a hashmap entry
@@ -186,58 +215,56 @@
// 15
private final static int TXN_OVERHEAD_32 = 186;
private final static int TXN_OVERHEAD_64 = 281;
+ private final static int TXN_OVERHEAD_DALVIK = 218;
// 26
private final static int CHECKPOINT_REFERENCE_SIZE_32 = 40 +
HASHSET_ENTRY_OVERHEAD_32;
private final static int CHECKPOINT_REFERENCE_SIZE_64 = 56 +
HASHSET_ENTRY_OVERHEAD_64;
+ private final static int CHECKPOINT_REFERENCE_SIZE_DALVIK = 40;
/* The per-log-file bytes used in UtilizationProfile. */
// 29 / 10
private final static int UTILIZATION_PROFILE_ENTRY_32 = 101;
private final static int UTILIZATION_PROFILE_ENTRY_64 = 153;
+ private final static int UTILIZATION_PROFILE_ENTRY_DALVIK = 124;
// 38
private final static int DBFILESUMMARY_OVERHEAD_32 = 40;
private final static int DBFILESUMMARY_OVERHEAD_64 = 48;
+ private final static int DBFILESUMMARY_OVERHEAD_DALVIK = 48;
/* Tracked File Summary overheads. */
// 31
private final static int TFS_LIST_INITIAL_OVERHEAD_32 = 464;
private final static int TFS_LIST_INITIAL_OVERHEAD_64 = 504;
+ private final static int TFS_LIST_INITIAL_OVERHEAD_DALVIK = 472;
// 30
// 64b: 30 is max(464,464,464,465) on Linux/Solaris on 1.5/1.6
private final static int TFS_LIST_SEGMENT_OVERHEAD_32 = 440;
private final static int TFS_LIST_SEGMENT_OVERHEAD_64 = 465;
+ private final static int TFS_LIST_SEGMENT_OVERHEAD_DALVIK = 448;
// 33
private final static int LN_INFO_OVERHEAD_32 = 24;
private final static int LN_INFO_OVERHEAD_64 = 48;
+ private final static int LN_INFO_OVERHEAD_DALVIK = 32;
// 43
private final static int FILESUMMARYLN_OVERHEAD_32 = 112;
private final static int FILESUMMARYLN_OVERHEAD_64 = 168;
+ private final static int FILESUMMARYLN_OVERHEAD_DALVIK = 136;
/* Approximate element size in an ArrayList of Long. */
// (28 - 27) / 10
// 32b: 28 and 27 are 240 and 40, resp.
// 64b: 28 and 27 are 384 and 64, resp.
+ // Dalvik: 28 and 27 are 336 and 32, resp.
private final static int LONG_LIST_PER_ITEM_OVERHEAD_32 = 20;
private final static int LONG_LIST_PER_ITEM_OVERHEAD_64 = 32;
-
- // 43
- private final static int INCOMING_CONNECTION_HANDLER_OVERHEAD_32 = 24;
- private final static int INCOMING_CONNECTION_HANDLER_OVERHEAD_64 = 48;
-
- // 44
- private final static int RECEIVE_MESSAGE_HANDLER_OVERHEAD_32 = 40;
- private final static int RECEIVE_MESSAGE_HANDLER_OVERHEAD_64 = 80;
-
- // 45
- private final static int SEND_MESSAGE_HANDLER_OVERHEAD_32 = 56;
- private final static int SEND_MESSAGE_HANDLER_OVERHEAD_64 = 96;
+ private final static int LONG_LIST_PER_ITEM_OVERHEAD_DALVIK = 30;
public final static int LONG_OVERHEAD;
public final static int ARRAY_OVERHEAD;
@@ -280,109 +307,150 @@
private final static String FORCE_JVM_ARCH = "je.forceJVMArch";
static {
- String javaVersion = System.getProperty("java.version");
- boolean isJVM15 = javaVersion != null &&
- javaVersion.startsWith("1.5.");
-
- boolean is64 = false;
- String overrideArch = System.getProperty(FORCE_JVM_ARCH);
- try {
- if (overrideArch == null) {
- String arch = System.getProperty(JVM_ARCH_PROPERTY);
- if (arch != null) {
- is64 = Integer.parseInt(arch) == 64;
+
+ /*
+ * On the Dalvik VM (Android), there is no difference in sizes between
+ * any platforms.
+ */
+ if (EnvironmentImpl.IS_DALVIK) {
+ LONG_OVERHEAD = LONG_OVERHEAD_DALVIK;
+ ARRAY_OVERHEAD = ARRAY_OVERHEAD_DALVIK;
+ ARRAY_SIZE_INCLUDED = ARRAY_SIZE_INCLUDED_DALVIK;
+ OBJECT_OVERHEAD = OBJECT_OVERHEAD_DALVIK;
+ OBJECT_ARRAY_ITEM_OVERHEAD = OBJECT_ARRAY_ITEM_OVERHEAD_DALVIK;
+ HASHMAP_OVERHEAD = HASHMAP_OVERHEAD_DALVIK;
+ HASHMAP_ENTRY_OVERHEAD = HASHMAP_ENTRY_OVERHEAD_DALVIK;
+ HASHSET_OVERHEAD = HASHSET_OVERHEAD_DALVIK;
+ HASHSET_ENTRY_OVERHEAD = HASHSET_ENTRY_OVERHEAD_DALVIK;
+ TWOHASHMAPS_OVERHEAD = TWOHASHMAPS_OVERHEAD_DALVIK;
+ TREEMAP_OVERHEAD = TREEMAP_OVERHEAD_DALVIK;
+ TREEMAP_ENTRY_OVERHEAD = TREEMAP_ENTRY_OVERHEAD_DALVIK;
+ MAPLN_OVERHEAD = MAPLN_OVERHEAD_DALVIK;
+ LN_OVERHEAD = LN_OVERHEAD_DALVIK;
+ DUPCOUNTLN_OVERHEAD = DUPCOUNTLN_OVERHEAD_DALVIK;
+ BIN_FIXED_OVERHEAD = BIN_FIXED_OVERHEAD_DALVIK;
+ DIN_FIXED_OVERHEAD = DIN_FIXED_OVERHEAD_DALVIK;
+ DBIN_FIXED_OVERHEAD = DBIN_FIXED_OVERHEAD_DALVIK;
+ IN_FIXED_OVERHEAD = IN_FIXED_OVERHEAD_DALVIK;
+ KEY_OVERHEAD = KEY_OVERHEAD_DALVIK;
+ LOCKIMPL_OVERHEAD = LOCKIMPL_OVERHEAD_DALVIK;
+ THINLOCKIMPL_OVERHEAD = THINLOCKIMPL_OVERHEAD_DALVIK;
+ LOCKINFO_OVERHEAD = LOCKINFO_OVERHEAD_DALVIK;
+ WRITE_LOCKINFO_OVERHEAD = WRITE_LOCKINFO_OVERHEAD_DALVIK;
+ TXN_OVERHEAD = TXN_OVERHEAD_DALVIK;
+ CHECKPOINT_REFERENCE_SIZE = CHECKPOINT_REFERENCE_SIZE_DALVIK;
+ UTILIZATION_PROFILE_ENTRY = UTILIZATION_PROFILE_ENTRY_DALVIK;
+ DBFILESUMMARY_OVERHEAD = DBFILESUMMARY_OVERHEAD_DALVIK;
+ TFS_LIST_INITIAL_OVERHEAD = TFS_LIST_INITIAL_OVERHEAD_DALVIK;
+ TFS_LIST_SEGMENT_OVERHEAD = TFS_LIST_SEGMENT_OVERHEAD_DALVIK;
+ LN_INFO_OVERHEAD = LN_INFO_OVERHEAD_DALVIK;
+ FILESUMMARYLN_OVERHEAD = FILESUMMARYLN_OVERHEAD_DALVIK;
+ LONG_LIST_PER_ITEM_OVERHEAD = LONG_LIST_PER_ITEM_OVERHEAD_DALVIK;
+ } else {
+ String javaVersion = System.getProperty("java.version");
+ boolean isJVM15 = javaVersion != null &&
+ javaVersion.startsWith("1.5.");
+
+ boolean is64 = false;
+ String overrideArch = System.getProperty(FORCE_JVM_ARCH);
+ try {
+ if (overrideArch == null) {
+ String arch = System.getProperty(JVM_ARCH_PROPERTY);
+ if (arch != null) {
+ is64 = Integer.parseInt(arch) == 64;
+ }
+ } else {
+ is64 = Integer.parseInt(overrideArch) == 64;
}
- } else {
- is64 = Integer.parseInt(overrideArch) == 64;
+ } catch (NumberFormatException NFE) {
+ NFE.printStackTrace(System.err);
}
- } catch (NumberFormatException NFE) {
- NFE.printStackTrace(System.err);
- }
- if (is64) {
- LONG_OVERHEAD = LONG_OVERHEAD_64;
- ARRAY_OVERHEAD = ARRAY_OVERHEAD_64;
- ARRAY_SIZE_INCLUDED = ARRAY_SIZE_INCLUDED_64;
- OBJECT_OVERHEAD = OBJECT_OVERHEAD_64;
- OBJECT_ARRAY_ITEM_OVERHEAD = OBJECT_ARRAY_ITEM_OVERHEAD_64;
- HASHMAP_ENTRY_OVERHEAD = HASHMAP_ENTRY_OVERHEAD_64;
- HASHSET_OVERHEAD = HASHSET_OVERHEAD_64;
- HASHSET_ENTRY_OVERHEAD = HASHSET_ENTRY_OVERHEAD_64;
- if (isJVM15) {
- TREEMAP_OVERHEAD = TREEMAP_OVERHEAD_64_15;
- MAPLN_OVERHEAD = MAPLN_OVERHEAD_64_15;
- BIN_FIXED_OVERHEAD = BIN_FIXED_OVERHEAD_64_15;
- DIN_FIXED_OVERHEAD = DIN_FIXED_OVERHEAD_64_15;
- DBIN_FIXED_OVERHEAD = DBIN_FIXED_OVERHEAD_64_15;
- IN_FIXED_OVERHEAD = IN_FIXED_OVERHEAD_64_15;
- HASHMAP_OVERHEAD = HASHMAP_OVERHEAD_64_15;
- TWOHASHMAPS_OVERHEAD = TWOHASHMAPS_OVERHEAD_64_15;
- } else {
- TREEMAP_OVERHEAD = TREEMAP_OVERHEAD_64_16;
- MAPLN_OVERHEAD = MAPLN_OVERHEAD_64_16;
- BIN_FIXED_OVERHEAD = BIN_FIXED_OVERHEAD_64_16;
- DIN_FIXED_OVERHEAD = DIN_FIXED_OVERHEAD_64_16;
- DBIN_FIXED_OVERHEAD = DBIN_FIXED_OVERHEAD_64_16;
- IN_FIXED_OVERHEAD = IN_FIXED_OVERHEAD_64_16;
- HASHMAP_OVERHEAD = HASHMAP_OVERHEAD_64_16;
- TWOHASHMAPS_OVERHEAD = TWOHASHMAPS_OVERHEAD_64_16;
- }
- TREEMAP_ENTRY_OVERHEAD = TREEMAP_ENTRY_OVERHEAD_64;
- LN_OVERHEAD = LN_OVERHEAD_64;
- DUPCOUNTLN_OVERHEAD = DUPCOUNTLN_OVERHEAD_64;
- TXN_OVERHEAD = TXN_OVERHEAD_64;
- CHECKPOINT_REFERENCE_SIZE = CHECKPOINT_REFERENCE_SIZE_64;
- KEY_OVERHEAD = KEY_OVERHEAD_64;
- LOCKIMPL_OVERHEAD = LOCKIMPL_OVERHEAD_64;
- THINLOCKIMPL_OVERHEAD = THINLOCKIMPL_OVERHEAD_64;
- LOCKINFO_OVERHEAD = LOCKINFO_OVERHEAD_64;
- WRITE_LOCKINFO_OVERHEAD = WRITE_LOCKINFO_OVERHEAD_64;
- UTILIZATION_PROFILE_ENTRY = UTILIZATION_PROFILE_ENTRY_64;
- DBFILESUMMARY_OVERHEAD = DBFILESUMMARY_OVERHEAD_64;
- TFS_LIST_INITIAL_OVERHEAD = TFS_LIST_INITIAL_OVERHEAD_64;
- TFS_LIST_SEGMENT_OVERHEAD = TFS_LIST_SEGMENT_OVERHEAD_64;
- LN_INFO_OVERHEAD = LN_INFO_OVERHEAD_64;
- FILESUMMARYLN_OVERHEAD = FILESUMMARYLN_OVERHEAD_64;
- LONG_LIST_PER_ITEM_OVERHEAD = LONG_LIST_PER_ITEM_OVERHEAD_64;
- } else {
- LONG_OVERHEAD = LONG_OVERHEAD_32;
- ARRAY_OVERHEAD = ARRAY_OVERHEAD_32;
- ARRAY_SIZE_INCLUDED = ARRAY_SIZE_INCLUDED_32;
- OBJECT_OVERHEAD = OBJECT_OVERHEAD_32;
- OBJECT_ARRAY_ITEM_OVERHEAD = OBJECT_ARRAY_ITEM_OVERHEAD_32;
- HASHMAP_OVERHEAD = HASHMAP_OVERHEAD_32;
- HASHMAP_ENTRY_OVERHEAD = HASHMAP_ENTRY_OVERHEAD_32;
- HASHSET_OVERHEAD = HASHSET_OVERHEAD_32;
- HASHSET_ENTRY_OVERHEAD = HASHSET_ENTRY_OVERHEAD_32;
- TWOHASHMAPS_OVERHEAD = TWOHASHMAPS_OVERHEAD_32;
- if (isJVM15) {
- TREEMAP_OVERHEAD = TREEMAP_OVERHEAD_32_15;
- MAPLN_OVERHEAD = MAPLN_OVERHEAD_32_15;
+ if (is64) {
+ LONG_OVERHEAD = LONG_OVERHEAD_64;
+ ARRAY_OVERHEAD = ARRAY_OVERHEAD_64;
+ ARRAY_SIZE_INCLUDED = ARRAY_SIZE_INCLUDED_64;
+ OBJECT_OVERHEAD = OBJECT_OVERHEAD_64;
+ OBJECT_ARRAY_ITEM_OVERHEAD = OBJECT_ARRAY_ITEM_OVERHEAD_64;
+ HASHMAP_ENTRY_OVERHEAD = HASHMAP_ENTRY_OVERHEAD_64;
+ HASHSET_OVERHEAD = HASHSET_OVERHEAD_64;
+ HASHSET_ENTRY_OVERHEAD = HASHSET_ENTRY_OVERHEAD_64;
+ if (isJVM15) {
+ TREEMAP_OVERHEAD = TREEMAP_OVERHEAD_64_15;
+ MAPLN_OVERHEAD = MAPLN_OVERHEAD_64_15;
+ BIN_FIXED_OVERHEAD = BIN_FIXED_OVERHEAD_64_15;
+ DIN_FIXED_OVERHEAD = DIN_FIXED_OVERHEAD_64_15;
+ DBIN_FIXED_OVERHEAD = DBIN_FIXED_OVERHEAD_64_15;
+ IN_FIXED_OVERHEAD = IN_FIXED_OVERHEAD_64_15;
+ HASHMAP_OVERHEAD = HASHMAP_OVERHEAD_64_15;
+ TWOHASHMAPS_OVERHEAD = TWOHASHMAPS_OVERHEAD_64_15;
+ } else {
+ TREEMAP_OVERHEAD = TREEMAP_OVERHEAD_64_16;
+ MAPLN_OVERHEAD = MAPLN_OVERHEAD_64_16;
+ BIN_FIXED_OVERHEAD = BIN_FIXED_OVERHEAD_64_16;
+ DIN_FIXED_OVERHEAD = DIN_FIXED_OVERHEAD_64_16;
+ DBIN_FIXED_OVERHEAD = DBIN_FIXED_OVERHEAD_64_16;
+ IN_FIXED_OVERHEAD = IN_FIXED_OVERHEAD_64_16;
+ HASHMAP_OVERHEAD = HASHMAP_OVERHEAD_64_16;
+ TWOHASHMAPS_OVERHEAD = TWOHASHMAPS_OVERHEAD_64_16;
+ }
+ TREEMAP_ENTRY_OVERHEAD = TREEMAP_ENTRY_OVERHEAD_64;
+ LN_OVERHEAD = LN_OVERHEAD_64;
+ DUPCOUNTLN_OVERHEAD = DUPCOUNTLN_OVERHEAD_64;
+ TXN_OVERHEAD = TXN_OVERHEAD_64;
+ CHECKPOINT_REFERENCE_SIZE = CHECKPOINT_REFERENCE_SIZE_64;
+ KEY_OVERHEAD = KEY_OVERHEAD_64;
+ LOCKIMPL_OVERHEAD = LOCKIMPL_OVERHEAD_64;
+ THINLOCKIMPL_OVERHEAD = THINLOCKIMPL_OVERHEAD_64;
+ LOCKINFO_OVERHEAD = LOCKINFO_OVERHEAD_64;
+ WRITE_LOCKINFO_OVERHEAD = WRITE_LOCKINFO_OVERHEAD_64;
+ UTILIZATION_PROFILE_ENTRY = UTILIZATION_PROFILE_ENTRY_64;
+ DBFILESUMMARY_OVERHEAD = DBFILESUMMARY_OVERHEAD_64;
+ TFS_LIST_INITIAL_OVERHEAD = TFS_LIST_INITIAL_OVERHEAD_64;
+ TFS_LIST_SEGMENT_OVERHEAD = TFS_LIST_SEGMENT_OVERHEAD_64;
+ LN_INFO_OVERHEAD = LN_INFO_OVERHEAD_64;
+ FILESUMMARYLN_OVERHEAD = FILESUMMARYLN_OVERHEAD_64;
+ LONG_LIST_PER_ITEM_OVERHEAD = LONG_LIST_PER_ITEM_OVERHEAD_64;
} else {
- TREEMAP_OVERHEAD = TREEMAP_OVERHEAD_32_16;
- MAPLN_OVERHEAD = MAPLN_OVERHEAD_32_16;
+ LONG_OVERHEAD = LONG_OVERHEAD_32;
+ ARRAY_OVERHEAD = ARRAY_OVERHEAD_32;
+ ARRAY_SIZE_INCLUDED = ARRAY_SIZE_INCLUDED_32;
+ OBJECT_OVERHEAD = OBJECT_OVERHEAD_32;
+ OBJECT_ARRAY_ITEM_OVERHEAD = OBJECT_ARRAY_ITEM_OVERHEAD_32;
+ HASHMAP_OVERHEAD = HASHMAP_OVERHEAD_32;
+ HASHMAP_ENTRY_OVERHEAD = HASHMAP_ENTRY_OVERHEAD_32;
+ HASHSET_OVERHEAD = HASHSET_OVERHEAD_32;
+ HASHSET_ENTRY_OVERHEAD = HASHSET_ENTRY_OVERHEAD_32;
+ TWOHASHMAPS_OVERHEAD = TWOHASHMAPS_OVERHEAD_32;
+ if (isJVM15) {
+ TREEMAP_OVERHEAD = TREEMAP_OVERHEAD_32_15;
+ MAPLN_OVERHEAD = MAPLN_OVERHEAD_32_15;
+ } else {
+ TREEMAP_OVERHEAD = TREEMAP_OVERHEAD_32_16;
+ MAPLN_OVERHEAD = MAPLN_OVERHEAD_32_16;
+ }
+ TREEMAP_ENTRY_OVERHEAD = TREEMAP_ENTRY_OVERHEAD_32;
+ LN_OVERHEAD = LN_OVERHEAD_32;
+ DUPCOUNTLN_OVERHEAD = DUPCOUNTLN_OVERHEAD_32;
+ BIN_FIXED_OVERHEAD = BIN_FIXED_OVERHEAD_32;
+ DIN_FIXED_OVERHEAD = DIN_FIXED_OVERHEAD_32;
+ DBIN_FIXED_OVERHEAD = DBIN_FIXED_OVERHEAD_32;
+ IN_FIXED_OVERHEAD = IN_FIXED_OVERHEAD_32;
+ TXN_OVERHEAD = TXN_OVERHEAD_32;
+ CHECKPOINT_REFERENCE_SIZE = CHECKPOINT_REFERENCE_SIZE_32;
+ KEY_OVERHEAD = KEY_OVERHEAD_32;
+ LOCKIMPL_OVERHEAD = LOCKIMPL_OVERHEAD_32;
+ THINLOCKIMPL_OVERHEAD = THINLOCKIMPL_OVERHEAD_32;
+ LOCKINFO_OVERHEAD = LOCKINFO_OVERHEAD_32;
+ WRITE_LOCKINFO_OVERHEAD = WRITE_LOCKINFO_OVERHEAD_32;
+ UTILIZATION_PROFILE_ENTRY = UTILIZATION_PROFILE_ENTRY_32;
+ DBFILESUMMARY_OVERHEAD = DBFILESUMMARY_OVERHEAD_32;
+ TFS_LIST_INITIAL_OVERHEAD = TFS_LIST_INITIAL_OVERHEAD_32;
+ TFS_LIST_SEGMENT_OVERHEAD = TFS_LIST_SEGMENT_OVERHEAD_32;
+ LN_INFO_OVERHEAD = LN_INFO_OVERHEAD_32;
+ FILESUMMARYLN_OVERHEAD = FILESUMMARYLN_OVERHEAD_32;
+ LONG_LIST_PER_ITEM_OVERHEAD = LONG_LIST_PER_ITEM_OVERHEAD_32;
}
- TREEMAP_ENTRY_OVERHEAD = TREEMAP_ENTRY_OVERHEAD_32;
- LN_OVERHEAD = LN_OVERHEAD_32;
- DUPCOUNTLN_OVERHEAD = DUPCOUNTLN_OVERHEAD_32;
- BIN_FIXED_OVERHEAD = BIN_FIXED_OVERHEAD_32;
- DIN_FIXED_OVERHEAD = DIN_FIXED_OVERHEAD_32;
- DBIN_FIXED_OVERHEAD = DBIN_FIXED_OVERHEAD_32;
- IN_FIXED_OVERHEAD = IN_FIXED_OVERHEAD_32;
- TXN_OVERHEAD = TXN_OVERHEAD_32;
- CHECKPOINT_REFERENCE_SIZE = CHECKPOINT_REFERENCE_SIZE_32;
- KEY_OVERHEAD = KEY_OVERHEAD_32;
- LOCKIMPL_OVERHEAD = LOCKIMPL_OVERHEAD_32;
- THINLOCKIMPL_OVERHEAD = THINLOCKIMPL_OVERHEAD_32;
- LOCKINFO_OVERHEAD = LOCKINFO_OVERHEAD_32;
- WRITE_LOCKINFO_OVERHEAD = WRITE_LOCKINFO_OVERHEAD_32;
- UTILIZATION_PROFILE_ENTRY = UTILIZATION_PROFILE_ENTRY_32;
- DBFILESUMMARY_OVERHEAD = DBFILESUMMARY_OVERHEAD_32;
- TFS_LIST_INITIAL_OVERHEAD = TFS_LIST_INITIAL_OVERHEAD_32;
- TFS_LIST_SEGMENT_OVERHEAD = TFS_LIST_SEGMENT_OVERHEAD_32;
- LN_INFO_OVERHEAD = LN_INFO_OVERHEAD_32;
- FILESUMMARYLN_OVERHEAD = FILESUMMARYLN_OVERHEAD_32;
- LONG_LIST_PER_ITEM_OVERHEAD = LONG_LIST_PER_ITEM_OVERHEAD_32;
}
}
@@ -390,7 +458,7 @@
public final static long MIN_MAX_MEMORY_SIZE = 96 * 1024;
public final static String MIN_MAX_MEMORY_SIZE_STRING =
Long.toString(MIN_MAX_MEMORY_SIZE);
-
+
/* This value prevents cache churn for apps with a high write rate. */
@SuppressWarnings("unused")
private final static int DEFAULT_MIN_BTREE_CACHE_SIZE = 500 * 1024;
@@ -440,7 +508,7 @@
* Amount of memory cached for locks. Protected by the
* LockManager.lockTableLatches[lockTableIndex].
*/
- private long[] lockMemoryUsage;
+ private AtomicLong[] lockMemoryUsage;
/*
* Memory available to JE, based on je.maxMemory and the memory available
@@ -453,11 +521,11 @@
/* Maximum allowed use of the admin budget by the UtilizationTracker. */
private long trackerBudget;
-
+
/* Mininum to prevent cache churn. */
private long minTreeMemoryUsage;
-
- /*
+
+ /*
* Overheads that are a function of node capacity.
*/
private long inOverhead;
@@ -631,7 +699,7 @@
* reduce the log buffer budget again.
*/
long newLogBufferBudget =
- configManager.getLong(EnvironmentParams.LOG_MEM_SIZE);
+ configManager.getLong(EnvironmentParams.LOG_MEM_SIZE);
if (newLogBufferBudget == 0) {
if (EnvironmentImpl.IS_DALVIK) {
/* If Dalvik JVM, use 1/128th instead of 1/16th of cache. */
@@ -674,9 +742,9 @@
long newMinTreeMemoryUsage = Math.min
(configManager.getLong(EnvironmentParams.MIN_TREE_MEMORY),
- myCachePortion - newLogBufferBudget);
+ myCachePortion - newLogBufferBudget);
- /*
+ /*
* If all has gone well, update the budget fields. Once the log buffer
* budget is determined, the remainder of the memory is left for tree
* nodes.
@@ -687,7 +755,10 @@
if (lockMemoryUsage == null) {
nLockTables =
configManager.getInt(EnvironmentParams.N_LOCK_TABLES);
- lockMemoryUsage = new long[nLockTables];
+ lockMemoryUsage = new AtomicLong[nLockTables];
+ for (int i = 0; i < nLockTables; i++) {
+ lockMemoryUsage[i] = new AtomicLong(0);
+ }
}
minTreeMemoryUsage = newMinTreeMemoryUsage;
@@ -728,7 +799,7 @@
* and txns yet, and the items in the admin category are cleaner items and
* aren't affected by the recovery splicing process.
*/
- void initCacheMemoryUsage(long dbTreeAdminMemory)
+ void initCacheMemoryUsage(long dbTreeAdminMemory)
throws DatabaseException {
long totalTree = 0;
@@ -816,17 +887,17 @@
* @param increment note that increment may be negative.
*/
public void updateTreeAdminMemoryUsage(long increment) {
- updateCounter(increment, treeAdminMemoryUsage, "treeAdmin",
- DEBUG_TREEADMIN);
+ updateCounter(increment, treeAdminMemoryUsage, "treeAdmin",
+ DEBUG_TREEADMIN);
}
- private void updateCounter(long increment,
+ private void updateCounter(long increment,
AtomicLong counter,
String debugName,
boolean debug) {
if (increment != 0) {
long newSize = counter.addAndGet(increment);
-
+
assert (sizeNotNegative(newSize)) :
makeErrorMessage(debugName, newSize, increment);
@@ -857,22 +928,22 @@
public void updateLockMemoryUsage(long increment, int lockTableIndex) {
if (increment != 0) {
- lockMemoryUsage[lockTableIndex] += increment;
+ lockMemoryUsage[lockTableIndex].addAndGet(increment);
- assert lockMemoryUsage[lockTableIndex] >= 0:
+ assert lockMemoryUsage[lockTableIndex].get() >= 0:
makeErrorMessage("lockMem",
- lockMemoryUsage[lockTableIndex],
- increment);
+ lockMemoryUsage[lockTableIndex].get(),
+ increment);
if (DEBUG_LOCK) {
if (increment > 0) {
System.err.println("INC-------- =" + increment +
- " lock[" +
- lockTableIndex + "] " +
- lockMemoryUsage[lockTableIndex]);
+ " lock[" +
+ lockTableIndex + "] " +
+ lockMemoryUsage[lockTableIndex].get());
} else {
System.err.println("-------DEC=" + increment +
- " lock[" + lockTableIndex + "] " +
- lockMemoryUsage[lockTableIndex]);
+ " lock[" + lockTableIndex + "] " +
+ lockMemoryUsage[lockTableIndex].get());
}
}
@@ -915,10 +986,10 @@
public long getLockMemoryUsage() {
long accLockMemoryUsage = txnMemoryUsage.get();
if (nLockTables == 1) {
- accLockMemoryUsage += lockMemoryUsage[0];
+ accLockMemoryUsage += lockMemoryUsage[0].get();
} else {
for (int i = 0; i < nLockTables; i++) {
- accLockMemoryUsage += lockMemoryUsage[i];
+ accLockMemoryUsage += lockMemoryUsage[i].get();
}
}
@@ -950,7 +1021,7 @@
public long getAdminMemoryUsage() {
return adminMemoryUsage.get();
}
-
+
/*
* For unit testing
*/
@@ -1027,7 +1098,7 @@
stats.setLockBytes(getLockMemoryUsage());
}
- @Override
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("treeUsage = ").append(treeMemoryUsage.get());
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/NodeSequence.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/NodeSequence.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/NodeSequence.java 2008-05-06 18:01:32.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/NodeSequence.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,134 +1,134 @@
-/*-
- * See the file LICENSE for redistribution information.
- *
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
- *
- * $Id: NodeSequence.java,v 1.1 2008/05/06 18:01:32 linda Exp $
- */
-
-package com.sleepycat.je.dbi;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * NodeSequence encapsulates the generation and maintenance of a sequence for
- * generating node ids.
- */
-public class NodeSequence {
-
- /*
- * Node Ids: We need to ensure that local and replicated nodes use
- * different number spaces for their ids, so there can't be any possible
- * conflicts. Local, non replicated nodes use positive values, replicated
- * nodes use negative values. On top of that, there is the notion of
- * transient node ids, which are used for cases like the eof node used for
- * Serializable isolation and the lock used for api lockout. Transient node
- * ids are used to provide unique locks, and are only used during the life
- * of an environment, for non-persistent objects. We use the descending
- * sequence of positive values, starting from Long.MAX_VALUE.
- *
- * The transient node sequence must be initialized before the DbTree
- * uber-tree is created, because they are used at DatabaseImpl
- * construction. The local and replicated node id sequences are
- * initialized by the first pass of recovery, after the log has been
- * scanned for the latest used node id.
- */
- private AtomicLong lastAllocatedLocalNodeId = null;
- private AtomicLong lastAllocatedReplicatedNodeId = null;
- private AtomicLong lastAllocatedTransientNodeId = null;
-
- /**
- * Initialize the counters in these methods rather than a constructor
- * so we can control the initialization more precisely.
- */
- void initTransientNodeId() {
- lastAllocatedTransientNodeId = new AtomicLong(Long.MAX_VALUE);
- }
-
- /**
- * Initialize the counters in these methods rather than a constructor
- * so we can control the initialization more precisely.
- */
- void initRealNodeId() {
- lastAllocatedLocalNodeId = new AtomicLong(0);
- lastAllocatedReplicatedNodeId = new AtomicLong(0);
- }
-
- /**
- * The last allocated local and replicated node ids are used for ckpts.
- */
- public long getLastLocalNodeId() {
- return lastAllocatedLocalNodeId.get();
- }
-
- public long getLastReplicatedNodeId() {
- return lastAllocatedReplicatedNodeId.get();
- }
-
- /**
- * We get a new node id of the appropriate kind when creating a new node.
- */
- public long getNextLocalNodeId() {
- return lastAllocatedLocalNodeId.incrementAndGet();
- }
-
- public long getNextReplicatedNodeId() {
- return lastAllocatedReplicatedNodeId.decrementAndGet();
- }
-
- public long getNextTransientNodeId() {
- /* Assert that the two sequences haven't overlapped. */
- assert (noOverlap()) : "transient=" +
- lastAllocatedTransientNodeId.get();
- return lastAllocatedTransientNodeId.decrementAndGet();
- }
-
- private boolean noOverlap() {
- if (lastAllocatedLocalNodeId != null) {
- return (lastAllocatedTransientNodeId.get() - 1) >
- lastAllocatedLocalNodeId.get();
- } else {
- return true;
- }
- }
-
- /**
- * Initialize the node ids, from recovery. No need to initialize
- * the transient node ids, since those can be reused each time the
- * environment is recreated.
- */
- public void setLastNodeId(long lastReplicatedNodeId,
- long lastLocalNodeId) {
- lastAllocatedReplicatedNodeId.set(lastReplicatedNodeId);
- lastAllocatedLocalNodeId.set(lastLocalNodeId);
- }
-
- /*
- * Only set the replicated node id if the replayNodeId represents a
- * newer, later value in the replication stream. If the replayNodeId is
- * earlier than this node's lastAllocatedReplicateNodeId, don't bother
- * updating the sequence;
- */
- public void updateFromReplay(long replayNodeId) {
-
- assert replayNodeId < 0 :
- "replay node id is unexpectedly positive " + replayNodeId;
-
- while (true) {
- long currentVal = lastAllocatedReplicatedNodeId.get();
- if (replayNodeId < currentVal) {
- /*
- * This replayNodeId is newer than any other replicatedNodeId
- * known by this node.
- */
- boolean ok = lastAllocatedReplicatedNodeId.weakCompareAndSet
- (currentVal, replayNodeId);
- if (ok) {
- break;
- }
- } else {
- break;
- }
- }
- }
-}
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
+ *
+ * $Id: NodeSequence.java,v 1.1.2.2 2010/01/04 15:30:28 cwl Exp $
+ */
+
+package com.sleepycat.je.dbi;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * NodeSequence encapsulates the generation and maintenance of a sequence for
+ * generating node ids.
+ */
+public class NodeSequence {
+
+ /*
+ * Node Ids: We need to ensure that local and replicated nodes use
+ * different number spaces for their ids, so there can't be any possible
+ * conflicts. Local, non replicated nodes use positive values, replicated
+ * nodes use negative values. On top of that, there is the notion of
+ * transient node ids, which are used for cases like the eof node used for
+ * Serializable isolation and the lock used for api lockout. Transient node
+ * ids are used to provide unique locks, and are only used during the life
+ * of an environment, for non-persistent objects. We use the descending
+ * sequence of positive values, starting from Long.MAX_VALUE.
+ *
+ * The transient node sequence must be initialized before the DbTree
+ * uber-tree is created, because they are used at DatabaseImpl
+ * construction. The local and replicated node id sequences are
+ * initialized by the first pass of recovery, after the log has been
+ * scanned for the latest used node id.
+ */
+ private AtomicLong lastAllocatedLocalNodeId = null;
+ private AtomicLong lastAllocatedReplicatedNodeId = null;
+ private AtomicLong lastAllocatedTransientNodeId = null;
+
+ /**
+ * Initialize the counters in these methods rather than a constructor
+ * so we can control the initialization more precisely.
+ */
+ void initTransientNodeId() {
+ lastAllocatedTransientNodeId = new AtomicLong(Long.MAX_VALUE);
+ }
+
+ /**
+ * Initialize the counters in these methods rather than a constructor
+ * so we can control the initialization more precisely.
+ */
+ void initRealNodeId() {
+ lastAllocatedLocalNodeId = new AtomicLong(0);
+ lastAllocatedReplicatedNodeId = new AtomicLong(0);
+ }
+
+ /**
+ * The last allocated local and replicated node ids are used for ckpts.
+ */
+ public long getLastLocalNodeId() {
+ return lastAllocatedLocalNodeId.get();
+ }
+
+ public long getLastReplicatedNodeId() {
+ return lastAllocatedReplicatedNodeId.get();
+ }
+
+ /**
+ * We get a new node id of the appropriate kind when creating a new node.
+ */
+ public long getNextLocalNodeId() {
+ return lastAllocatedLocalNodeId.incrementAndGet();
+ }
+
+ public long getNextReplicatedNodeId() {
+ return lastAllocatedReplicatedNodeId.decrementAndGet();
+ }
+
+ public long getNextTransientNodeId() {
+ /* Assert that the two sequences haven't overlapped. */
+ assert (noOverlap()) : "transient=" +
+ lastAllocatedTransientNodeId.get();
+ return lastAllocatedTransientNodeId.decrementAndGet();
+ }
+
+ private boolean noOverlap() {
+ if (lastAllocatedLocalNodeId != null) {
+ return (lastAllocatedTransientNodeId.get() - 1) >
+ lastAllocatedLocalNodeId.get();
+ } else {
+ return true;
+ }
+ }
+
+ /**
+ * Initialize the node ids, from recovery. No need to initialize
+ * the transient node ids, since those can be reused each time the
+ * environment is recreated.
+ */
+ public void setLastNodeId(long lastReplicatedNodeId,
+ long lastLocalNodeId) {
+ lastAllocatedReplicatedNodeId.set(lastReplicatedNodeId);
+ lastAllocatedLocalNodeId.set(lastLocalNodeId);
+ }
+
+ /*
+ * Only set the replicated node id if the replayNodeId represents a
+ * newer, later value in the replication stream. If the replayNodeId is
+ * earlier than this node's lastAllocatedReplicateNodeId, don't bother
+ * updating the sequence;
+ */
+ public void updateFromReplay(long replayNodeId) {
+
+ assert replayNodeId < 0 :
+ "replay node id is unexpectedly positive " + replayNodeId;
+
+ while (true) {
+ long currentVal = lastAllocatedReplicatedNodeId.get();
+ if (replayNodeId < currentVal) {
+ /*
+ * This replayNodeId is newer than any other replicatedNodeId
+ * known by this node.
+ */
+ boolean ok = lastAllocatedReplicatedNodeId.weakCompareAndSet
+ (currentVal, replayNodeId);
+ if (ok) {
+ break;
+ }
+ } else {
+ break;
+ }
+ }
+ }
+}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/Operation.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/Operation.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/Operation.java 2008-01-07 14:28:48.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/Operation.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Operation.java,v 1.9 2008/01/07 14:28:48 cwl Exp $
+ * $Id: Operation.java,v 1.10.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.dbi;
@@ -64,6 +64,7 @@
}
}
+ @Override
public String toString() {
return name;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/PutMode.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/PutMode.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/PutMode.java 2008-01-07 14:28:48.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/PutMode.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PutMode.java,v 1.9 2008/01/07 14:28:48 cwl Exp $
+ * $Id: PutMode.java,v 1.9.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.dbi;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/RangeRestartException.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/RangeRestartException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/RangeRestartException.java 2008-05-06 18:01:32.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/RangeRestartException.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: RangeRestartException.java,v 1.8 2008/05/06 18:01:32 linda Exp $
+ * $Id: RangeRestartException.java,v 1.8.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.dbi;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/ReplicatedDatabaseConfig.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/ReplicatedDatabaseConfig.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/ReplicatedDatabaseConfig.java 2008-05-19 17:52:18.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/ReplicatedDatabaseConfig.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ReplicatedDatabaseConfig.java,v 1.8 2008/05/19 17:52:17 linda Exp $
+ * $Id: ReplicatedDatabaseConfig.java,v 1.8.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.dbi;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/ReplicatorInstance.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/ReplicatorInstance.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/ReplicatorInstance.java 2008-05-13 20:03:12.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/ReplicatorInstance.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ReplicatorInstance.java,v 1.21 2008/05/13 20:03:11 sam Exp $
+ * $Id: ReplicatorInstance.java,v 1.21.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.dbi;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/SortedLSNTreeWalker.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/SortedLSNTreeWalker.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/SortedLSNTreeWalker.java 2008-05-13 17:09:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/SortedLSNTreeWalker.java 2010-03-23 15:02:08.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SortedLSNTreeWalker.java,v 1.37 2008/05/13 17:09:00 mark Exp $
+ * $Id: SortedLSNTreeWalker.java,v 1.37.2.4 2010/03/23 15:02:07 cwl Exp $
*/
package com.sleepycat.je.dbi;
@@ -219,8 +219,11 @@
root = getRootIN(rootLsn);
}
if (root != null) {
- accumulateLSNs(root);
- releaseRootIN(root);
+ try {
+ accumulateLSNs(root);
+ } finally {
+ releaseRootIN(root);
+ }
}
if (setDbState) {
@@ -231,7 +234,6 @@
maybeGetMoreINs();
if (currentLSNs != null &&
currentLSNIdx < currentLSNs.length) {
- didSomeMore = true;
fetchAndProcessLSN(currentLSNs[currentLSNIdx++]);
} else {
break;
@@ -239,8 +241,6 @@
}
}
- public boolean didSomeMore = false;
-
private void maybeGetMoreINs() {
if ((currentLSNs != null &&
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/TruncateResult.java libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/TruncateResult.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/dbi/TruncateResult.java 2008-01-07 14:28:48.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/dbi/TruncateResult.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: TruncateResult.java,v 1.7 2008/01/07 14:28:48 cwl Exp $
+ * $Id: TruncateResult.java,v 1.7.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.dbi;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/DbInternal.java libdb-je-java-3.3.98/src/com/sleepycat/je/DbInternal.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/DbInternal.java 2008-03-18 16:53:04.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/DbInternal.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbInternal.java,v 1.56 2008/03/18 15:53:04 mark Exp $
+ * $Id: DbInternal.java,v 1.57.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -16,6 +16,7 @@
import com.sleepycat.je.dbi.EnvironmentImpl;
import com.sleepycat.je.dbi.GetMode;
import com.sleepycat.je.txn.Locker;
+import com.sleepycat.je.txn.Txn;
/**
* @hidden
@@ -311,4 +312,8 @@
return new Environment(envHome, config, replicationIntended);
}
+
+ public static Txn getTxn(Transaction transaction) {
+ return transaction.getTxn();
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/DeadlockException.java libdb-je-java-3.3.98/src/com/sleepycat/je/DeadlockException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/DeadlockException.java 2008-02-27 15:03:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/DeadlockException.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DeadlockException.java,v 1.18 2008/02/27 15:03:51 mark Exp $
+ * $Id: DeadlockException.java,v 1.18.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/Durability.java libdb-je-java-3.3.98/src/com/sleepycat/je/Durability.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/Durability.java 2008-05-13 20:03:10.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/Durability.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,14 +1,13 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Durability.java,v 1.1 2008/05/13 20:03:09 sam Exp $
+ * $Id: Durability.java,v 1.5.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
-
/**
* @hidden
*
@@ -16,8 +15,8 @@
* transaction. When operating on a local environment the durability of a
* transaction is completely determined by the local SyncPolicy that is in
* effect. In a replicated environment, the overall durability is additionally
- * a function of the ReplicaAclPolicy used by the master and the SyncPolicy
- * in effect at each Replica.
+ * a function of the ReplicaAclPolicy used by the master and the SyncPolicy in
+ * effect at each Replica.
*/
public class Durability {
@@ -40,12 +39,12 @@
* Do not write or synchronously flush the log on transaction commit.
* Transactions exhibit the ACI (atomicity, consistency, and isolation)
* properties, but not D (durability); that is, database integrity will
- * be maintained, but if the application or system fails, it is possible
- * some number of the most recently committed transactions may be undone
- * during recovery. The number of transactions at risk is governed by
- * how many log updates can fit into the log buffer, how often the
- * operating system flushes dirty buffers to disk, and how often the log
- * is checkpointed.
+ * be maintained, but if the application or system fails, it is
+ * possible some number of the most recently committed transactions may
+ * be undone during recovery. The number of transactions at risk is
+ * governed by how many log updates can fit into the log buffer, how
+ * often the operating system flushes dirty buffers to disk, and how
+ * often the log is checkpointed.
*/
NO_SYNC,
@@ -53,44 +52,44 @@
* Write but do not synchronously flush the log on transaction commit.
* Transactions exhibit the ACI (atomicity, consistency, and isolation)
* properties, but not D (durability); that is, database integrity will
- * be maintained, but if the operating system fails, it is possible some
- * number of the most recently committed transactions may be undone
- * during recovery. The number of transactions at risk is governed by
- * how often the operating system flushes dirty buffers to disk, and how
- * often the log is checkpointed.
+ * be maintained, but if the operating system fails, it is possible
+ * some number of the most recently committed transactions may be
+ * undone during recovery. The number of transactions at risk is
+ * governed by how often the operating system flushes dirty buffers to
+ * disk, and how often the log is checkpointed.
*/
WRITE_NO_SYNC
};
/**
- * A replicated environment makes it possible to increase an application's
- * transaction commit guarantees by committing changes to its replicas on the
- * network. ReplicaAckPolicy defines the policy for how such network
- * commits are handled.
- *
- * The choice of a ReplicaAckPolicy must be consistent across all the
- * replicas in a replication group, to ensure that the policy is consistently
- * enforced in the event of an election.
- */
- public enum ReplicaAckPolicy {
+ * A replicated environment makes it possible to increase an application's
+ * transaction commit guarantees by committing changes to its replicas on
+ * the network. ReplicaAckPolicy defines the policy for how such network
+ * commits are handled.
+ *
+ * The choice of a ReplicaAckPolicy must be consistent across all the
+ * replicas in a replication group, to ensure that the policy is
+ * consistently enforced in the event of an election.
+ */
+ public enum ReplicaAckPolicy {
- /**
+ /**
* All replicas must acknowledge that they have committed the
* transaction. This policy should be selected only if your replication
* group has a small number of replicas, and those replicas are on
* extremely reliable networks and servers.
*/
- ALL,
+ ALL,
- /**
- * No transaction commit acknowledgments are required and the master will
- * never wait for replica acknowledgments. In this case, transaction
- * durability is determined entirely by the type of commit that is being
- * performed on the master.
- */
- NONE,
+ /**
+ * No transaction commit acknowledgments are required and the master
+ * will never wait for replica acknowledgments. In this case,
+ * transaction durability is determined entirely by the type of commit
+ * that is being performed on the master.
+ */
+ NONE,
- /**
+ /**
* A quorum of replicas must acknowledge that they have committed the
* transaction. A quorum is reached when acknowledgments are received
* from the minimum number of environments needed to ensure that the
@@ -101,34 +100,36 @@
*
* This is the default.
*/
- QUORUM;
+ QUORUM;
- /**
- * Returns the minimum number of replication nodes required to implement
- * the ReplicaAckPolicy for a given group size.
+ /**
+ * Returns the minimum number of replication nodes required to
+ * implement the ReplicaAckPolicy for a given group size.
*
* @param groupSize the size of the replication group.
*
* @return the number of nodes that are needed
*/
- public int requiredNodes(int groupSize) {
- switch (this) {
- case ALL:
- return groupSize;
- case NONE:
- return 1;
- case QUORUM:
- return (groupSize <= 2) ? 1 : (groupSize/2+1);
- }
- assert false : "unreachable";
- return Integer.MAX_VALUE;
- }
- }
+ public int requiredNodes(int groupSize) {
+ switch (this) {
+ case ALL:
+ return groupSize;
+ case NONE:
+ return 1;
+ case QUORUM:
+ return (groupSize <= 2) ? 1 : (groupSize / 2 + 1);
+ }
+ assert false : "unreachable";
+ return Integer.MAX_VALUE;
+ }
+ }
/* The sync policy in effect on the local node. */
final private SyncPolicy localSync;
+
/* The sync policy in effect on a replica. */
final private SyncPolicy replicaSync;
+
/* The replica acknowledgment policy to be used. */
final private ReplicaAckPolicy replicaAck;
@@ -173,6 +174,4 @@
public ReplicaAckPolicy getReplicaAck() {
return replicaAck;
}
-
-
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/EnvironmentConfig.java libdb-je-java-3.3.98/src/com/sleepycat/je/EnvironmentConfig.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/EnvironmentConfig.java 2008-06-02 16:31:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/EnvironmentConfig.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EnvironmentConfig.java,v 1.50 2008/06/02 16:31:43 linda Exp $
+ * $Id: EnvironmentConfig.java,v 1.52.2.4 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -710,6 +710,8 @@
*
false
*
*
+ * @deprecated NIO is no longer used by JE and this parameter has no
+ * effect.
*/
public static final String LOG_USE_NIO = "je.log.useNIO";
@@ -726,6 +728,8 @@
*
false
*
*
+ * @deprecated NIO is no longer used by JE and this parameter has no
+ * effect.
*/
public static final String LOG_DIRECT_NIO = "je.log.directNIO";
@@ -745,6 +749,8 @@
*
67108864 (64M)
*
*
+ * @deprecated NIO is no longer used by JE and this parameter has no
+ * effect.
*/
public static final String LOG_CHUNKED_NIO = "je.log.chunkedNIO";
@@ -907,8 +913,8 @@
"je.compressor.lockTimeout";
/**
- * If true, when the compressor encounters an empty tree, the root node of
- * the tree is deleted.
+ * If true, when the compressor encounters an empty database, the root node
+ * of the Btree is deleted.
*
*
*
Name
Type
Mutable
Default
@@ -919,6 +925,10 @@
*
false
*
*
+ *
+ * @deprecated as of 3.3.87. Compression of the root node no longer has
+ * any benefit and this feature has been removed. This parameter has no
+ * effect.
*/
public static final String COMPRESSOR_PURGE_ROOT =
"je.compressor.purgeRoot";
@@ -1762,7 +1772,7 @@
* @param timeout The lock timeout, in microseconds. A value of 0 turns off
* lock timeouts.
*
- * @throws IllegalArgumentException If the value of timeout is negative
+ * @throws IllegalArgumentException If the value of timeout is negative
* @see Transaction#setLockTimeout
*/
public void setLockTimeout(long timeout)
@@ -1901,7 +1911,7 @@
* @param timeout The transaction timeout, in microseconds. A value of 0
* turns off transaction timeouts.
*
- * @throws IllegalArgumentException If the value of timeout is negative
+ * @throws IllegalArgumentException If the value of timeout is negative
*
* @see Transaction#setTxnTimeout
*/
@@ -2026,6 +2036,7 @@
}
/* Documentation inherited from EnvironmentMutableConfig.setConfigParam. */
+ @Override
public void setConfigParam(String paramName,
String value)
throws IllegalArgumentException {
@@ -2082,6 +2093,7 @@
/**
* Display configuration values.
*/
+ @Override
public String toString() {
return ("allowCreate=" + allowCreate + "\n" + super.toString());
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/Environment.java libdb-je-java-3.3.98/src/com/sleepycat/je/Environment.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/Environment.java 2008-05-30 19:07:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/Environment.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Environment.java,v 1.217 2008/05/30 19:07:40 mark Exp $
+ * $Id: Environment.java,v 1.217.2.4 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -139,9 +139,13 @@
* @throws IllegalArgumentException if an invalid parameter was specified.
*
* @throws DatabaseException if a failure occurs.
+ *
+ * @throws EnvironmentLockedException when an environment cannot be opened
+ * for write access because another process has the same environment open
+ * for write access.
*/
public Environment(File envHome, EnvironmentConfig configuration)
- throws DatabaseException {
+ throws DatabaseException, EnvironmentLockedException {
this(envHome, configuration, true /*openIfNeeded*/,
false /*replicationIntended*/);
@@ -1551,6 +1555,8 @@
}
/**
+ * For internal use only.
+ * @hidden
* Scans raw log entries in the JE log between two given points, passing
* all records for a given set of databases to the scanRecord method of the
* given LogScanner object.
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/EnvironmentLockedException.java libdb-je-java-3.3.98/src/com/sleepycat/je/EnvironmentLockedException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/EnvironmentLockedException.java 1970-01-01 00:00:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/EnvironmentLockedException.java 2010-01-04 15:30:28.000000000 +0000
@@ -0,0 +1,35 @@
+/*
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
+ *
+ * $Id: EnvironmentLockedException.java,v 1.1.2.3 2010/01/04 15:30:27 cwl Exp $
+ */
+
+package com.sleepycat.je;
+
+/**
+ * Thrown by the Environment constructor when an environment cannot be
+ * opened for write access because another process has the same environment
+ * open for write access.
+ */
+public class EnvironmentLockedException extends DatabaseException {
+
+ private static final long serialVersionUID = 629594964L;
+
+ public EnvironmentLockedException() {
+ super();
+ }
+
+ public EnvironmentLockedException(Throwable t) {
+ super(t);
+ }
+
+ public EnvironmentLockedException(String message) {
+ super(message);
+ }
+
+ public EnvironmentLockedException(String message, Throwable t) {
+ super(message, t);
+ }
+}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/EnvironmentMutableConfig.java libdb-je-java-3.3.98/src/com/sleepycat/je/EnvironmentMutableConfig.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/EnvironmentMutableConfig.java 2008-05-19 17:52:16.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/EnvironmentMutableConfig.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EnvironmentMutableConfig.java,v 1.41 2008/05/19 17:52:16 linda Exp $
+ * $Id: EnvironmentMutableConfig.java,v 1.44.2.3 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -295,9 +295,6 @@
* calling setCacheSize() with a non-zero value overrides the percentage
* based calculation and sets the cache size explicitly.
*
- *
Note that the cache does not include transient objects created by the
- * JE library, such as cursors, locks and transactions.
- *
*
Note that the log buffer cache may be cleared if the cache size is
* changed after the environment has been opened.
*
@@ -497,6 +494,7 @@
* Overrides Object.clone() to clone all properties, used by this class and
* EnvironmentConfig.
*/
+ @Override
protected Object clone()
throws CloneNotSupportedException {
@@ -534,8 +532,11 @@
/**
* Copies all mutable props to the given config object.
+ * Unchecked suppress here because Properties don't play well with
+ * generics in Java 1.5
*/
- void copyMutablePropsTo(EnvironmentMutableConfig toConfig) {
+ @SuppressWarnings("unchecked")
+ void copyMutablePropsTo(EnvironmentMutableConfig toConfig) {
Properties toProps = toConfig.props;
Enumeration propNames = props.propertyNames();
@@ -560,9 +561,12 @@
cacheSize = envImpl.getMemoryBudget().getMaxMemory();
}
- /**
- * Removes all immutable props.
- */
+ /**
+ * Removes all immutable props.
+ * Unchecked suppress here because Properties don't play well with
+ * generics in Java 1.5
+ */
+ @SuppressWarnings("unchecked")
private void clearImmutableProps() {
Enumeration propNames = props.propertyNames();
while (propNames.hasMoreElements()) {
@@ -604,10 +608,11 @@
/**
* Display configuration values.
*/
+ @Override
public String toString() {
return ("cacheSize=" + cacheSize + "\n" +
"txnNoSync=" + txnNoSync + "\n" +
"txnWriteNoSync=" + txnWriteNoSync + "\n" +
- props.toString());
+ props.toString() + "\n");
}
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/EnvironmentStats.java libdb-je-java-3.3.98/src/com/sleepycat/je/EnvironmentStats.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/EnvironmentStats.java 2008-05-07 17:12:26.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/EnvironmentStats.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EnvironmentStats.java,v 1.57 2008/05/07 17:12:25 mark Exp $
+ * $Id: EnvironmentStats.java,v 1.58.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -1542,6 +1542,7 @@
* Returns a String representation of the stats in the form of
* <stat>=<value>
*/
+ @Override
public String toString() {
DecimalFormat f = new DecimalFormat("###,###,###,###,###,###,###");
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/evictor/Evictor.java libdb-je-java-3.3.98/src/com/sleepycat/je/evictor/Evictor.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/evictor/Evictor.java 2008-05-20 03:27:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/evictor/Evictor.java 2010-01-30 01:10:56.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Evictor.java,v 1.114 2008/05/20 03:27:35 linda Exp $
+ * $Id: Evictor.java,v 1.115.2.6 2010/01/30 01:10:55 mark Exp $
*/
package com.sleepycat.je.evictor;
@@ -41,6 +41,7 @@
import com.sleepycat.je.utilint.DbLsn;
import com.sleepycat.je.utilint.TestHook;
import com.sleepycat.je.utilint.Tracer;
+import com.sleepycat.je.utilint.TestHookExecute;
/**
* The Evictor looks through the INList for IN's and BIN's that are worthy of
@@ -117,6 +118,7 @@
/* Debugging and unit test support. */
EvictProfile evictProfile;
private TestHook runnableHook;
+ private TestHook preEvictINHook;
Evictor(EnvironmentImpl envImpl, String name)
throws DatabaseException {
@@ -172,6 +174,7 @@
/**
* Return the number of retries when a deadlock exception occurs.
*/
+ @Override
protected long nDeadlockRetries()
throws DatabaseException {
@@ -514,13 +517,10 @@
}
/*
- * If this is a read only database and we have at least one
- * target, skip any dirty INs (recovery dirties INs even in a
- * read-only environment). We take at least one target so we
- * don't loop endlessly if everything is dirty.
+ * If this is a read-only environment, skip any dirty INs (recovery
+ * dirties INs even in a read-only environment).
*/
if (db.getDbEnvironment().isReadOnly() &&
- target != null &&
in.getDirty()) {
continue;
}
@@ -648,12 +648,14 @@
rootIN.latch(CacheMode.UNCHANGED);
try {
/* Re-check that all conditions still hold. */
+ boolean isDirty = rootIN.getDirty();
if (rootIN == target &&
rootIN.isDbRoot() &&
- rootIN.isEvictable()) {
+ rootIN.isEvictable() &&
+ !(envImpl.isReadOnly() && isDirty)) {
/* Flush if dirty. */
- if (!envImpl.isReadOnly() && rootIN.getDirty()) {
+ if (isDirty) {
long newLsn = rootIN.log
(envImpl.getLogManager(),
false, // allowDeltas
@@ -774,6 +776,14 @@
/* Regular eviction. */
Tree tree = db.getTree();
+ /*
+ * Unit testing. The target is latched and we are about to
+ * release that latch and search for the parent. Make sure
+ * that other operations, such as dirtying an LN in the
+ * target BIN, can occur safely in this window. [#18227]
+ */
+ assert TestHookExecute.doHookIfSet(preEvictINHook);
+
/* getParentINForChildIN unlatches target. */
targetIsLatched = false;
SearchResult result =
@@ -806,8 +816,7 @@
}
/**
- * Evict an IN. Dirty nodes are logged before they're evicted. inlist is
- * latched with the major latch by the caller.
+ * Evict an IN. Dirty nodes are logged before they're evicted.
*/
private long evictIN(IN child, IN parent, int index, boolean backgroundIO)
throws DatabaseException {
@@ -827,7 +836,7 @@
/*
* See the evictIN() method in this class for an explanation for
- * calling latchNoWait(false).
+ * calling latchNoWait().
*/
if ((renewedChild != null) &&
(renewedChild.getGeneration() <= oldGenerationCount) &&
@@ -946,6 +955,11 @@
runnableHook = hook;
}
+ /* For unit testing only. */
+ public void setPreEvictINHook(TestHook hook) {
+ preEvictINHook = hook;
+ }
+
/**
* Standard daemon method to set envImpl to null.
*/
@@ -969,7 +983,7 @@
/**
* Only supported by SharedEvictor.
*/
- public abstract boolean checkEnvs(Set envs);
+ public abstract boolean checkEnvs(Set envs);
abstract Logger getLogger();
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/evictor/package.html libdb-je-java-3.3.98/src/com/sleepycat/je/evictor/package.html
--- libdb-je-java-3.3.62/src/com/sleepycat/je/evictor/package.html 2008-01-24 14:59:30.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/evictor/package.html 2010-01-04 15:30:28.000000000 +0000
@@ -5,10 +5,10 @@
See the file LICENSE for redistribution information.
- Copyright (c) 2002,2008 Oracle. All rights reserved.
+ Copyright (c) 2002,2010 Oracle. All rights reserved.
- $Id: package.html,v 1.9 2008/01/24 14:59:29 linda Exp $
+ $Id: package.html,v 1.9.2.2 2010/01/04 15:30:28 cwl Exp $
-->
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/evictor/PrivateEvictor.java libdb-je-java-3.3.98/src/com/sleepycat/je/evictor/PrivateEvictor.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/evictor/PrivateEvictor.java 2008-01-07 14:28:48.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/evictor/PrivateEvictor.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PrivateEvictor.java,v 1.4 2008/01/07 14:28:48 cwl Exp $
+ * $Id: PrivateEvictor.java,v 1.4.2.2 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.evictor;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/evictor/SharedEvictor.java libdb-je-java-3.3.98/src/com/sleepycat/je/evictor/SharedEvictor.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/evictor/SharedEvictor.java 2008-01-07 14:28:48.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/evictor/SharedEvictor.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SharedEvictor.java,v 1.4 2008/01/07 14:28:48 cwl Exp $
+ * $Id: SharedEvictor.java,v 1.4.2.3 2010/01/04 15:30:28 cwl Exp $
*/
package com.sleepycat.je.evictor;
@@ -221,11 +221,12 @@
* by reinitializing the Subject.remaining fields.
*/
IN getNextIN() {
- int initialIndex = rotationIndex;
int nSubjects = subjects.size();
if (nSubjects == 0) {
- return null; // No environments are sharing the cache
+ /* No environments are sharing the cache. */
+ return null;
}
+ int nSubjectsExamined = 0;
while (true) {
if (rotationIndex >= nSubjects) {
rotationIndex = 0;
@@ -238,13 +239,16 @@
subject.iter = subject.ins.iterator();
}
if (subject.iter.hasNext()) {
- return subject.iter.next(); // Found an IN to return
+ /* Found an IN to return. */
+ return subject.iter.next();
} else {
- subject.remaining = -1; // This INList is empty
+ /* This INList is empty. */
+ subject.remaining = -1;
}
}
- if (rotationIndex == initialIndex) {
- /* All Subject.remaining fields are <= 0. Start a new round. */
+ nSubjectsExamined += 1;
+ if (nSubjectsExamined >= nSubjects) {
+ /* All Subject.remaining fields are <= 0. */
boolean foundAny = false;
for (int i = 0; i < nSubjects; i += 1) {
Subject sub = subjects.get(i);
@@ -256,8 +260,11 @@
}
}
if (!foundAny) {
- return null; // All INLists are empty
+ /* All INLists are empty or not evictable. */
+ return null;
}
+ /* Start a new round. */
+ nSubjectsExamined = 0;
}
}
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/ExceptionEvent.java libdb-je-java-3.3.98/src/com/sleepycat/je/ExceptionEvent.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/ExceptionEvent.java 2008-01-07 14:28:46.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/ExceptionEvent.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ExceptionEvent.java,v 1.9 2008/01/07 14:28:46 cwl Exp $
+ * $Id: ExceptionEvent.java,v 1.10.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -43,6 +43,7 @@
return threadName;
}
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/JEVersion.java libdb-je-java-3.3.98/src/com/sleepycat/je/JEVersion.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/JEVersion.java 2008-06-04 18:46:48.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/JEVersion.java 2010-03-23 15:01:50.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: JEVersion.java,v 1.109 2008/06/04 18:46:47 cwl Exp $
+ * $Id: JEVersion.java,v 1.111.2.33 2010/03/23 15:01:50 cwl Exp $
*/
package com.sleepycat.je;
@@ -21,7 +21,7 @@
* Release version.
*/
public static final JEVersion CURRENT_VERSION =
- new JEVersion(3, 3, 62, null);
+ new JEVersion(3, 3, 98, null);
private int majorNum;
private int minorNum;
@@ -35,6 +35,7 @@
this.name = name;
}
+ @Override
public String toString() {
return getVersionString();
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/jmx/JEMBeanHelper.java libdb-je-java-3.3.98/src/com/sleepycat/je/jmx/JEMBeanHelper.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/jmx/JEMBeanHelper.java 2008-05-19 17:52:18.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/jmx/JEMBeanHelper.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: JEMBeanHelper.java,v 1.16 2008/05/19 17:52:18 linda Exp $
+ * $Id: JEMBeanHelper.java,v 1.16.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.jmx;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/jmx/JEMonitor.java libdb-je-java-3.3.98/src/com/sleepycat/je/jmx/JEMonitor.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/jmx/JEMonitor.java 2008-05-19 17:52:18.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/jmx/JEMonitor.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: JEMonitor.java,v 1.10 2008/05/19 17:52:18 linda Exp $
+ * $Id: JEMonitor.java,v 1.10.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.jmx;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/JoinConfig.java libdb-je-java-3.3.98/src/com/sleepycat/je/JoinConfig.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/JoinConfig.java 2008-01-24 14:59:28.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/JoinConfig.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: JoinConfig.java,v 1.11 2008/01/24 14:59:27 linda Exp $
+ * $Id: JoinConfig.java,v 1.12.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -95,4 +95,15 @@
return null;
}
}
+
+ /**
+ * Returns the values for each configuration attribute.
+ *
+ * @return the values for each configuration attribute.
+ */
+ @Override
+ public String toString() {
+ return "noSort=" + noSort +
+ "\n";
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/JoinCursor.java libdb-je-java-3.3.98/src/com/sleepycat/je/JoinCursor.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/JoinCursor.java 2008-01-07 14:28:46.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/JoinCursor.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: JoinCursor.java,v 1.20 2008/01/07 14:28:46 cwl Exp $
+ * $Id: JoinCursor.java,v 1.20.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/latch/LatchException.java libdb-je-java-3.3.98/src/com/sleepycat/je/latch/LatchException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/latch/LatchException.java 2008-01-07 14:28:50.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/latch/LatchException.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LatchException.java,v 1.20 2008/01/07 14:28:50 cwl Exp $
+ * $Id: LatchException.java,v 1.20.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.latch;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/latch/Latch.java libdb-je-java-3.3.98/src/com/sleepycat/je/latch/Latch.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/latch/Latch.java 2008-05-30 14:04:16.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/latch/Latch.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Latch.java,v 1.91 2008/05/30 14:04:15 mark Exp $
+ * $Id: Latch.java,v 1.92.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.latch;
@@ -26,6 +26,7 @@
super(fair);
}
+ @Override
protected Thread getOwner() {
return super.getOwner();
}
@@ -202,6 +203,7 @@
/**
* Formats a latch owner and waiters.
*/
+ @Override
public String toString() {
return lock.toString();
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/latch/LatchNotHeldException.java libdb-je-java-3.3.98/src/com/sleepycat/je/latch/LatchNotHeldException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/latch/LatchNotHeldException.java 2008-01-07 14:28:50.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/latch/LatchNotHeldException.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LatchNotHeldException.java,v 1.18 2008/01/07 14:28:50 cwl Exp $
+ * $Id: LatchNotHeldException.java,v 1.18.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.latch;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/latch/LatchStats.java libdb-je-java-3.3.98/src/com/sleepycat/je/latch/LatchStats.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/latch/LatchStats.java 2008-01-07 14:28:50.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/latch/LatchStats.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LatchStats.java,v 1.25 2008/01/07 14:28:50 cwl Exp $
+ * $Id: LatchStats.java,v 1.26.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.latch;
@@ -57,6 +57,7 @@
*/
public int nReleases = 0;
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("nAcquiresNoWaiters=").
@@ -76,6 +77,7 @@
return sb.toString();
}
+ @Override
public Object clone()
throws CloneNotSupportedException {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/latch/LatchSupport.java libdb-je-java-3.3.98/src/com/sleepycat/je/latch/LatchSupport.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/latch/LatchSupport.java 2008-05-13 01:44:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/latch/LatchSupport.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LatchSupport.java,v 1.14 2008/05/13 01:44:51 cwl Exp $
+ * $Id: LatchSupport.java,v 1.14.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.latch;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/latch/LatchTable.java libdb-je-java-3.3.98/src/com/sleepycat/je/latch/LatchTable.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/latch/LatchTable.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/latch/LatchTable.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LatchTable.java,v 1.17 2008/05/15 01:52:41 linda Exp $
+ * $Id: LatchTable.java,v 1.17.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.latch;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/latch/package.html libdb-je-java-3.3.98/src/com/sleepycat/je/latch/package.html
--- libdb-je-java-3.3.62/src/com/sleepycat/je/latch/package.html 2008-01-07 14:28:50.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/latch/package.html 2010-01-04 15:30:30.000000000 +0000
@@ -5,10 +5,10 @@
See the file LICENSE for redistribution information.
- Copyright (c) 2002,2008 Oracle. All rights reserved.
+ Copyright (c) 2002,2010 Oracle. All rights reserved.
- $Id: package.html,v 1.10 2008/01/07 14:28:50 cwl Exp $
+ $Id: package.html,v 1.10.2.2 2010/01/04 15:30:29 cwl Exp $
-->
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/latch/SharedLatch.java libdb-je-java-3.3.98/src/com/sleepycat/je/latch/SharedLatch.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/latch/SharedLatch.java 2008-05-20 17:52:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/latch/SharedLatch.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SharedLatch.java,v 1.24 2008/05/20 17:52:35 linda Exp $
+ * $Id: SharedLatch.java,v 1.24.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.latch;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/LockMode.java libdb-je-java-3.3.98/src/com/sleepycat/je/LockMode.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/LockMode.java 2008-04-07 22:28:30.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/LockMode.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LockMode.java,v 1.25 2008/04/07 22:28:29 mark Exp $
+ * $Id: LockMode.java,v 1.25.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/LockNotGrantedException.java libdb-je-java-3.3.98/src/com/sleepycat/je/LockNotGrantedException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/LockNotGrantedException.java 2008-01-07 14:28:46.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/LockNotGrantedException.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LockNotGrantedException.java,v 1.10 2008/01/07 14:28:46 cwl Exp $
+ * $Id: LockNotGrantedException.java,v 1.10.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/LockStats.java libdb-je-java-3.3.98/src/com/sleepycat/je/LockStats.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/LockStats.java 2008-03-19 16:04:04.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/LockStats.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LockStats.java,v 1.30 2008/03/19 15:04:03 mark Exp $
+ * $Id: LockStats.java,v 1.31.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -209,6 +209,7 @@
* For convenience, the LockStats class has a toString method that lists
* all the data fields.
*/
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/CheckpointFileReader.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/CheckpointFileReader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/CheckpointFileReader.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/CheckpointFileReader.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: CheckpointFileReader.java,v 1.31 2008/01/07 14:28:51 cwl Exp $
+ * $Id: CheckpointFileReader.java,v 1.32.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -41,6 +41,7 @@
/**
* @return true if this is a targetted entry.
*/
+ @Override
protected boolean isTargetEntry() {
byte logEntryTypeNumber = currentEntryHeader.getType();
boolean isTarget = false;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/ChecksumValidator.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/ChecksumValidator.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/ChecksumValidator.java 2008-01-17 17:36:20.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/ChecksumValidator.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ChecksumValidator.java,v 1.36 2008/01/17 17:36:20 cwl Exp $
+ * $Id: ChecksumValidator.java,v 1.36.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/CleanerFileReader.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/CleanerFileReader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/CleanerFileReader.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/CleanerFileReader.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: CleanerFileReader.java,v 1.42 2008/05/15 01:52:41 linda Exp $
+ * $Id: CleanerFileReader.java,v 1.43.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -90,6 +90,7 @@
* Helper for determining the starting position and opening
* up a file at the desired location.
*/
+ @Override
protected void initStartingPosition(long endOfFileLsn,
Long fileNum)
throws IOException, DatabaseException {
@@ -114,6 +115,7 @@
/**
* @return true if this is a type we're interested in.
*/
+ @Override
protected boolean isTargetEntry() {
LogEntryType fromLogType =
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/DbChecksumException.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/DbChecksumException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/DbChecksumException.java 2008-05-13 01:44:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/DbChecksumException.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbChecksumException.java,v 1.23 2008/05/13 01:44:52 cwl Exp $
+ * $Id: DbChecksumException.java,v 1.24.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -42,6 +42,7 @@
}
}
+ @Override
public String toString() {
if (extraInfo == null) {
return super.toString();
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/DbOpReplicationContext.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/DbOpReplicationContext.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/DbOpReplicationContext.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/DbOpReplicationContext.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbOpReplicationContext.java,v 1.5 2008/01/07 14:28:51 cwl Exp $
+ * $Id: DbOpReplicationContext.java,v 1.5.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/DumpFileReader.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/DumpFileReader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/DumpFileReader.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/DumpFileReader.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DumpFileReader.java,v 1.49 2008/05/15 01:52:41 linda Exp $
+ * $Id: DumpFileReader.java,v 1.50.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -76,6 +76,7 @@
* @return true if this reader should process this entry, or just
* skip over it.
*/
+ @Override
protected boolean isTargetEntry() {
if (targetEntryTypes.size() == 0) {
/* We want to dump all entry types. */
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/BaseEntry.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/BaseEntry.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/BaseEntry.java 2008-03-10 20:59:20.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/BaseEntry.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: BaseEntry.java,v 1.8 2008/03/10 19:59:19 linda Exp $
+ * $Id: BaseEntry.java,v 1.9.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.log.entry;
@@ -92,6 +92,7 @@
public abstract StringBuffer dumpEntry(StringBuffer sb, boolean verbose);
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
dumpEntry(sb, true);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/BINDeltaLogEntry.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/BINDeltaLogEntry.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/BINDeltaLogEntry.java 2008-03-10 20:59:20.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/BINDeltaLogEntry.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: BINDeltaLogEntry.java,v 1.27 2008/03/10 19:59:19 linda Exp $
+ * $Id: BINDeltaLogEntry.java,v 1.27.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.log.entry;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/DbOperationType.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/DbOperationType.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/DbOperationType.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/DbOperationType.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbOperationType.java,v 1.3 2008/01/07 14:28:51 cwl Exp $
+ * $Id: DbOperationType.java,v 1.3.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.log.entry;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/DeletedDupLNLogEntry.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/DeletedDupLNLogEntry.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/DeletedDupLNLogEntry.java 2008-01-17 17:22:12.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/DeletedDupLNLogEntry.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DeletedDupLNLogEntry.java,v 1.32 2008/01/17 17:22:12 cwl Exp $
+ * $Id: DeletedDupLNLogEntry.java,v 1.33.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.log.entry;
@@ -60,6 +60,7 @@
* Extends its super class to read in the extra dup key.
* @see LNLogEntry#readEntry
*/
+ @Override
public void readEntry(LogEntryHeader header,
ByteBuffer entryBuffer,
boolean readFullItem)
@@ -81,6 +82,7 @@
* Extends super class to dump out extra key.
* @see LNLogEntry#dumpEntry
*/
+ @Override
public StringBuffer dumpEntry(StringBuffer sb, boolean verbose) {
super.dumpEntry(sb, verbose);
sb.append(Key.dumpString(dataAsKey, 0));
@@ -95,6 +97,7 @@
* Extend super class to add in extra key.
* @see LNLogEntry#getSize
*/
+ @Override
public int getSize() {
return super.getSize() +
LogUtils.getByteArrayLogSize(dataAsKey);
@@ -103,6 +106,7 @@
/**
* @see LogEntry#writeToLog
*/
+ @Override
public void writeEntry(LogEntryHeader header,
ByteBuffer destBuffer) {
super.writeEntry(header, destBuffer);
@@ -116,6 +120,7 @@
/**
* Get the data-as-key out of the entry.
*/
+ @Override
public byte[] getDupKey() {
return dataAsKey;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/INContainingEntry.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/INContainingEntry.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/INContainingEntry.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/INContainingEntry.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: INContainingEntry.java,v 1.19 2008/01/07 14:28:51 cwl Exp $
+ * $Id: INContainingEntry.java,v 1.19.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.log.entry;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/INLogEntry.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/INLogEntry.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/INLogEntry.java 2008-03-10 20:59:20.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/INLogEntry.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: INLogEntry.java,v 1.49 2008/03/10 19:59:19 linda Exp $
+ * $Id: INLogEntry.java,v 1.50.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.log.entry;
@@ -169,6 +169,7 @@
return in;
}
+ @Override
public Object clone()
throws CloneNotSupportedException {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/LNLogEntry.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/LNLogEntry.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/LNLogEntry.java 2008-05-13 01:44:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/LNLogEntry.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LNLogEntry.java,v 1.54 2008/05/13 01:44:52 cwl Exp $
+ * $Id: LNLogEntry.java,v 1.56.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.log.entry;
@@ -289,6 +289,7 @@
/**
* Returns the last logged size, saved by readEntry and writeEntry.
*/
+ @Override
public int getLastLoggedSize() {
return ln.getLastLoggedSize();
}
@@ -330,6 +331,7 @@
* Returns true for a deleted LN to count it immediately as obsolete.
* @see LogEntry#countAsObsoleteWhenLogged
*/
+ @Override
public boolean countAsObsoleteWhenLogged() {
return ln.isDeleted();
}
@@ -341,6 +343,7 @@
*
* @see LogEntry#postLogWork
*/
+ @Override
public void postLogWork(long justLoggedLsn)
throws DatabaseException {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/LogEntry.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/LogEntry.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/LogEntry.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/LogEntry.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LogEntry.java,v 1.27 2008/01/07 14:28:51 cwl Exp $
+ * $Id: LogEntry.java,v 1.27.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.log.entry;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/NameLNLogEntry.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/NameLNLogEntry.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/NameLNLogEntry.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/NameLNLogEntry.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: NameLNLogEntry.java,v 1.5 2008/01/07 14:28:51 cwl Exp $
+ * $Id: NameLNLogEntry.java,v 1.5.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.log.entry;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/NodeLogEntry.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/NodeLogEntry.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/NodeLogEntry.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/NodeLogEntry.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: NodeLogEntry.java,v 1.8 2008/01/07 14:28:51 cwl Exp $
+ * $Id: NodeLogEntry.java,v 1.8.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.log.entry;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/SingleItemEntry.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/SingleItemEntry.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/entry/SingleItemEntry.java 2008-03-10 20:59:20.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/entry/SingleItemEntry.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SingleItemEntry.java,v 1.8 2008/03/10 19:59:19 linda Exp $
+ * $Id: SingleItemEntry.java,v 1.9.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.log.entry;
@@ -82,6 +82,7 @@
/**
* @see LogEntry#clone
*/
+ @Override
public Object clone()
throws CloneNotSupportedException {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/FileHandle.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/FileHandle.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/FileHandle.java 2008-05-07 17:12:26.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/FileHandle.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: FileHandle.java,v 1.27 2008/05/07 17:12:25 mark Exp $
+ * $Id: FileHandle.java,v 1.27.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/FileHandleSource.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/FileHandleSource.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/FileHandleSource.java 2008-03-19 12:56:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/FileHandleSource.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: FileHandleSource.java,v 1.16 2008/03/19 11:56:55 cwl Exp $
+ * $Id: FileHandleSource.java,v 1.17.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -28,6 +28,7 @@
/**
* @see LogSource#release
*/
+ @Override
public void release()
throws DatabaseException {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/FileHeader.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/FileHeader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/FileHeader.java 2008-02-26 18:52:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/FileHeader.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: FileHeader.java,v 1.47 2008/02/26 18:52:35 mark Exp $
+ * $Id: FileHeader.java,v 1.48.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -162,6 +162,7 @@
/**
* Print in xml format
*/
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
dumpLog(sb, true);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/FileManager.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/FileManager.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/FileManager.java 2008-05-22 20:21:04.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/FileManager.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: FileManager.java,v 1.193 2008/05/22 20:21:04 linda Exp $
+ * $Id: FileManager.java,v 1.194.2.9 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -28,6 +28,7 @@
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.EnvironmentStats;
+import com.sleepycat.je.EnvironmentLockedException;
import com.sleepycat.je.RunRecoveryException;
import com.sleepycat.je.StatsConfig;
import com.sleepycat.je.config.EnvironmentParams;
@@ -163,14 +164,6 @@
*/
private Map perFileLastUsedLsn;
- /* Whether to use NIO for file I/O. */
- private boolean useNIO;
-
- /*
- * If non-0, do NIO in chunks of this size.
- */
- private long chunkedNIOSize = 0;
-
/*
* Use O_DSYNC to open JE log files.
*/
@@ -230,27 +223,11 @@
DbConfigManager configManager = envImpl.getConfigManager();
maxFileSize = configManager.getLong(EnvironmentParams.LOG_FILE_MAX);
- useNIO =
- configManager.getBoolean(EnvironmentParams.LOG_USE_NIO);
- chunkedNIOSize =
- configManager.getLong(EnvironmentParams.LOG_CHUNKED_NIO);
useODSYNC =
configManager.getBoolean(EnvironmentParams.LOG_USE_ODSYNC);
- boolean directNIO =
- configManager.getBoolean(EnvironmentParams.LOG_DIRECT_NIO);
VERIFY_CHECKSUMS =
configManager.getBoolean(EnvironmentParams.LOG_VERIFY_CHECKSUMS);
- if (!useNIO && (chunkedNIOSize > 0 || directNIO)) {
- throw new IllegalArgumentException
- (EnvironmentParams.LOG_USE_NIO.getName() +
- " is false and therefore " +
- EnvironmentParams.LOG_DIRECT_NIO.getName() +
- " or " +
- EnvironmentParams.LOG_CHUNKED_NIO.getName() +
- " may not be used.");
- }
-
if (!envImpl.isMemOnly()) {
if (!dbEnvHome.exists()) {
throw new LogException("Environment home " + dbEnvHome +
@@ -372,7 +349,9 @@
}
/**
- * For unit tests.
+ * Returns the highest (current) file number. Because a long value cannot
+ * be read atomically without synchronization, this method should be called
+ * while holding the log write latch.
*/
public long getCurrentFileNum() {
return currentFileNum;
@@ -862,7 +841,13 @@
fileName = fileNames[i];
try {
newFile =
- new RandomAccessFile(fileName, mode.getModeValue());
+ new RandomAccessFile(fileName, mode.getModeValue()) {
+ public synchronized long length()
+ throws IOException {
+
+ return super.length();
+ }
+ };
break;
} catch (FileNotFoundException e) {
/* Save the first exception thrown. */
@@ -1160,6 +1145,11 @@
endOfLog.getWritableFile(DbLsn.getFileNumber(firstLsn));
ByteBuffer data = fullBuffer.getDataBuffer();
+ if (VERIFY_CHECKSUMS) {
+ verifyChecksums(data, DbLsn.getFileOffset(firstLsn),
+ "pre-write");
+ }
+
try {
/*
@@ -1215,7 +1205,7 @@
* it to disk on the write, then rewriting should allow
* them to be rewritten. See [11271].
*
- * Rewriting committed transactions in replication is
+ * Rewriting committed transactions in replication is
* highly problematic, and can lead to divergence between
* the replica and master. If this path is re-enabled, we
* must assess its impact in replication.
@@ -1240,7 +1230,7 @@
}
/**
- * Write a buffer to a file at a given offset, using NIO if so configured.
+ * Write a buffer to a file at a given offset.
*/
private int writeToFile(RandomAccessFile file,
ByteBuffer data,
@@ -1249,95 +1239,46 @@
throws IOException, DatabaseException {
int totalBytesWritten = 0;
- if (useNIO) {
- FileChannel channel = file.getChannel();
- if (chunkedNIOSize > 0) {
+ bumpWriteCount("write");
- /*
- * We can't change the limit without impacting readers that
- * might find this buffer in the buffer pool. Duplicate the
- * buffer so we can set the limit independently.
- */
- ByteBuffer useData = data.duplicate();
+ /*
+ * Perform a RandomAccessFile write and update the buffer position.
+ * ByteBuffer.array() is safe to use since all non-direct ByteBuffers
+ * have a backing array. Synchronization on the file object is needed
+ * because two threads may call seek() on the same file object.
+ */
+ synchronized (file) {
+ assert data.hasArray();
- /*
- * Write small chunks of data by manipulating the position and
- * limit properties of the buffer, and submitting it for
- * writing repeatedly.
- *
- * For each chunk, the limit is set to the position +
- * chunkedNIOSize, capped by the original limit of the buffer.
- *
- * Preconditions: data to be written is betweek data.position()
- * and data.limit()
-
- * Postconditions: data.limit() has not changed,
- * data.position() == data.limit(), offset of the channel has
- * not been modified.
- */
- int originalLimit = useData.limit();
- useData.limit(useData.position());
- while (useData.limit() < originalLimit) {
- bumpWriteCount("nio write");
-
- useData.limit((int)
- (Math.min(useData.limit() + chunkedNIOSize,
- originalLimit)));
- int bytesWritten = channel.write(useData, destOffset);
- destOffset += bytesWritten;
- totalBytesWritten += bytesWritten;
- }
- } else {
+ int pos = data.position();
+ int size = data.limit() - pos;
- /*
- * Perform a single write using NIO.
- */
- totalBytesWritten = channel.write(data, destOffset);
+ if (lastFileNumberTouched == fileNum &&
+ (Math.abs(destOffset - lastFileTouchedOffset) <
+ ADJACENT_TRACK_SEEK_DELTA)) {
+ nSequentialWrites++;
+ nSequentialWriteBytes += size;
+ } else {
+ nRandomWrites++;
+ nRandomWriteBytes += size;
}
- } else {
-
- bumpWriteCount("write");
-
- /*
- * Perform a RandomAccessFile write and update the buffer position.
- * ByteBuffer.array() is safe to use since all non-direct
- * ByteBuffers have a backing array. Synchronization on the file
- * object is needed because two threads may call seek() on the same
- * file object.
- */
- synchronized (file) {
- assert data.hasArray();
- int pos = data.position();
- int size = data.limit() - pos;
-
- if (lastFileNumberTouched == fileNum &&
- (Math.abs(destOffset - lastFileTouchedOffset) <
- ADJACENT_TRACK_SEEK_DELTA)) {
- nSequentialWrites++;
- nSequentialWriteBytes += size;
- } else {
- nRandomWrites++;
- nRandomWriteBytes += size;
- }
-
- if (VERIFY_CHECKSUMS) {
- verifyChecksums(data, destOffset, "pre-write");
- }
+ if (VERIFY_CHECKSUMS) {
+ verifyChecksums(data, destOffset, "pre-write");
+ }
+ file.seek(destOffset);
+ file.write(data.array(), pos + data.arrayOffset(), size);
+ if (VERIFY_CHECKSUMS) {
file.seek(destOffset);
- file.write(data.array(), pos + data.arrayOffset(), size);
- if (VERIFY_CHECKSUMS) {
- file.seek(destOffset);
- file.read(data.array(), pos + data.arrayOffset(), size);
- verifyChecksums(data, destOffset, "post-write");
- }
- data.position(pos + size);
- totalBytesWritten = size;
-
- lastFileNumberTouched = fileNum;
- lastFileTouchedOffset = destOffset + size;
+ file.read(data.array(), pos + data.arrayOffset(), size);
+ verifyChecksums(data, destOffset, "post-write");
}
+ data.position(pos + size);
+ totalBytesWritten = size;
+
+ lastFileNumberTouched = fileNum;
+ lastFileTouchedOffset = destOffset + size;
}
return totalBytesWritten;
}
@@ -1362,7 +1303,7 @@
}
/**
- * Read a buffer from a file at a given offset, using NIO if so configured.
+ * Read a buffer from a file at a given offset.
*/
void readFromFile(RandomAccessFile file,
ByteBuffer readBuffer,
@@ -1387,82 +1328,41 @@
long fileNum)
throws DatabaseException, IOException {
- if (useNIO) {
- FileChannel channel = file.getChannel();
-
- if (chunkedNIOSize > 0) {
-
- /*
- * Read a chunk at a time to prevent large direct memory
- * allocations by NIO.
- */
- int readLength = readBuffer.limit();
- long currentPosition = offset;
- while (readBuffer.position() < readLength) {
- readBuffer.limit((int)
- (Math.min(readBuffer.limit() +
- chunkedNIOSize,
- readLength)));
- if (IO_EXCEPTION_TESTING_ON_READ) {
- throw new IOException("generated for testing (read)");
- }
- int bytesRead = channel.read(readBuffer, currentPosition);
+ /*
+ * Perform a RandomAccessFile read and update the buffer position.
+ * ByteBuffer.array() is safe to use since all non-direct ByteBuffers
+ * have a backing array. Synchronization on the file object is needed
+ * because two threads may call seek() on the same file object.
+ */
+ synchronized (file) {
+ assert readBuffer.hasArray();
- if (bytesRead < 1)
- break;
+ int pos = readBuffer.position();
+ int size = readBuffer.limit() - pos;
- currentPosition += bytesRead;
- }
+ if (lastFileNumberTouched == fileNum &&
+ (Math.abs(offset - lastFileTouchedOffset) <
+ ADJACENT_TRACK_SEEK_DELTA)) {
+ nSequentialReads++;
+ nSequentialReadBytes += size;
} else {
-
- if (IO_EXCEPTION_TESTING_ON_READ) {
- throw new IOException("generated for testing (read)");
- }
-
- /*
- * Perform a single read using NIO.
- */
- channel.read(readBuffer, offset);
+ nRandomReads++;
+ nRandomReadBytes += size;
}
- } else {
- /*
- * Perform a RandomAccessFile read and update the buffer position.
- * ByteBuffer.array() is safe to use since all non-direct
- * ByteBuffers have a backing array. Synchronization on the file
- * object is needed because two threads may call seek() on the same
- * file object.
- */
- synchronized (file) {
- assert readBuffer.hasArray();
-
- int pos = readBuffer.position();
- int size = readBuffer.limit() - pos;
-
- if (lastFileNumberTouched == fileNum &&
- (Math.abs(offset - lastFileTouchedOffset) <
- ADJACENT_TRACK_SEEK_DELTA)) {
- nSequentialReads++;
- nSequentialReadBytes += size;
- } else {
- nRandomReads++;
- nRandomReadBytes += size;
- }
-
- file.seek(offset);
- if (IO_EXCEPTION_TESTING_ON_READ) {
- throw new IOException("generated for testing (read)");
- }
- int bytesRead = file.read(readBuffer.array(),
- pos + readBuffer.arrayOffset(),
- size);
- if (bytesRead > 0) {
- readBuffer.position(pos + bytesRead);
- }
-
- lastFileNumberTouched = fileNum;
- lastFileTouchedOffset = offset + bytesRead;
+ file.seek(offset);
+ if (IO_EXCEPTION_TESTING_ON_READ) {
+ throw new IOException("generated for testing (read)");
}
+ int bytesRead = file.read(readBuffer.array(),
+ pos + readBuffer.arrayOffset(),
+ size);
+ if (bytesRead > 0) {
+ readBuffer.position(pos + bytesRead);
+ }
+
+ lastFileNumberTouched = fileNum;
+ lastFileTouchedOffset = offset + bytesRead;
}
}
@@ -1711,7 +1611,8 @@
throwIt = true;
}
if (throwIt) {
- throw new LogException
+ close();
+ throw new EnvironmentLockedException
("A " + LOCK_FILE + " file exists in " +
dbEnvHome.getAbsolutePath() +
" The environment can not be locked for " +
@@ -2129,7 +2030,24 @@
* file has flipped to a new file since the fsync was issued.
*/
synchronized (fsyncFileSynchronizer) {
- RandomAccessFile file = endOfLogSyncFile;
+
+ /*
+ * In [#17865] a user reported file corruption when using
+ * Windows 7. This SR includes a test program (JETester) which
+ * readily demonstrates the problem. We are reasonably sure
+ * that the problem is caused by concurrent write() and fsync()
+ * calls on the same file, and in particular, if two different
+ * file descriptors are used concurrently. The code below is a
+ * workaround for this problem since it does not happen when we
+ * use the same RAF for the write() and fsync(). In fact, the
+ * test program has slightly better performance on the write
+ * phase with the change below. This problem is not present
+ * in 4.0 because of the write queue code in that release.
+ */
+ boolean isWin7 = EnvironmentImpl.IS_WINDOWS_7;
+ RandomAccessFile file =
+ (isWin7 ? endOfLogRWFile : endOfLogSyncFile);
+
if (file != null) {
bumpWriteCount("fsync");
FileChannel channel = file.getChannel();
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/FileReader.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/FileReader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/FileReader.java 2008-05-20 17:52:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/FileReader.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: FileReader.java,v 1.119 2008/05/20 17:52:35 linda Exp $
+ * $Id: FileReader.java,v 1.119.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/FileSource.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/FileSource.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/FileSource.java 2008-03-19 12:56:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/FileSource.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: FileSource.java,v 1.37 2008/03/19 11:56:55 cwl Exp $
+ * $Id: FileSource.java,v 1.37.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/FSyncManager.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/FSyncManager.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/FSyncManager.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/FSyncManager.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: FSyncManager.java,v 1.22 2008/01/07 14:28:51 cwl Exp $
+ * $Id: FSyncManager.java,v 1.22.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/INFileReader.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/INFileReader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/INFileReader.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/INFileReader.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: INFileReader.java,v 1.70 2008/05/15 01:52:41 linda Exp $
+ * $Id: INFileReader.java,v 1.72.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -215,6 +215,7 @@
* log entries. If not, we only want to see IN entries.
* @return true if this is an IN entry.
*/
+ @Override
protected boolean isTargetEntry()
throws DatabaseException {
@@ -372,7 +373,7 @@
fileMappers.put(fileNumber, mapper);
}
mapper.putLSN(vlsn.getSequence(), lsn,
- LogEntryType.isSyncPoint(currentEntryHeader.getType()));
+ LogEntryType.findType(currentEntryHeader.getType()));
}
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/JEFileFilter.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/JEFileFilter.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/JEFileFilter.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/JEFileFilter.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: JEFileFilter.java,v 1.21 2008/01/07 14:28:51 cwl Exp $
+ * $Id: JEFileFilter.java,v 1.21.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/LastFileReader.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/LastFileReader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/LastFileReader.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/LastFileReader.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LastFileReader.java,v 1.54 2008/05/15 01:52:41 linda Exp $
+ * $Id: LastFileReader.java,v 1.55.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -84,6 +84,7 @@
/**
* Override so that we always start at the last file.
*/
+ @Override
protected void initStartingPosition(long endOfFileLsn,
Long singleFileNum)
throws IOException, DatabaseException {
@@ -237,6 +238,7 @@
* readNextEntry will stop at a bad entry.
* @return true if an element has been read.
*/
+ @Override
public boolean readNextEntry()
throws DatabaseException, IOException {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/LatchedLogManager.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/LatchedLogManager.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/LatchedLogManager.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/LatchedLogManager.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LatchedLogManager.java,v 1.28 2008/05/15 01:52:41 linda Exp $
+ * $Id: LatchedLogManager.java,v 1.28.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/LNFileReader.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/LNFileReader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/LNFileReader.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/LNFileReader.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LNFileReader.java,v 1.70 2008/05/15 01:52:41 linda Exp $
+ * $Id: LNFileReader.java,v 1.71.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -84,6 +84,7 @@
/**
* @return true if this is a transactional LN or Locker Commit entry.
*/
+ @Override
protected boolean isTargetEntry() {
if (currentEntryHeader.getProvisional().isProvisional
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogBuffer.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogBuffer.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogBuffer.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogBuffer.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LogBuffer.java,v 1.47 2008/01/07 14:28:51 cwl Exp $
+ * $Id: LogBuffer.java,v 1.47.2.3 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -40,11 +40,7 @@
LogBuffer(int capacity, EnvironmentImpl env)
throws DatabaseException {
- if (env.useDirectNIO()) {
- buffer = ByteBuffer.allocateDirect(capacity);
- } else {
- buffer = ByteBuffer.allocate(capacity);
- }
+ buffer = ByteBuffer.allocate(capacity);
readLatch = new Latch(DEBUG_NAME);
reinit();
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogBufferPool.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogBufferPool.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogBufferPool.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogBufferPool.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LogBufferPool.java,v 1.77 2008/05/15 01:52:41 linda Exp $
+ * $Id: LogBufferPool.java,v 1.77.2.3 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -29,7 +29,7 @@
private EnvironmentImpl envImpl = null;
private int logBufferSize; // size of each log buffer
- private LinkedList bufferPool;
+ private LinkedList bufferPool;
/* Buffer that holds the current log end. All writes go to this buffer. */
private LogBuffer currentWriteBuffer;
@@ -192,7 +192,7 @@
currentWriteBuffer.latchForWrite();
LogBuffer latchedBuffer = currentWriteBuffer;
try {
- ByteBuffer currentByteBuffer = currentWriteBuffer.getDataBuffer();
+ ByteBuffer currentByteBuffer = latchedBuffer.getDataBuffer();
int savePosition = currentByteBuffer.position();
int saveLimit = currentByteBuffer.limit();
currentByteBuffer.flip();
@@ -214,10 +214,10 @@
* write this buffer to disk and find a new buffer to use.
*/
try {
- fileManager.writeLogBuffer(currentWriteBuffer);
+ fileManager.writeLogBuffer(latchedBuffer);
/* Rewind so readers can see this. */
- currentWriteBuffer.getDataBuffer().rewind();
+ latchedBuffer.getDataBuffer().rewind();
/* We're done with the current buffer. */
latchedBuffer.release();
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogContext.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogContext.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogContext.java 2008-04-18 22:57:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogContext.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LogContext.java,v 1.1 2008/04/18 22:57:36 mark Exp $
+ * $Id: LogContext.java,v 1.1.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogEntryHeader.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogEntryHeader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogEntryHeader.java 2008-05-12 15:35:32.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogEntryHeader.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LogEntryHeader.java,v 1.24 2008/05/12 15:35:31 linda Exp $
+ * $Id: LogEntryHeader.java,v 1.26.2.2 2010/01/04 15:30:29 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -311,7 +311,7 @@
* @param verbose if true, dump the full, verbose version
*/
public void dumpLog(StringBuffer sb, boolean verbose) {
- sb.append("");
}
@@ -329,11 +329,11 @@
sb.append("type=\"").append(lastEntryType.toStringNoVersion()).
append("/").append((int) entryVersion);
if (provisional != Provisional.NO) {
- sb.append("\" provisional=\"");
+ sb.append("\" prov=\"");
sb.append(provisional);
}
if (replicated) {
- sb.append("\" replicated=\"true");
+ sb.append("\" rep=\"true");
}
if (vlsn != null) {
sb.append("\" ");
@@ -381,6 +381,7 @@
LogUtils.writeUnsignedInt(entryBuffer, checksumVal);
}
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
dumpLog(sb, true /* verbose */);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogEntryType.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogEntryType.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogEntryType.java 2008-05-27 15:30:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogEntryType.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LogEntryType.java,v 1.99 2008/05/27 15:30:35 mark Exp $
+ * $Id: LogEntryType.java,v 1.99.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogException.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogException.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogException.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LogException.java,v 1.16 2008/01/07 14:28:51 cwl Exp $
+ * $Id: LogException.java,v 1.16.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogFileNotFoundException.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogFileNotFoundException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogFileNotFoundException.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogFileNotFoundException.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LogFileNotFoundException.java,v 1.13 2008/01/07 14:28:51 cwl Exp $
+ * $Id: LogFileNotFoundException.java,v 1.13.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/Loggable.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/Loggable.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/Loggable.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/Loggable.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Loggable.java,v 1.8 2008/01/07 14:28:51 cwl Exp $
+ * $Id: Loggable.java,v 1.8.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogItem.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogItem.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogItem.java 2008-04-18 22:57:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogItem.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LogItem.java,v 1.1 2008/04/18 22:57:36 mark Exp $
+ * $Id: LogItem.java,v 1.1.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogManager.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogManager.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogManager.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogManager.java 2010-02-08 17:19:42.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LogManager.java,v 1.201 2008/05/15 01:52:41 linda Exp $
+ * $Id: LogManager.java,v 1.203.2.4 2010/02/08 17:19:42 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -362,8 +362,8 @@
* of writing this mapping to disk.
*/
if (item.repContext.inReplicationStream()) {
- assert (item.header.getVLSN() != null) :
- "Unexpected null vlsn: " + item.header + " " +
+ assert (item.header.getVLSN() != null) :
+ "Unexpected null VLSN: " + item.header + " " +
item.repContext;
envImpl.getReplicator().registerVLSN(item.newLsn, item.header);
}
@@ -504,7 +504,7 @@
LogBuffer useLogBuffer =
logBufferPool.getWriteBuffer(entrySize, flippedFile);
- /* Add checksum, prev offset, vlsn to entry. */
+ /* Add checksum, prev offset, and VLSN to the entry. */
item.buffer = item.header.addPostMarshallingInfo
(envImpl, item.buffer, fileManager.getPrevEntryOffset(),
item.repContext);
@@ -595,7 +595,7 @@
* Serialize a loggable object into this buffer. (public for
* unit tests.
*/
- public ByteBuffer marshallIntoBuffer(LogEntryHeader header, LogEntry entry)
+ private ByteBuffer marshallIntoBuffer(LogEntryHeader header, LogEntry entry)
throws DatabaseException {
int entrySize = header.getSize() + header.getItemSize();
@@ -623,6 +623,9 @@
LogEntryHeader header = new LogEntryHeader
(entry, Provisional.NO, ReplicationContext.NO_REPLICATE);
+ /* Assert that we're not in a situation demanding Txn mutex. */
+ assert entry.getLogType() != LogEntryType.LOG_LN_TRANSACTIONAL;
+
ByteBuffer destBuffer = marshallIntoBuffer(header, entry);
return header.addPostMarshallingInfo(envImpl,
@@ -1028,7 +1031,7 @@
/**
* Counts the given obsolete IN LSNs under the log write latch.
*/
- public abstract void countObsoleteINs(List lsnList,
+ public abstract void countObsoleteINs(List lsnList,
DatabaseImpl nodeDb)
throws DatabaseException;
@@ -1067,7 +1070,7 @@
void loadEndOfLogStatInternal(EnvironmentStats stats) {
stats.setEndOfLog(fileManager.getLastUsedLsn());
- }
+ }
/* For unit testing only. */
public void setReadHook(TestHook hook) {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogSource.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogSource.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogSource.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogSource.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LogSource.java,v 1.26 2008/01/07 14:28:51 cwl Exp $
+ * $Id: LogSource.java,v 1.26.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogUtils.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogUtils.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/LogUtils.java 2008-05-13 01:44:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/LogUtils.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LogUtils.java,v 1.61 2008/05/13 01:44:52 cwl Exp $
+ * $Id: LogUtils.java,v 1.62.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -560,6 +560,7 @@
return bqual;
}
+ @Override
public boolean equals(Object o) {
if (!(o instanceof XidImpl)) {
return false;
@@ -577,6 +578,7 @@
return false;
}
+ @Override
public int hashCode() {
int code = formatId;
if (gid != null) {
@@ -611,6 +613,7 @@
return true;
}
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/PrintFileReader.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/PrintFileReader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/PrintFileReader.java 2008-05-13 01:44:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/PrintFileReader.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PrintFileReader.java,v 1.22 2008/05/13 01:44:52 cwl Exp $
+ * $Id: PrintFileReader.java,v 1.22.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/Provisional.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/Provisional.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/Provisional.java 2008-04-22 15:44:10.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/Provisional.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Provisional.java,v 1.2 2008/04/22 15:44:10 mark Exp $
+ * $Id: Provisional.java,v 1.2.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/ReplicationContext.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/ReplicationContext.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/ReplicationContext.java 2008-05-13 01:44:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/ReplicationContext.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ReplicationContext.java,v 1.9 2008/05/13 01:44:52 cwl Exp $
+ * $Id: ReplicationContext.java,v 1.9.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/ScavengerFileReader.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/ScavengerFileReader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/ScavengerFileReader.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/ScavengerFileReader.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ScavengerFileReader.java,v 1.22 2008/05/15 01:52:41 linda Exp $
+ * $Id: ScavengerFileReader.java,v 1.23.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -110,6 +110,7 @@
* to find the other side of the corrupted area and try to re-read this
* file.
*/
+ @Override
public boolean readNextEntry()
throws DatabaseException, IOException {
@@ -129,6 +130,7 @@
* and read forward until the lower side of the corrupted area has been
* found.
*/
+ @Override
protected boolean resyncReader(long nextGoodRecordPostCorruption,
boolean showCorruptedBounds)
throws DatabaseException, IOException {
@@ -195,6 +197,7 @@
* @return true if this reader should process this entry, or just skip
* over it.
*/
+ @Override
protected boolean isTargetEntry() {
if (targetEntryTypes.size() == 0) {
/* We want to dump all entry types. */
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/SearchFileReader.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/SearchFileReader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/SearchFileReader.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/SearchFileReader.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SearchFileReader.java,v 1.46 2008/01/07 14:28:51 cwl Exp $
+ * $Id: SearchFileReader.java,v 1.47.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -45,6 +45,7 @@
/**
* @return true if this is a targetted entry.
*/
+ @Override
protected boolean isTargetEntry() {
return (targetType.equalsType(currentEntryHeader.getType()));
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/StatsFileReader.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/StatsFileReader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/StatsFileReader.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/StatsFileReader.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: StatsFileReader.java,v 1.24 2008/05/15 01:52:41 linda Exp $
+ * $Id: StatsFileReader.java,v 1.25.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -128,6 +128,7 @@
return true;
}
+ @Override
public void summarize() {
System.out.println("Log statistics:");
Iterator> iter =
@@ -303,17 +304,17 @@
c.endCkptLsn;
long endToEndDistance = 0;
- FileManager fileManager = envImpl.getFileManager();
+ FileManager fileMgr = envImpl.getFileManager();
if (prevCounter == null) {
endToEndDistance =
DbLsn.getWithCleaningDistance(end,
- fileManager,
+ fileMgr,
firstLsnRead,
logFileMax);
} else {
endToEndDistance =
DbLsn.getWithCleaningDistance(end,
- fileManager,
+ fileMgr,
prevCounter.endCkptLsn,
logFileMax);
}
@@ -330,13 +331,13 @@
if (prevCounter == null) {
endToStartDistance =
DbLsn.getWithCleaningDistance(start,
- fileManager,
+ fileMgr,
firstLsnRead,
logFileMax);
} else {
endToStartDistance =
DbLsn.getWithCleaningDistance(start,
- fileManager,
+ fileMgr,
prevCounter.endCkptLsn,
logFileMax);
}
@@ -350,7 +351,7 @@
(c.endCkptLsn != DbLsn.NULL_LSN)) {
startToEndDistance =
DbLsn.getWithCleaningDistance(c.endCkptLsn,
- fileManager,
+ fileMgr,
c.startCkptLsn,
logFileMax);
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/SyncedLogManager.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/SyncedLogManager.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/SyncedLogManager.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/SyncedLogManager.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SyncedLogManager.java,v 1.28 2008/05/15 01:52:41 linda Exp $
+ * $Id: SyncedLogManager.java,v 1.28.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/TraceLogHandler.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/TraceLogHandler.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/TraceLogHandler.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/TraceLogHandler.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: TraceLogHandler.java,v 1.34 2008/01/07 14:28:51 cwl Exp $
+ * $Id: TraceLogHandler.java,v 1.34.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/log/UtilizationFileReader.java libdb-je-java-3.3.98/src/com/sleepycat/je/log/UtilizationFileReader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/log/UtilizationFileReader.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/log/UtilizationFileReader.java 2010-01-04 15:30:30.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: UtilizationFileReader.java,v 1.18 2008/05/15 01:52:41 linda Exp $
+ * $Id: UtilizationFileReader.java,v 1.19.2.2 2010/01/04 15:30:30 cwl Exp $
*/
package com.sleepycat.je.log;
@@ -71,6 +71,7 @@
twoEntryList.add(null);
}
+ @Override
protected boolean isTargetEntry() {
/* UtilizationTracker does not count the file header. */
return currentEntryHeader.getType() !=
@@ -270,6 +271,7 @@
* Overrides the LN size calculation to return the recalculated number
* of obsolete LN bytes.
*/
+ @Override
public int getObsoleteLNSize() {
return recalcObsoleteLNSize;
}
@@ -278,6 +280,7 @@
* Overrides the IN size calculation to return the recalculated number
* of obsolete IN bytes.
*/
+ @Override
public int getObsoleteINSize() {
return recalcObsoleteINSize;
}
@@ -285,6 +288,7 @@
/**
* Overrides to add the extended data fields.
*/
+ @Override
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append(super.toString());
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/LogScanConfig.java libdb-je-java-3.3.98/src/com/sleepycat/je/LogScanConfig.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/LogScanConfig.java 2008-05-13 17:41:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/LogScanConfig.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,14 +1,16 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LogScanConfig.java,v 1.6 2008/05/13 17:41:43 cwl Exp $
+ * $Id: LogScanConfig.java,v 1.7.2.3 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
/**
+ * For internal use only.
+ * @hidden
* Specify the attributes of a log scan.
*/
public class LogScanConfig {
@@ -39,4 +41,15 @@
public boolean getForwards() {
return forwards;
}
+
+ /**
+ * Returns the values for each configuration attribute.
+ *
+ * @return the values for each configuration attribute.
+ */
+ @Override
+ public String toString() {
+ return "forwards=" + forwards +
+ "\n";
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/LogScanner.java libdb-je-java-3.3.98/src/com/sleepycat/je/LogScanner.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/LogScanner.java 2008-01-24 14:59:28.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/LogScanner.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,14 +1,16 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LogScanner.java,v 1.3 2008/01/24 14:59:27 linda Exp $
+ * $Id: LogScanner.java,v 1.3.2.3 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
/**
+ * For internal use only.
+ * @hidden
* Used with Environment.scanLog to scan raw log entries. An instance of a
* class that implements this interface should be passed to
* Environment.scanLog.
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/OperationStatus.java libdb-je-java-3.3.98/src/com/sleepycat/je/OperationStatus.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/OperationStatus.java 2008-01-07 14:28:46.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/OperationStatus.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: OperationStatus.java,v 1.14 2008/01/07 14:28:46 cwl Exp $
+ * $Id: OperationStatus.java,v 1.15.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -47,6 +47,7 @@
}
/** {@inheritDoc} */
+ @Override
public String toString() {
return "OperationStatus." + statusName;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/package.html libdb-je-java-3.3.98/src/com/sleepycat/je/package.html
--- libdb-je-java-3.3.62/src/com/sleepycat/je/package.html 2008-01-07 14:28:46.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/package.html 2010-01-04 15:30:28.000000000 +0000
@@ -5,9 +5,9 @@
See the file LICENSE for redistribution information.
- Copyright (c) 2002,2008 Oracle. All rights reserved.
+ Copyright (c) 2002,2010 Oracle. All rights reserved.
- $Id: package.html,v 1.16 2008/01/07 14:28:46 cwl Exp $
+ $Id: package.html,v 1.16.2.2 2010/01/04 15:30:27 cwl Exp $
-->
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/PreloadConfig.java libdb-je-java-3.3.98/src/com/sleepycat/je/PreloadConfig.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/PreloadConfig.java 2008-01-24 14:59:28.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/PreloadConfig.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PreloadConfig.java,v 1.8 2008/01/24 14:59:27 linda Exp $
+ * $Id: PreloadConfig.java,v 1.9.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -104,4 +104,17 @@
return null;
}
}
+
+ /**
+ * Returns the values for each configuration attribute.
+ *
+ * @return the values for each configuration attribute.
+ */
+ @Override
+ public String toString() {
+ return "maxBytes=" + maxBytes +
+ "\nmaxMillisecs=" + maxMillisecs +
+ "\nloadLNs=" + loadLNs +
+ "\n";
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/PreloadStats.java libdb-je-java-3.3.98/src/com/sleepycat/je/PreloadStats.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/PreloadStats.java 2008-01-24 14:59:28.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/PreloadStats.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PreloadStats.java,v 1.9 2008/01/24 14:59:27 linda Exp $
+ * $Id: PreloadStats.java,v 1.10.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -212,6 +212,7 @@
* Returns a String representation of the stats in the form of
* <stat>=<value>
*/
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("status=").append(status).append('\n');
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/PreloadStatus.java libdb-je-java-3.3.98/src/com/sleepycat/je/PreloadStatus.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/PreloadStatus.java 2008-05-20 17:52:34.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/PreloadStatus.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PreloadStatus.java,v 1.10 2008/05/20 17:52:34 linda Exp $
+ * $Id: PreloadStatus.java,v 1.11.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -23,6 +23,7 @@
this.statusName = statusName;
}
+ @Override
public String toString() {
return "PreloadStatus." + statusName;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/CheckpointEnd.java libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/CheckpointEnd.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/CheckpointEnd.java 2008-02-06 02:04:18.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/CheckpointEnd.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: CheckpointEnd.java,v 1.37 2008/02/06 02:04:18 cwl Exp $
+ * $Id: CheckpointEnd.java,v 1.38.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.recovery;
@@ -228,6 +228,7 @@
return false;
}
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("time=").append(endTime);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/Checkpointer.java libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/Checkpointer.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/Checkpointer.java 2008-05-23 18:50:50.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/Checkpointer.java 2010-03-26 01:52:08.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Checkpointer.java,v 1.169 2008/05/23 18:50:49 mark Exp $
+ * $Id: Checkpointer.java,v 1.170.2.5 2010/03/26 01:52:07 mark Exp $
*/
package com.sleepycat.je.recovery;
@@ -74,6 +74,8 @@
*/
public static TestHook maxFlushLevelHook = null;
+ public static TestHook beforeFlushHook = null;
+
private EnvironmentImpl envImpl;
/* Checkpoint sequence, initialized at recovery. */
@@ -234,6 +236,7 @@
/**
* Return the number of retries when a deadlock exception occurs.
*/
+ @Override
protected long nDeadlockRetries()
throws DatabaseException {
@@ -468,6 +471,9 @@
*/
dirtyMap.addCostToMemoryBudget();
+ /* Call hook after dirty map creation and before flushing. */
+ TestHookExecute.doHookIfSet(beforeFlushHook);
+
/* Flush IN nodes. */
boolean allowDeltas = !config.getMinimizeRecoveryTime();
flushDirtyNodes(envImpl, dirtyMap, highestFlushLevels, allowDeltas,
@@ -616,6 +622,11 @@
maxFlushLevelHook = hook;
}
+ /* For unit testing only. */
+ public static void setBeforeFlushHook(TestHook hook) {
+ beforeFlushHook = hook;
+ }
+
/**
* Flush the nodes in order, from the lowest level to highest level. As a
* flush dirties its parent, add it to the dirty map, thereby cascading the
@@ -759,22 +770,22 @@
*
* If this is a high priority checkpoint, we'll hold the INb latch across
* the time it takes to flush all three children. In flushIN(BINd), we
- * walk through INa, create a local map of all the siblings that can be
+ * walk through INb, create a local map of all the siblings that can be
* found in the dirty map, and then call logSiblings with that local map.
- * Then we'll write out INa.
+ * Then we'll write out INb.
*
* If high priority is false, we will not hold the INb latch across
* multiple IOs. Instead, we
* - write BINd out, using logSiblings
- * - while still holding the INa latch, we create a local map of dirty
+ * - while still holding the INb latch, we create a local map of dirty
* siblings
- * - release the INa latch
+ * - release the INb latch
* - call flushIN() recursively on each entry in the local sibling map,
* which will result in a search and write of each sibling. These
* recursive calls to flushIN are called with the allowLogSubtree
* parameter of false to halt the recursion and prevent a repeat of the
* sibling examination.
- * - write INa
+ * - write INb
*/
private static void flushIN(EnvironmentImpl envImpl,
DatabaseImpl db,
@@ -862,6 +873,7 @@
*/
if (result.parent != null) {
IN parent = result.parent;
+ int parentLevel = parent.getLevel();
boolean mustLogParent = false;
/*
@@ -874,17 +886,25 @@
* tree DB.
*/
boolean bottomLevelTarget = db.getSortedDuplicates() ?
- (parent.getLevel() == 2) :
- ((parent.getLevel() & IN.LEVEL_MASK) == 2);
+ (parentLevel == 2) :
+ ((parentLevel & IN.LEVEL_MASK) == 2);
/*
* INs at the max flush level are always non-provisional and
* INs at the bottom level (when this is not also the max flush
* level) are always provisional. In between INs are
* provisional BEFORE_CKPT_END (see Provisional).
+ *
+ * Note that to determine whether this IN is at the
+ * maxFlushLevel, we check (parentLevel > maxFlushLevel)
+ * instead of (currentLevel >= maxFlushLevel). This handles
+ * the case where this IN is a DIN root, and the parent is a
+ * BIN that will not be flushed because the maxFlushLevel is
+ * less than IN.MAIN_LEVEL (0x10000). For example, this IN is
+ * a DIN root at level 2 and the maxFlushLevel is 3. [#16712]
*/
Provisional provisional;
- if (currentLevel >= maxFlushLevel) {
+ if (parentLevel > maxFlushLevel) {
provisional = Provisional.NO;
} else if (bottomLevelTarget) {
provisional = Provisional.YES;
@@ -969,7 +989,7 @@
* the non-exact search does not find a sibling
* rather than a parent. [#11555]
*/
- if (parent.getLevel() > currentLevel) {
+ if (parentLevel > currentLevel) {
mustLogParent |= true;
}
/* nAlreadyEvictedThisRun++; -- for future. */
@@ -984,6 +1004,11 @@
* does not contain targetRef (the sibling we're
* processing) because it was removed before calling
* this method, but it is added to the map below.
+ *
+ * A TreeMap (sorted map) is used so that siblings are
+ * latched in node ID order. A deterministic order is
+ * needed to avoid deadlocks, if siblings are latched
+ * in multiple threads in the future.
*/
siblingsToLog = new TreeMap();
for (int index = 0;
@@ -1037,8 +1062,13 @@
dumpParentChildInfo(result, parent,
targetRef.nodeId,
currentLevel, tree);
- dirtyMap.addDirtyIN
- (parent, true /* updateMemoryBudget */);
+ /*
+ * Add the parent IN to the dirty map unconditionally,
+ * even if not dirty, to cause changes to propogate
+ * upward even when a node has been evicted and
+ * refetched and is no longer dirty. [#16523]
+ */
+ dirtyMap.addIN(parent, true /*updateMemoryBudget*/);
}
} finally {
parent.releaseLatch();
@@ -1075,13 +1105,13 @@
* latch above, since we must search and acquire the
* grandparent latch.
*/
- if (logSubtree && parent.getLevel() <= maxFlushLevel) {
+ if (logSubtree && parentLevel <= maxFlushLevel) {
CheckpointReference parentRef = dirtyMap.removeNode
- (parent.getLevel(), parent.getNodeId());
+ (parentLevel, parent.getNodeId());
if (parentRef != null) {
flushIN
(envImpl, db, logManager, parentRef, dirtyMap,
- parent.getLevel(), maxFlushLevel, allowDeltas,
+ parentLevel, maxFlushLevel, allowDeltas,
checkpointStart, highPriority, fstats,
localTracker, false /*allowLogSubtree*/);
}
@@ -1185,9 +1215,13 @@
/* Remove it from dirty map if it is present. */
dirtyMap.removeNode(child.getLevel(), child.getNodeId());
- /* Latch and add item so we will release the latch below. */
+ /*
+ * Latch and add item with valid parentIndex, so we will
+ * release the latch in the finally statement.
+ */
child.latch(CacheMode.UNCHANGED);
INLogItem item = new INLogItem();
+ item.parentIndex = index;
itemList.add(item);
/*
@@ -1222,7 +1256,6 @@
item.provisional = provisional;
item.repContext = ReplicationContext.NO_REPLICATE;
item.parent = parent;
- item.parentIndex = index;
/*
* Allow child to perform "before log" processing. Note
@@ -1408,6 +1441,7 @@
this.dupTreeKey = dupTreeKey;
}
+ @Override
public boolean equals(Object o) {
if (!(o instanceof CheckpointReference)) {
return false;
@@ -1417,6 +1451,7 @@
return nodeId == other.nodeId;
}
+ @Override
public int hashCode() {
return (int) nodeId;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/CheckpointStart.java libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/CheckpointStart.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/CheckpointStart.java 2008-01-17 17:22:14.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/CheckpointStart.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: CheckpointStart.java,v 1.34 2008/01/17 17:22:13 cwl Exp $
+ * $Id: CheckpointStart.java,v 1.34.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.recovery;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/DirtyINMap.java libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/DirtyINMap.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/DirtyINMap.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/DirtyINMap.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DirtyINMap.java,v 1.17 2008/05/15 01:52:42 linda Exp $
+ * $Id: DirtyINMap.java,v 1.17.2.3 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.recovery;
@@ -86,8 +86,8 @@
continue;
}
- Integer level = addDirtyIN
- (in, false /* updateMemoryBudget */);
+ Integer level =
+ addDirtyIN(in, false /*updateMemoryBudget*/);
if (level != null) {
/*
@@ -172,7 +172,7 @@
if (in.getDatabaseId().equals(dbId)) {
in.latch(CacheMode.UNCHANGED);
try {
- addDirtyIN(in, false /* updateMemoryBudget */);
+ addDirtyIN(in, false /*updateMemoryBudget*/);
} finally {
in.releaseLatch();
}
@@ -208,49 +208,57 @@
}
/**
- * Add a node to the dirty map. The dirty map is keyed by level (Integers)
- * and holds sets of IN references.
+ * Adds the IN if dirty, otherwise returns null. See addIN.
+ */
+ private Integer addDirtyIN(IN in, boolean updateMemoryBudget) {
+
+ if (in.getDirty()) {
+ return addIN(in, updateMemoryBudget);
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * Add a node unconditionally to the dirty map. The dirty map is keyed by
+ * level (Integers) and holds sets of IN references.
*
* @param updateMemoryBudget if true then update the memory budget as the
* map is changed; if false then addCostToMemoryBudget must be called
* later.
*
- * @return level of IN added to the dirty map, or null if the IN was not
- * added to the dirty map. The level is returned rather than a boolean
- * simply to avoid allocating another Integer in the caller.
+ * @return level of IN added to the dirty map. The level is returned
+ * rather than a boolean simply to avoid allocating another Integer in the
+ * caller.
*/
- Integer addDirtyIN(IN in, boolean updateMemoryBudget) {
+ Integer addIN(IN in, boolean updateMemoryBudget) {
- if (in.getDirty()) {
-
- Integer level = Integer.valueOf(in.getLevel());
- Map nodeMap;
- if (levelMap.containsKey(level)) {
- nodeMap = levelMap.get(level);
- } else {
- nodeMap = new HashMap();
- levelMap.put(level, nodeMap);
- }
-
- nodeMap.put(in.getNodeId(),
- new CheckpointReference(in.getDatabase().getId(),
- in.getNodeId(),
- in.containsDuplicates(),
- in.isDbRoot(),
- in.getMainTreeKey(),
- in.getDupTreeKey()));
- numEntries++;
-
- if (updateMemoryBudget) {
- MemoryBudget mb = envImpl.getMemoryBudget();
- mb.updateAdminMemoryUsage
- (MemoryBudget.CHECKPOINT_REFERENCE_SIZE);
- }
-
- return level;
+ Integer level = Integer.valueOf(in.getLevel());
+ Map nodeMap;
+ if (levelMap.containsKey(level)) {
+ nodeMap = levelMap.get(level);
} else {
- return null;
+ nodeMap = new HashMap();
+ levelMap.put(level, nodeMap);
}
+
+ nodeMap.put(in.getNodeId(),
+ new CheckpointReference(in.getDatabase().getId(),
+ in.getNodeId(),
+ in.containsDuplicates(),
+ in.isDbRoot(),
+ in.getMainTreeKey(),
+ in.getDupTreeKey()));
+ numEntries++;
+
+ if (updateMemoryBudget) {
+ MemoryBudget mb = envImpl.getMemoryBudget();
+ mb.updateAdminMemoryUsage
+ (MemoryBudget.CHECKPOINT_REFERENCE_SIZE);
+ }
+
+ return level;
}
/**
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/LevelRecorder.java libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/LevelRecorder.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/LevelRecorder.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/LevelRecorder.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LevelRecorder.java,v 1.7 2008/05/15 01:52:42 linda Exp $
+ * $Id: LevelRecorder.java,v 1.7.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.recovery;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/NoRootException.java libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/NoRootException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/NoRootException.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/NoRootException.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: NoRootException.java,v 1.3 2008/01/07 14:28:52 cwl Exp $
+ * $Id: NoRootException.java,v 1.3.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.recovery;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/RecoveryException.java libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/RecoveryException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/RecoveryException.java 2008-05-20 17:52:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/RecoveryException.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: RecoveryException.java,v 1.19 2008/05/20 17:52:36 linda Exp $
+ * $Id: RecoveryException.java,v 1.19.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.recovery;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/RecoveryInfo.java libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/RecoveryInfo.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/RecoveryInfo.java 2008-01-07 14:28:52.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/RecoveryInfo.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: RecoveryInfo.java,v 1.30 2008/01/07 14:28:52 cwl Exp $
+ * $Id: RecoveryInfo.java,v 1.31.2.2 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.recovery;
@@ -63,6 +63,7 @@
/* VLSN mappings seen during recovery processing, for replication. */
public Collection fileMappers = new HashSet();
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("Recovery Info");
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/RecoveryManager.java libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/RecoveryManager.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/recovery/RecoveryManager.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/recovery/RecoveryManager.java 2010-01-04 15:30:32.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: RecoveryManager.java,v 1.241 2008/05/15 01:52:42 linda Exp $
+ * $Id: RecoveryManager.java,v 1.242.2.5 2010/01/04 15:30:32 cwl Exp $
*/
package com.sleepycat.je.recovery;
@@ -52,6 +52,7 @@
import com.sleepycat.je.tree.TreeLocation;
import com.sleepycat.je.tree.WithRootLatched;
import com.sleepycat.je.txn.BasicLocker;
+import com.sleepycat.je.txn.LockResult;
import com.sleepycat.je.txn.LockType;
import com.sleepycat.je.txn.PreparedTxn;
import com.sleepycat.je.txn.Txn;
@@ -1195,9 +1196,12 @@
* there was a write lock on this LN since
* it exists in the log under this txnId.
*/
- preparedTxn.lock
+ LockResult lockResult = preparedTxn.lock
(ln.getNodeId(), LockType.WRITE,
false /*noWait*/, db);
+ lockResult.setAbortLsn
+ (reader.getAbortLsn(),
+ reader.getAbortKnownDeleted());
}
treeLsn = redo(db,
@@ -1236,21 +1240,22 @@
mapLN.getDatabase().countObsoleteDb
(tracker, logLsn);
}
- }
- /* Redo utilization info. */
- TxnNodeId txnNodeId = null;
- if (txnId != null) {
- txnNodeId = new TxnNodeId(reader.getNodeId(),
- txnId.longValue());
+ /* Redo utilization info. */
+ TxnNodeId txnNodeId = null;
+ if (txnId != null) {
+ txnNodeId = new TxnNodeId
+ (reader.getNodeId(),
+ txnId.longValue());
+ }
+ redoUtilizationInfo
+ (logLsn, treeLsn, commitLsn,
+ reader.getAbortLsn(),
+ reader.getAbortKnownDeleted(),
+ reader.getLastEntrySize(),
+ reader.getKey(),
+ ln, db, txnNodeId, countedAbortLsnNodes);
}
- redoUtilizationInfo(logLsn, treeLsn, commitLsn,
- reader.getAbortLsn(),
- reader.getAbortKnownDeleted(),
- reader.getLastEntrySize(),
- reader.getKey(),
- ln, db, txnNodeId,
- countedAbortLsnNodes);
} finally {
dbMapTree.releaseDb(db);
}
@@ -1307,6 +1312,7 @@
/**
* Compare two TxnNodeId objects
*/
+ @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -1320,6 +1326,7 @@
(((TxnNodeId) obj).nodeId == nodeId));
}
+ @Override
public int hashCode() {
return (int) (txnId + nodeId);
}
@@ -2269,11 +2276,14 @@
/*
* If the LN is marked deleted and its LSN follows the FileSummaryLN
* for its file, count it as obsolete.
+ *
+ * Inexact counting is used to save resources because the cleaner knows
+ * that all deleted LNs are obsolete.
*/
if (ln.isDeleted()) {
tracker.countObsoleteIfUncounted
(logLsn, logLsn, null, logEntrySize, db.getId(),
- true /*countExact*/);
+ false /*countExact*/);
}
/* Was the LN found in the tree? */
@@ -2284,6 +2294,12 @@
* If the oldLsn and newLsn differ and the newLsn follows the
* FileSummaryLN for the file of the oldLsn, count the oldLsn as
* obsolete.
+ *
+ * Use exact counting only if the transaction is committed. A
+ * prepared or resurrected transaction may be committed or aborted
+ * later on. We perform obsolete counting as if a commit will
+ * occur to ensure cleaning will occur, but we count inexact to
+ * prevent LogFileNotFound in case an abort occurs. [#17022]
*/
if (cmpLogLsnToTreeLsn != 0) {
long newLsn = (cmpLogLsnToTreeLsn < 0) ? treeLsn : logLsn;
@@ -2292,7 +2308,7 @@
tracker.countObsoleteIfUncounted
(oldLsn, newLsn, null,
tracker.fetchLNSize(oldSize, oldLsn), db.getId(),
- true /*countExact*/);
+ commitLsn != DbLsn.NULL_LSN /*countExact*/);
}
/*
@@ -2314,13 +2330,17 @@
* The abortLsn is only an approximation of the prior LSN, so
* use inexact counting. Since this is relatively rare, a zero
* entry size (use average size) is acceptable.
+ *
+ * Note that commitLsn may be null if this is a prepared or
+ * resurrected HA Txn. [#16375]
*/
- assert commitLsn != DbLsn.NULL_LSN;
- tracker.countObsoleteIfUncounted
- (abortLsn, commitLsn, null, 0, db.getId(),
- false /*countExact*/);
- /* Don't count this abortLsn (this node) again. */
- countedAbortLsnNodes.add(txnNodeId);
+ if (commitLsn != DbLsn.NULL_LSN) {
+ tracker.countObsoleteIfUncounted
+ (abortLsn, commitLsn, null, 0, db.getId(),
+ false /*countExact*/);
+ /* Don't count this abortLsn (this node) again. */
+ countedAbortLsnNodes.add(txnNodeId);
+ }
}
}
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/ReplicaConsistencyPolicy.java libdb-je-java-3.3.98/src/com/sleepycat/je/ReplicaConsistencyPolicy.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/ReplicaConsistencyPolicy.java 2008-05-13 20:03:10.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/ReplicaConsistencyPolicy.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,13 +1,15 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ReplicaConsistencyPolicy.java,v 1.1 2008/05/13 20:03:09 sam Exp $
+ * $Id: ReplicaConsistencyPolicy.java,v 1.3.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
+import com.sleepycat.je.dbi.ReplicatorInstance;
+
/**
* @hidden
* Feature not yet available.
@@ -19,4 +21,11 @@
*/
public interface ReplicaConsistencyPolicy {
+ /**
+ * Ensures that the replica is within the constraints specified by this
+ * policy. If it isn't the method waits until the constraint is satisfied
+ * by the replica.
+ */
+ public void ensureConsistency(ReplicatorInstance repInstance)
+ throws InterruptedException, DatabaseException;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/RunRecoveryException.java libdb-je-java-3.3.98/src/com/sleepycat/je/RunRecoveryException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/RunRecoveryException.java 2008-05-29 03:38:24.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/RunRecoveryException.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: RunRecoveryException.java,v 1.24 2008/05/29 03:38:23 linda Exp $
+ * $Id: RunRecoveryException.java,v 1.25.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -62,6 +62,7 @@
this.alreadyThrown = alreadyThrown;
}
+ @Override
public String toString() {
if (alreadyThrown) {
return "Environment invalid because of previous exception: " +
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/SecondaryConfig.java libdb-je-java-3.3.98/src/com/sleepycat/je/SecondaryConfig.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/SecondaryConfig.java 2008-02-08 03:22:38.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/SecondaryConfig.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SecondaryConfig.java,v 1.23 2008/02/08 03:22:38 mark Exp $
+ * $Id: SecondaryConfig.java,v 1.25.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -374,6 +374,7 @@
/*
* For JCA Database handle caching.
*/
+ @Override
void validate(DatabaseConfig configArg)
throws DatabaseException {
@@ -464,4 +465,22 @@
return ret.toString();
}
+
+ /**
+ * Returns the values for each configuration attribute.
+ *
+ * @return the values for each configuration attribute.
+ */
+ @Override
+ public String toString() {
+ return "keyCreator=" + keyCreator +
+ "\nmultiKeyCreator=" + multiKeyCreator +
+ "\nallowPopulate=" + allowPopulate +
+ "\nforeignKeyDatabase=" + foreignKeyDatabase +
+ "\nforeignKeyDeleteAction=" + foreignKeyDeleteAction +
+ "\nforeignKeyNullifier=" + foreignKeyNullifier +
+ "\nforeignMultiKeyNullifier=" + foreignMultiKeyNullifier +
+ "\nimmutableSecondaryKey=" + immutableSecondaryKey +
+ "\n";
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/SecondaryCursor.java libdb-je-java-3.3.98/src/com/sleepycat/je/SecondaryCursor.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/SecondaryCursor.java 2008-05-19 17:52:16.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/SecondaryCursor.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SecondaryCursor.java,v 1.44 2008/05/19 17:52:16 linda Exp $
+ * $Id: SecondaryCursor.java,v 1.45.2.3 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -113,10 +113,11 @@
* Returns a new SecondaryCursor for the same transaction as
* the original cursor.
*/
+ @Override
public Cursor dup(boolean samePosition)
throws DatabaseException {
- checkState(true);
+ checkState(false);
return new SecondaryCursor(this, samePosition);
}
@@ -146,6 +147,7 @@
* cursor functions expecting the cursor to refer to an existing key will
* fail.
*/
+ @Override
public OperationStatus delete()
throws DatabaseException {
@@ -176,6 +178,7 @@
* UnsupportedOperationException} will always be thrown by this method.
* The corresponding method on the primary database should be used instead.
*/
+ @Override
public OperationStatus put(DatabaseEntry key, DatabaseEntry data)
throws DatabaseException {
@@ -187,6 +190,7 @@
* UnsupportedOperationException} will always be thrown by this method.
* The corresponding method on the primary database should be used instead.
*/
+ @Override
public OperationStatus putNoOverwrite(DatabaseEntry key,
DatabaseEntry data)
throws DatabaseException {
@@ -199,6 +203,7 @@
* UnsupportedOperationException} will always be thrown by this method.
* The corresponding method on the primary database should be used instead.
*/
+ @Override
public OperationStatus putNoDupData(DatabaseEntry key, DatabaseEntry data)
throws DatabaseException {
@@ -210,6 +215,7 @@
* UnsupportedOperationException} will always be thrown by this method.
* The corresponding method on the primary database should be used instead.
*/
+ @Override
public OperationStatus putCurrent(DatabaseEntry data)
throws DatabaseException {
@@ -246,6 +252,7 @@
* deleted; otherwise, {@link com.sleepycat.je.OperationStatus#SUCCESS
* OperationStatus.SUCCESS}.
*/
+ @Override
public OperationStatus getCurrent(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
@@ -329,6 +336,7 @@
* otherwise, {@link com.sleepycat.je.OperationStatus#SUCCESS
* OperationStatus.SUCCESS}.
*/
+ @Override
public OperationStatus getFirst(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
@@ -417,6 +425,7 @@
* otherwise, {@link com.sleepycat.je.OperationStatus#SUCCESS
* OperationStatus.SUCCESS}.
*/
+ @Override
public OperationStatus getLast(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
@@ -511,6 +520,7 @@
* otherwise, {@link com.sleepycat.je.OperationStatus#SUCCESS
* OperationStatus.SUCCESS}.
*/
+ @Override
public OperationStatus getNext(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
@@ -609,6 +619,7 @@
* otherwise, {@link com.sleepycat.je.OperationStatus#SUCCESS
* OperationStatus.SUCCESS}.
*/
+ @Override
public OperationStatus getNextDup(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
@@ -702,6 +713,7 @@
* otherwise, {@link com.sleepycat.je.OperationStatus#SUCCESS
* OperationStatus.SUCCESS}.
*/
+ @Override
public OperationStatus getNextNoDup(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
@@ -807,6 +819,7 @@
* otherwise, {@link com.sleepycat.je.OperationStatus#SUCCESS
* OperationStatus.SUCCESS}.
*/
+ @Override
public OperationStatus getPrev(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
@@ -905,6 +918,7 @@
* otherwise, {@link com.sleepycat.je.OperationStatus#SUCCESS
* OperationStatus.SUCCESS}.
*/
+ @Override
public OperationStatus getPrevDup(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
@@ -998,6 +1012,7 @@
* otherwise, {@link com.sleepycat.je.OperationStatus#SUCCESS
* OperationStatus.SUCCESS}.
*/
+ @Override
public OperationStatus getPrevNoDup(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
@@ -1096,6 +1111,7 @@
* otherwise, {@link com.sleepycat.je.OperationStatus#SUCCESS
* OperationStatus.SUCCESS}.
*/
+ @Override
public OperationStatus getSearchKey(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
@@ -1192,6 +1208,7 @@
* otherwise, {@link com.sleepycat.je.OperationStatus#SUCCESS
* OperationStatus.SUCCESS}.
*/
+ @Override
public OperationStatus getSearchKeyRange(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
@@ -1262,6 +1279,7 @@
* The corresponding method with the pKey parameter should be
* used instead.
*/
+ @Override
public OperationStatus getSearchBoth(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
@@ -1326,6 +1344,7 @@
* The corresponding method with the pKey parameter should be
* used instead.
*/
+ @Override
public OperationStatus getSearchBothRange(DatabaseEntry key,
DatabaseEntry data,
LockMode lockMode)
@@ -1570,7 +1589,7 @@
* secondary key. If it has been, return KEYEMPTY.
*/
if (readUncommitted) {
- SecondaryConfig config =
+ SecondaryConfig conf =
secondaryDb.getPrivateSecondaryConfig();
/*
@@ -1578,28 +1597,28 @@
* null (the database is read only), then we can skip this
* check.
*/
- if (config.getImmutableSecondaryKey()) {
+ if (conf.getImmutableSecondaryKey()) {
/* Do nothing. */
- } else if (config.getKeyCreator() != null) {
+ } else if (conf.getKeyCreator() != null) {
/*
* Check that the key we're using is equal to the key
* returned by the key creator.
*/
DatabaseEntry secKey = new DatabaseEntry();
- if (!config.getKeyCreator().createSecondaryKey
+ if (!conf.getKeyCreator().createSecondaryKey
(secondaryDb, pKey, data, secKey) ||
!secKey.equals(key)) {
return OperationStatus.KEYEMPTY;
}
- } else if (config.getMultiKeyCreator() != null) {
+ } else if (conf.getMultiKeyCreator() != null) {
/*
* Check that the key we're using is in the set returned by
* the key creator.
*/
Set results = new HashSet();
- config.getMultiKeyCreator().createSecondaryKeys
+ conf.getMultiKeyCreator().createSecondaryKeys
(secondaryDb, pKey, data, results);
if (!results.contains(key)) {
return OperationStatus.KEYEMPTY;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/SecondaryDatabase.java libdb-je-java-3.3.98/src/com/sleepycat/je/SecondaryDatabase.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/SecondaryDatabase.java 2008-03-18 16:53:04.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/SecondaryDatabase.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SecondaryDatabase.java,v 1.61 2008/03/18 15:53:04 mark Exp $
+ * $Id: SecondaryDatabase.java,v 1.62.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -161,6 +161,7 @@
/**
* Create a database, called by Environment
*/
+ @Override
void initNew(Environment env,
Locker locker,
String databaseName,
@@ -174,6 +175,7 @@
/**
* Open a database, called by Environment
*/
+ @Override
void initExisting(Environment env,
Locker locker,
DatabaseImpl database,
@@ -357,6 +359,7 @@
/**
* Overrides Database method.
*/
+ @Override
Cursor newDbcInstance(Transaction txn,
CursorConfig cursorConfig)
throws DatabaseException {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/SecondaryKeyCreator.java libdb-je-java-3.3.98/src/com/sleepycat/je/SecondaryKeyCreator.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/SecondaryKeyCreator.java 2008-01-07 14:28:46.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/SecondaryKeyCreator.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SecondaryKeyCreator.java,v 1.13 2008/01/07 14:28:46 cwl Exp $
+ * $Id: SecondaryKeyCreator.java,v 1.13.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/SecondaryMultiKeyCreator.java libdb-je-java-3.3.98/src/com/sleepycat/je/SecondaryMultiKeyCreator.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/SecondaryMultiKeyCreator.java 2008-05-27 15:30:34.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/SecondaryMultiKeyCreator.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SecondaryMultiKeyCreator.java,v 1.9 2008/05/27 15:30:34 mark Exp $
+ * $Id: SecondaryMultiKeyCreator.java,v 1.9.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/SecondaryTrigger.java libdb-je-java-3.3.98/src/com/sleepycat/je/SecondaryTrigger.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/SecondaryTrigger.java 2008-01-07 14:28:46.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/SecondaryTrigger.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SecondaryTrigger.java,v 1.14 2008/01/07 14:28:46 cwl Exp $
+ * $Id: SecondaryTrigger.java,v 1.14.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/SequenceConfig.java libdb-je-java-3.3.98/src/com/sleepycat/je/SequenceConfig.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/SequenceConfig.java 2008-01-07 14:28:46.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/SequenceConfig.java 2008-06-10 00:21:30.000000000 +0000
@@ -3,7 +3,7 @@
*
* Copyright (c) 2005,2008 Oracle. All rights reserved.
*
- * $Id: SequenceConfig.java,v 1.10 2008/01/07 14:28:46 cwl Exp $
+ * $Id: SequenceConfig.java,v 1.11 2008/06/10 00:21:30 cwl Exp $
*/
package com.sleepycat.je;
@@ -271,4 +271,23 @@
public boolean getWrap() {
return wrap;
}
+
+ /**
+ * Returns the values for each configuration attribute.
+ *
+ * @return the values for each configuration attribute.
+ */
+ @Override
+ public String toString() {
+ return "allowCreate=" + allowCreate +
+ "\ncacheSize=" + cacheSize +
+ "\ndecrement=" + decrement +
+ "\nexclusiveCreate=" + exclusiveCreate +
+ "\ninitialValue=" + initialValue +
+ "\nautoCommitNoSync=" + autoCommitNoSync +
+ "\nrangeMin=" + rangeMin +
+ "\nrangeMax=" + rangeMax +
+ "\nwrap=" + wrap +
+ "\n";
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/SequenceStats.java libdb-je-java-3.3.98/src/com/sleepycat/je/SequenceStats.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/SequenceStats.java 2008-01-07 14:28:46.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/SequenceStats.java 2008-06-10 02:52:08.000000000 +0000
@@ -3,7 +3,7 @@
*
* Copyright (c) 2005,2008 Oracle. All rights reserved.
*
- * $Id: SequenceStats.java,v 1.8 2008/01/07 14:28:46 cwl Exp $
+ * $Id: SequenceStats.java,v 1.9 2008/06/10 02:52:08 cwl Exp $
*/
package com.sleepycat.je;
@@ -115,6 +115,7 @@
return cacheSize;
}
+ @Override
public String toString() {
return "nGets=" + nGets
+ "\nnCachedGets=" + nCachedGets
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/StatsConfig.java libdb-je-java-3.3.98/src/com/sleepycat/je/StatsConfig.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/StatsConfig.java 2008-01-24 14:59:28.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/StatsConfig.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: StatsConfig.java,v 1.18 2008/01/24 14:59:27 linda Exp $
+ * $Id: StatsConfig.java,v 1.19.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -113,4 +113,18 @@
public int getShowProgressInterval() {
return showProgressInterval;
}
+
+ /**
+ * Returns the values for each configuration attribute.
+ *
+ * @return the values for each configuration attribute.
+ */
+ @Override
+ public String toString() {
+ return "fast=" + fast +
+ "\nclear=" + clear +
+ "\nshowProgressStream=" + showProgressStream +
+ "\nshowProgressInterval=" + showProgressInterval +
+ "\n";
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/TransactionConfig.java libdb-je-java-3.3.98/src/com/sleepycat/je/TransactionConfig.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/TransactionConfig.java 2008-05-28 14:46:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/TransactionConfig.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: TransactionConfig.java,v 1.23 2008/05/28 14:46:42 linda Exp $
+ * $Id: TransactionConfig.java,v 1.24.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -33,8 +33,6 @@
private boolean readCommitted = false;
private boolean serializableIsolation = false;
-
-
/* Convenience constants for local (non-replicated) use. */
/**
@@ -454,4 +452,23 @@
" supported");
}
}
+
+ /**
+ * Returns the values for each configuration attribute.
+ *
+ * @return the values for each configuration attribute.
+ */
+ @Override
+ public String toString() {
+ return "sync=" + sync +
+ "\nnoSync=" + noSync +
+ "\nwriteNoSync=" + writeNoSync +
+ "\ndurability=" + durability +
+ "\nconsistencyPolicy=" + consistencyPolicy +
+ "\nnoWait=" + noWait +
+ "\nreadUncommitted=" + readUncommitted +
+ "\nreadCommitted=" + readCommitted +
+ "\nSerializableIsolation=" + serializableIsolation +
+ "\n";
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/Transaction.java libdb-je-java-3.3.98/src/com/sleepycat/je/Transaction.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/Transaction.java 2008-05-29 03:38:24.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/Transaction.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Transaction.java,v 1.59 2008/05/29 03:38:23 linda Exp $
+ * $Id: Transaction.java,v 1.60.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -168,6 +168,7 @@
*/
public void commit(Durability durability)
throws DatabaseException {
+
doCommit(durability, false /* explicitSync */);
}
@@ -387,6 +388,7 @@
* @hidden
* For internal use.
*/
+ @Override
public int hashCode() {
return (int) id;
}
@@ -395,6 +397,7 @@
* @hidden
* For internal use.
*/
+ @Override
public boolean equals(Object o) {
if (o == null) {
return false;
@@ -411,6 +414,7 @@
return false;
}
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(" getKeyComparator() {
return getDatabase().getBtreeComparator();
}
+ @Override
public String beginTag() {
return BEGIN_TAG;
}
+ @Override
public String endTag() {
return END_TAG;
}
@@ -1080,6 +1126,7 @@
/**
* @see IN.logDirtyChildren();
*/
+ @Override
public void logDirtyChildren()
throws DatabaseException {
@@ -1118,10 +1165,12 @@
/**
* @see Node#getLogType
*/
+ @Override
public LogEntryType getLogType() {
return LogEntryType.LOG_BIN;
}
+ @Override
public String shortClassName() {
return "BIN";
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/BINReference.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/BINReference.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/BINReference.java 2008-05-15 01:52:42.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/BINReference.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: BINReference.java,v 1.22 2008/05/15 01:52:42 linda Exp $
+ * $Id: BINReference.java,v 1.23.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
@@ -95,6 +95,7 @@
/**
* Compare two BINReferences.
*/
+ @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -107,10 +108,12 @@
return ((BINReference) obj).nodeId == nodeId;
}
+ @Override
public int hashCode() {
return (int) nodeId;
}
+ @Override
public String toString() {
return "idKey=" + Key.getNoFormatString(idKey) +
" nodeId = " + nodeId +
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/ChildReference.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/ChildReference.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/ChildReference.java 2008-01-17 17:22:14.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/ChildReference.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ChildReference.java,v 1.109 2008/01/17 17:22:13 cwl Exp $
+ * $Id: ChildReference.java,v 1.110.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
@@ -364,6 +364,7 @@
return sb.toString();
}
+ @Override
public String toString() {
return dumpString(0, false);
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/CursorsExistException.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/CursorsExistException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/CursorsExistException.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/CursorsExistException.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: CursorsExistException.java,v 1.9 2008/01/07 14:28:56 cwl Exp $
+ * $Id: CursorsExistException.java,v 1.9.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/DBIN.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/DBIN.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/DBIN.java 2008-05-20 14:51:50.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/DBIN.java 2010-03-26 13:23:56.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DBIN.java,v 1.81 2008/05/20 14:51:49 cwl Exp $
+ * $Id: DBIN.java,v 1.82.2.3 2010/03/26 13:23:55 mark Exp $
*/
package com.sleepycat.je.tree;
@@ -52,6 +52,7 @@
* Create a new DBIN. Need this because we can't call newInstance()
* without getting a 0 node.
*/
+ @Override
protected IN createNewInstance(byte[] identifierKey,
int maxEntries,
int level) {
@@ -67,11 +68,18 @@
* "always exclusive" variety. Presently, only IN's are actually latched
* shared. BINs, DINs, and DBINs are all latched exclusive only.
*/
+ @Override
boolean isAlwaysLatchedExclusively() {
return true;
}
+ @Override
+ boolean isBottomMostNode() {
+ return true;
+ }
+
/* Duplicates have no mask on their levels. */
+ @Override
protected int generateLevel(DatabaseId dbId, int newLevel) {
return newLevel;
}
@@ -80,6 +88,7 @@
* Return the comparator function to be used for DBINs. This is
* the user defined duplicate comparison function, if defined.
*/
+ @Override
public final Comparator getKeyComparator() {
return getDatabase().getDuplicateComparator();
}
@@ -87,6 +96,7 @@
/**
* Return the key for this duplicate set.
*/
+ @Override
public byte[] getDupKey() {
return dupKey;
}
@@ -95,6 +105,7 @@
* Get the key (dupe or identifier) in child that is used to locate
* it in 'this' node.
*/
+ @Override
public byte[] getChildKey(IN child)
throws DatabaseException {
@@ -104,6 +115,7 @@
/*
* A DBIN uses the dupTree key in its searches.
*/
+ @Override
public byte[] selectKey(byte[] mainTreeKey, byte[] dupTreeKey) {
return dupTreeKey;
}
@@ -111,6 +123,7 @@
/**
* Return the key for navigating through the duplicate tree.
*/
+ @Override
public byte[] getDupTreeKey() {
return getIdentifierKey();
}
@@ -118,6 +131,7 @@
/**
* Return the key for navigating through the main tree.
*/
+ @Override
public byte[] getMainTreeKey() {
return dupKey;
}
@@ -126,6 +140,7 @@
* @return true if this node is a duplicate-bearing node type, false
* if otherwise.
*/
+ @Override
public boolean containsDuplicates() {
return true;
}
@@ -133,10 +148,12 @@
/**
* @return the log entry type to use for bin delta log entries.
*/
+ @Override
LogEntryType getBINDeltaType() {
return LogEntryType.LOG_DUP_BIN_DELTA;
}
+ @Override
public BINReference createReference() {
return new DBINReference(getNodeId(), getDatabase().getId(),
getIdentifierKey(), dupKey);
@@ -145,6 +162,7 @@
/**
* Count up the memory usage attributable to this node alone.
*/
+ @Override
protected long computeMemorySize() {
long size = super.computeMemorySize();
return size;
@@ -162,6 +180,7 @@
IN.computeArraysOverhead(configManager);
}
+ @Override
protected long getMemoryOverhead(MemoryBudget mb) {
return mb.getDBINOverhead();
}
@@ -169,6 +188,7 @@
/*
* A DBIN cannot be the ancestor of any IN.
*/
+ @Override
protected boolean canBeAncestor(boolean targetContainsDuplicates) {
return false;
}
@@ -190,22 +210,27 @@
* used. For DBIN's, the CursorImpl.dupIndex and CursorImpl.dupBin
* fields should be used.
*/
+ @Override
BIN getCursorBIN(CursorImpl cursor) {
return cursor.getDupBIN();
}
+ @Override
BIN getCursorBINToBeRemoved(CursorImpl cursor) {
return cursor.getDupBINToBeRemoved();
}
+ @Override
int getCursorIndex(CursorImpl cursor) {
return cursor.getDupIndex();
}
+ @Override
void setCursorBIN(CursorImpl cursor, BIN bin) {
cursor.setDupBIN((DBIN) bin);
}
+ @Override
void setCursorIndex(CursorImpl cursor, int index) {
cursor.setDupIndex(index);
}
@@ -217,6 +242,7 @@
*
* No latching is performed.
*/
+ @Override
boolean matchLNByNodeId(TreeLocation location,
long nodeId,
CacheMode cacheMode)
@@ -246,14 +272,17 @@
/*
* DbStat support.
*/
+ @Override
void accumulateStats(TreeWalkerStatsAccumulator acc) {
acc.processDBIN(this, Long.valueOf(getNodeId()), getLevel());
}
+ @Override
public String beginTag() {
return BEGIN_TAG;
}
+ @Override
public String endTag() {
return END_TAG;
}
@@ -262,6 +291,7 @@
* For unit test support:
* @return a string that dumps information about this IN, without
*/
+ @Override
public String dumpString(int nSpaces, boolean dumpTags) {
StringBuffer sb = new StringBuffer();
sb.append(TreeUtils.indent(nSpaces));
@@ -284,6 +314,7 @@
/**
* @see Node#getLogType()
*/
+ @Override
public LogEntryType getLogType() {
return LogEntryType.LOG_DBIN;
}
@@ -295,6 +326,7 @@
/**
* @see Loggable#getLogSize
*/
+ @Override
public int getLogSize() {
int size = super.getLogSize(); // ancestors
size += LogUtils.getByteArrayLogSize(dupKey); // identifier key
@@ -304,6 +336,7 @@
/**
* @see Loggable#writeToLog
*/
+ @Override
public void writeToLog(ByteBuffer logBuffer) {
super.writeToLog(logBuffer);
@@ -313,6 +346,7 @@
/**
* @see BIN#readFromLog
*/
+ @Override
public void readFromLog(ByteBuffer itemBuffer, byte entryVersion)
throws LogException {
@@ -323,11 +357,13 @@
/**
* DBINS need to dump their dup key
*/
+ @Override
protected void dumpLogAdditional(StringBuffer sb) {
super.dumpLogAdditional(sb);
sb.append(Key.dumpString(dupKey, 0));
}
+ @Override
public String shortClassName() {
return "DBIN";
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/DBINReference.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/DBINReference.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/DBINReference.java 2008-05-13 01:44:54.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/DBINReference.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DBINReference.java,v 1.18 2008/05/13 01:44:53 cwl Exp $
+ * $Id: DBINReference.java,v 1.19.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
@@ -25,14 +25,17 @@
this.dupKey = dupKey;
}
+ @Override
public byte[] getKey() {
return dupKey;
}
+ @Override
public byte[] getData() {
return idKey;
}
+ @Override
public String toString() {
return super.toString() + " dupKey=" + Key.dumpString(dupKey, 0);
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/DeltaInfo.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/DeltaInfo.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/DeltaInfo.java 2008-01-17 17:22:14.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/DeltaInfo.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DeltaInfo.java,v 1.27 2008/01/17 17:22:13 cwl Exp $
+ * $Id: DeltaInfo.java,v 1.27.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/DIN.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/DIN.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/DIN.java 2008-05-20 14:52:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/DIN.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DIN.java,v 1.99 2008/05/20 14:52:00 cwl Exp $
+ * $Id: DIN.java,v 1.100.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
@@ -72,6 +72,7 @@
}
/* Duplicates have no mask on their levels. */
+ @Override
protected int generateLevel(DatabaseId dbId, int newLevel) {
return newLevel;
}
@@ -80,6 +81,7 @@
* Create a new DIN. Need this because we can't call newInstance()
* without getting a 0 node.
*/
+ @Override
protected IN createNewInstance(byte[] identifierKey,
int maxEntries,
int level) {
@@ -96,6 +98,7 @@
* "always exclusive" variety. Presently, only IN's are actually latched
* shared. BINs, DINs, and DBINs are all latched exclusive only.
*/
+ @Override
boolean isAlwaysLatchedExclusively() {
return true;
}
@@ -103,6 +106,7 @@
/**
* Return the key for this duplicate set.
*/
+ @Override
public byte[] getDupKey() {
return dupKey;
}
@@ -111,6 +115,7 @@
* Get the key (dupe or identifier) in child that is used to locate
* it in 'this' node.
*/
+ @Override
public byte[] getChildKey(IN child)
throws DatabaseException {
@@ -120,6 +125,7 @@
/*
* A DIN uses the dupTree key in its searches.
*/
+ @Override
public byte[] selectKey(byte[] mainTreeKey, byte[] dupTreeKey) {
return dupTreeKey;
}
@@ -127,6 +133,7 @@
/**
* Return the key for navigating through the duplicate tree.
*/
+ @Override
public byte[] getDupTreeKey() {
return getIdentifierKey();
}
@@ -134,6 +141,7 @@
/**
* Return the key for navigating through the main tree.
*/
+ @Override
public byte[] getMainTreeKey() {
return dupKey;
}
@@ -202,11 +210,13 @@
* @return true if this node is a duplicate-bearing node type, false
* if otherwise.
*/
+ @Override
public boolean containsDuplicates() {
return true;
}
/* Never true for a DIN. */
+ @Override
public boolean isDbRoot() {
return false;
}
@@ -215,6 +225,7 @@
* Return the comparator function to be used for DINs. This is
* the user defined duplicate comparison function, if defined.
*/
+ @Override
public final Comparator getKeyComparator() {
return getDatabase().getDuplicateComparator();
}
@@ -254,6 +265,7 @@
* are counted by their BIN/DIN parents, but INs are not counted by
* their parents because they are resident on the IN list.
*/
+ @Override
protected long computeMemorySize() {
long size = super.computeMemorySize();
if (dupCountLNRef != null) {
@@ -275,6 +287,7 @@
IN.computeArraysOverhead(configManager);
}
+ @Override
protected long getMemoryOverhead(MemoryBudget mb) {
return mb.getDINOverhead();
}
@@ -286,6 +299,7 @@
*
* No latching is performed.
*/
+ @Override
boolean matchLNByNodeId(TreeLocation location,
long nodeId,
CacheMode cacheMode)
@@ -313,6 +327,7 @@
/*
* DbStat support.
*/
+ @Override
void accumulateStats(TreeWalkerStatsAccumulator acc) {
acc.processDIN(this, Long.valueOf(getNodeId()), getLevel());
}
@@ -324,6 +339,7 @@
/**
* @see Node#getLogType
*/
+ @Override
public LogEntryType getLogType() {
return LogEntryType.LOG_DIN;
}
@@ -370,6 +386,7 @@
/**
* @see IN#getLogSize
*/
+ @Override
public int getLogSize() {
int size = super.getLogSize(); // ancestors
size += LogUtils.getByteArrayLogSize(dupKey);// identifier key
@@ -383,6 +400,7 @@
/**
* @see IN#writeToLog
*/
+ @Override
public void writeToLog(ByteBuffer logBuffer) {
// ancestors
@@ -403,6 +421,7 @@
/**
* @see IN#readFromLog
*/
+ @Override
public void readFromLog(ByteBuffer itemBuffer, byte entryVersion)
throws LogException {
@@ -424,6 +443,7 @@
/**
* DINS need to dump their dup key
*/
+ @Override
protected void dumpLogAdditional(StringBuffer sb) {
super.dumpLogAdditional(sb);
sb.append(Key.dumpString(dupKey, 0));
@@ -436,10 +456,12 @@
* Dumping
*/
+ @Override
public String beginTag() {
return BEGIN_TAG;
}
+ @Override
public String endTag() {
return END_TAG;
}
@@ -448,6 +470,7 @@
* For unit test support:
* @return a string that dumps information about this DIN, without
*/
+ @Override
public String dumpString(int nSpaces, boolean dumpTags) {
StringBuffer sb = new StringBuffer();
if (dumpTags) {
@@ -478,10 +501,12 @@
return sb.toString();
}
+ @Override
public String toString() {
return dumpString(0, true);
}
+ @Override
public String shortClassName() {
return "DIN";
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/DupCountLN.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/DupCountLN.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/DupCountLN.java 2008-05-13 01:44:54.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/DupCountLN.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DupCountLN.java,v 1.40 2008/05/13 01:44:53 cwl Exp $
+ * $Id: DupCountLN.java,v 1.40.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/DuplicateEntryException.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/DuplicateEntryException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/DuplicateEntryException.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/DuplicateEntryException.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DuplicateEntryException.java,v 1.15 2008/01/07 14:28:56 cwl Exp $
+ * $Id: DuplicateEntryException.java,v 1.15.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/FileSummaryLN.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/FileSummaryLN.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/FileSummaryLN.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/FileSummaryLN.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: FileSummaryLN.java,v 1.33 2008/01/07 14:28:56 cwl Exp $
+ * $Id: FileSummaryLN.java,v 1.34.2.3 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
@@ -76,7 +76,7 @@
private static final String BEGIN_TAG = "";
private static final String END_TAG = "";
- private MemoryBudget memBudget;
+ private int extraMarshaledMemorySize;
private FileSummary baseSummary;
private TrackedFileSummary trackedSummary;
private PackedOffsets obsoleteOffsets;
@@ -91,7 +91,6 @@
super(new byte[0],
envImpl, // envImpl
false); // replicate
- memBudget = envImpl.getMemoryBudget();
assert baseSummary != null;
this.baseSummary = baseSummary;
obsoleteOffsets = new PackedOffsets();
@@ -238,13 +237,12 @@
* contains version 1 offsets that can be incorrect when RMW was used, and
* if je.cleaner.rmwFix is enabled, discard the offsets. [#13158]
*/
+ @Override
public void postFetchInit(DatabaseImpl db, long sourceLsn)
throws DatabaseException {
super.postFetchInit(db, sourceLsn);
- memBudget = db.getDbEnvironment().getMemoryBudget();
-
if (entryVersion == 1 &&
db.getDbEnvironment().getUtilizationProfile().isRMWFixEnabled()) {
obsoleteOffsets = new PackedOffsets();
@@ -255,18 +253,22 @@
* Dumping
*/
+ @Override
public String toString() {
return dumpString(0, true);
}
+ @Override
public String beginTag() {
return BEGIN_TAG;
}
+ @Override
public String endTag() {
return END_TAG;
}
+ @Override
public String dumpString(int nSpaces, boolean dumpTags) {
StringBuffer sb = new StringBuffer();
sb.append(super.dumpString(nSpaces, dumpTags));
@@ -282,6 +284,7 @@
* Dump additional fields. Done this way so the additional info can
* be within the XML tags defining the dumped log entry.
*/
+ @Override
protected void dumpLogAdditional(StringBuffer sb, boolean verbose) {
if (!isDeleted()) {
baseSummary.dumpLog(sb, true);
@@ -298,6 +301,7 @@
/**
* Log type for transactional entries.
*/
+ @Override
protected LogEntryType getTransactionalLogType() {
assert false : "Txnl access to UP db not allowed";
return LogEntryType.LOG_FILESUMMARYLN;
@@ -306,6 +310,7 @@
/**
* @see Node#getLogType
*/
+ @Override
public LogEntryType getLogType() {
return LogEntryType.LOG_FILESUMMARYLN;
}
@@ -318,6 +323,7 @@
*
* @see LN#getLogSize
*/
+ @Override
public int getLogSize() {
int size = super.getLogSize();
if (!isDeleted()) {
@@ -331,6 +337,7 @@
/**
* @see LN#writeToLog
*/
+ @Override
public void writeToLog(ByteBuffer logBuffer) {
/*
@@ -361,6 +368,7 @@
/**
* @see LN#readFromLog
*/
+ @Override
public void readFromLog(ByteBuffer itemBuffer, byte entryVersion)
throws LogException {
@@ -391,13 +399,14 @@
* written to the log.
*/
private void getOffsets() {
+ assert !isDeleted();
if (needOffsets) {
long[] offsets = trackedSummary.getObsoleteOffsets();
if (offsets != null) {
int oldSize = obsoleteOffsets.getExtraMemorySize();
obsoleteOffsets.pack(offsets);
int newSize = obsoleteOffsets.getExtraMemorySize();
- memBudget.updateTreeMemoryUsage(newSize - oldSize);
+ extraMarshaledMemorySize = newSize - oldSize;
}
needOffsets = false;
}
@@ -422,4 +431,30 @@
super.makeDeleted();
obsoleteOffsets = new PackedOffsets();
}
+
+ /**
+ * Adds the extra memory used by obsoleteOffsets to the parent BIN memory
+ * size. Must be called after LN is inserted into the BIN and logged,
+ * while the cursor is still positioned on the inserted LN. The BIN must
+ * be latched. [#17462]
+ *
+ *
The obsoleteOffsets memory size is not intially budgeted in the usual
+ * way because PackedOffsets.pack (which changes the memory size) is called
+ * during marshalling (see getOffset). This amount is not counted in the
+ * parent IN size in the usual way, because LN logging / marshalling occurs
+ * after the LN is inserted in the BIN and its memory size has been counted
+ * (see Tree.insert).
+ *
+ *
Note that the tree memory usage cannot be updated directly in
+ * getOffsets because the tree memory usage must always be the sum of all
+ * IN sizes, and it is reset to this sum each checkpoint.
+ */
+ public void addExtraMarshaledMemorySize(BIN parentBIN) {
+ if (extraMarshaledMemorySize != 0) {
+ assert trackedSummary != null; /* Must be set during the insert. */
+ assert parentBIN.isLatchOwnerForWrite();
+ parentBIN.updateMemorySize(0, extraMarshaledMemorySize);
+ extraMarshaledMemorySize = 0;
+ }
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/Generation.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/Generation.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/Generation.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/Generation.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Generation.java,v 1.14 2008/01/07 14:28:56 cwl Exp $
+ * $Id: Generation.java,v 1.14.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/InconsistentNodeException.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/InconsistentNodeException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/InconsistentNodeException.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/InconsistentNodeException.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: InconsistentNodeException.java,v 1.16 2008/01/07 14:28:56 cwl Exp $
+ * $Id: InconsistentNodeException.java,v 1.16.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/INDeleteInfo.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/INDeleteInfo.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/INDeleteInfo.java 2008-01-17 17:22:14.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/INDeleteInfo.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: INDeleteInfo.java,v 1.40 2008/01/17 17:22:14 cwl Exp $
+ * $Id: INDeleteInfo.java,v 1.40.2.3 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
@@ -24,6 +24,10 @@
/**
* INDeleteInfo encapsulates the information logged about the removal of a
* child from an IN during IN compression.
+ *
+ * As of JE 3.3.87, INDelete is no longer logged becaue the root compression
+ * feature has been disabled. However, INDelete must still be processed in log
+ * files created with 3.3.87 and earlier. [#17546]
*/
public class INDeleteInfo implements Loggable {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/INDupDeleteInfo.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/INDupDeleteInfo.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/INDupDeleteInfo.java 2008-01-17 17:22:14.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/INDupDeleteInfo.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: INDupDeleteInfo.java,v 1.21 2008/01/17 17:22:14 cwl Exp $
+ * $Id: INDupDeleteInfo.java,v 1.21.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/IN.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/IN.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/IN.java 2008-05-30 14:04:16.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/IN.java 2010-03-26 13:23:56.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: IN.java,v 1.344 2008/05/30 14:04:16 mark Exp $
+ * $Id: IN.java,v 1.346.2.7 2010/03/26 13:23:55 mark Exp $
*/
package com.sleepycat.je.tree;
@@ -228,6 +228,7 @@
inMemorySize = computeMemorySize();
}
+ @Override
public boolean equals(Object obj) {
if (!(obj instanceof IN)) {
return false;
@@ -245,6 +246,7 @@
* different container in the future that does not re-hash the return
* value, we should probably implement the Wang-Jenkins hash function here.
*/
+ @Override
public int hashCode() {
return (int) ~getNodeId();
}
@@ -287,6 +289,7 @@
/**
* Initialize a node that has been read in from the log.
*/
+ @Override
public void postFetchInit(DatabaseImpl db, long sourceLsn)
throws DatabaseException {
@@ -389,6 +392,7 @@
/**
* Release the latch on this node.
*/
+ @Override
public void releaseLatch()
throws LatchNotHeldException {
@@ -432,6 +436,13 @@
generation = Long.MAX_VALUE;
break;
+ case MAKE_COLD:
+ case EVICT_LN:
+ if (isBottomMostNode()) {
+ generation = 0L;
+ }
+ break;
+
default:
throw new RuntimeException("unknown cacheMode: " + cacheMode);
}
@@ -441,10 +452,19 @@
generation = newGeneration;
}
+ @Override
public int getLevel() {
return level;
}
+ /**
+ * @return true if this node cannot contain contain children INs, i.e., if
+ * this is a DBIN, or this is a BIN in a non-duplicates DB.
+ */
+ boolean isBottomMostNode() {
+ return false;
+ }
+
protected int generateLevel(DatabaseId dbId, int newLevel) {
if (dbId.equals(DbTree.ID_DB_ID)) {
return newLevel | DBMAP_LEVEL;
@@ -661,7 +681,7 @@
return setKeyAndPrefix(idx, keyVal);
}
- /*
+ /*
* Set the key at idx and adjust the key prefix if necessary. Return true
* if the prefixes and suffixes were adjusted to indicate that memory
* recalculation can occur.
@@ -747,7 +767,7 @@
return true;
}
- /*
+ /*
* Computes a key prefix based on all the keys in 'this'. Return null if
* the IN is empty or prefixing is not enabled or there is no common
* prefix for the keys.
@@ -1591,7 +1611,7 @@
public long getBudgetedMemorySize() {
return inMemorySize - accumulatedDelta;
}
-
+
/**
* Returns the treeAdmin memory in objects referenced by this IN.
* Specifically, this refers to the DbFileSummaryMap held by
@@ -1632,7 +1652,7 @@
* Count up the memory usage attributable to this node alone. LNs children
* are counted by their BIN/DIN parents, but INs are not counted by their
* parents because they are resident on the IN list. The identifierKey is
- * "intentionally" not kept track of in the memory budget.
+ * "intentionally" not kept track of in the memory budget.
*/
protected long computeMemorySize() {
MemoryBudget mb = databaseImpl.getDbEnvironment().getMemoryBudget();
@@ -2438,6 +2458,7 @@
* maxKey, if non-null specifies that all keys in this node must be less
* than maxKey.
*/
+ @Override
public void verify(byte[] maxKey)
throws DatabaseException {
@@ -2577,7 +2598,7 @@
* Determine if 'this' is the parent of a child (targetNodeId). If not,
* find a child of 'this' that may be the parent and return it. If there
* are no possibilities, then return null. Note that the keys of the
- * target are passed in as args to we don't have to latch the target to
+ * target are passed in as args so we don't have to latch the target to
* look at them. Also, 'this' is latched upon entry.
*
* @param doFetch If true, fetch the child in the pursuit of this search.
@@ -3163,8 +3184,9 @@
INLogContext context)
throws DatabaseException {
- item.oldLsn = (item.provisional == Provisional.YES) ?
- DbLsn.NULL_LSN : lastFullVersion;
+ item.oldLsn = countObsoleteDuringLogging(item.provisional) ?
+ lastFullVersion :
+ DbLsn.NULL_LSN;
item.entry = new INLogEntry(this);
}
@@ -3184,13 +3206,13 @@
INLogContext context)
throws DatabaseException {
- if (item.provisional == Provisional.YES) {
+ if (countObsoleteDuringLogging(item.provisional)) {
+ flushProvisionalObsolete(logManager);
+ } else {
if (item.parent != null) {
item.parent.trackProvisionalObsolete
(this, lastFullVersion, DbLsn.NULL_LSN);
}
- } else {
- flushProvisionalObsolete(logManager);
}
setLastFullLsn(item.newLsn);
@@ -3198,6 +3220,24 @@
}
/**
+ * Returns whether to count the prior version of an IN (as well as
+ * accumulated provisionally obsolete LSNs for child nodes) obsolete when
+ * logging the new version.
+ *
+ * True is returned if we are logging the IN non-provisionally, since the
+ * non-provisional version durably replaces the prior version and causes
+ * all provisional children to also become durable.
+ *
+ * True is also returned if the database is temporary. Since we never use a
+ * temporary DB past recovery, prior versions of an IN are never used.
+ * [#16928]
+ */
+ private boolean countObsoleteDuringLogging(Provisional provisional) {
+ return provisional != Provisional.YES ||
+ databaseImpl.isTemporary();
+ }
+
+ /**
* Adds the given obsolete LSNs and any tracked obsolete LSNs for the given
* child IN to this IN's tracking list. This method is called to track
* obsolete LSNs when a child IN is logged provisionally. Such LSNs cannot
@@ -3258,7 +3298,7 @@
if (provisionalObsolete != null) {
int memDelta = provisionalObsolete.size() *
- MemoryBudget.LONG_LIST_PER_ITEM_OVERHEAD;
+ MemoryBudget.LONG_LIST_PER_ITEM_OVERHEAD;
logManager.countObsoleteINs(provisionalObsolete, getDatabase());
provisionalObsolete = null;
@@ -3277,6 +3317,7 @@
/**
* @see Loggable#getLogSize
*/
+ @Override
public int getLogSize() {
int size = super.getLogSize(); // ancestors
size += LogUtils.getByteArrayLogSize(identifierKey); // identifier key
@@ -3305,6 +3346,7 @@
/**
* @see Loggable#writeToLog
*/
+ @Override
public void writeToLog(ByteBuffer logBuffer) {
super.writeToLog(logBuffer);
@@ -3374,6 +3416,7 @@
/**
* @see Loggable#readFromLog
*/
+ @Override
public void readFromLog(ByteBuffer itemBuffer, byte entryVersion)
throws LogException {
@@ -3450,6 +3493,7 @@
/**
* @see Loggable#dumpLog
*/
+ @Override
public void dumpLog(StringBuffer sb, boolean verbose) {
sb.append(beginTag());
@@ -3540,6 +3584,7 @@
* For unit test support:
* @return a string that dumps information about this IN, without
*/
+ @Override
public String dumpString(int nSpaces, boolean dumpTags) {
StringBuffer sb = new StringBuffer();
if (dumpTags) {
@@ -3636,6 +3681,7 @@
sb.append(isStatePendingDeleted(state)).append("\"/>");
}
+ @Override
public String toString() {
return dumpString(0, true);
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/INLogContext.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/INLogContext.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/INLogContext.java 2008-04-18 22:57:38.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/INLogContext.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: INLogContext.java,v 1.1 2008/04/18 22:57:37 mark Exp $
+ * $Id: INLogContext.java,v 1.1.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/INLogItem.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/INLogItem.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/INLogItem.java 2008-04-18 22:57:38.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/INLogItem.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: INLogItem.java,v 1.1 2008/04/18 22:57:37 mark Exp $
+ * $Id: INLogItem.java,v 1.1.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/Key.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/Key.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/Key.java 2008-05-19 17:52:18.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/Key.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Key.java,v 1.70 2008/05/19 17:52:18 linda Exp $
+ * $Id: Key.java,v 1.71.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
@@ -136,6 +136,7 @@
/**
* Support Set of Key in BINReference.
*/
+ @Override
public boolean equals(Object o) {
return (o instanceof Key) && (compareTo((Key)o) == 0);
}
@@ -143,6 +144,7 @@
/**
* Support HashSet of Key in BINReference.
*/
+ @Override
public int hashCode() {
int code = 0;
for (int i = 0; i < key.length; i += 1) {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/LN.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/LN.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/LN.java 2008-03-25 03:26:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/LN.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LN.java,v 1.151 2008/03/25 02:26:36 linda Exp $
+ * $Id: LN.java,v 1.152.2.5 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
@@ -78,17 +78,18 @@
*/
public LN(DatabaseEntry dbt, EnvironmentImpl envImpl, boolean replicated) {
super(envImpl, replicated);
- byte[] data = dbt.getData();
- if (data == null) {
- this.data = null;
+
+ byte[] dat = dbt.getData();
+ if (dat == null) {
+ data = null;
} else if (dbt.getPartial()) {
- init(data,
+ init(dat,
dbt.getOffset(),
dbt.getPartialOffset() + dbt.getSize(),
dbt.getPartialOffset(),
dbt.getSize());
} else {
- init(data, dbt.getOffset(), dbt.getSize());
+ init(dat, dbt.getOffset(), dbt.getSize());
}
setDirty();
}
@@ -463,8 +464,9 @@
boolean logAbortKnownDeleted;
Txn logTxn;
if (locker != null && locker.isTransactional()) {
- entryType = isDelDup ? LogEntryType.LOG_DEL_DUPLN_TRANSACTIONAL
- : getTransactionalLogType();
+ entryType = isDelDup ?
+ LogEntryType.LOG_DEL_DUPLN_TRANSACTIONAL :
+ getTransactionalLogType();
WriteLockInfo info = locker.getWriteLockInfo(getNodeId());
logAbortLsn = info.getAbortLsn();
logAbortKnownDeleted = info.getAbortKnownDeleted();
@@ -474,8 +476,7 @@
info.setAbortInfo(dbImpl, getLastLoggedSize());
}
} else {
- entryType = isDelDup ? LogEntryType.LOG_DEL_DUPLN
- : getLogType();
+ entryType = isDelDup ? LogEntryType.LOG_DEL_DUPLN : getLogType();
logAbortLsn = DbLsn.NULL_LSN;
logAbortKnownDeleted = false;
logTxn = null;
@@ -507,16 +508,32 @@
long lsn = DbLsn.NULL_LSN;
try {
- lsn = env.getLogManager().log(logEntry, isProvisional,
- backgroundIO, oldLsn, dbImpl,
- repContext);
+ if (logTxn != null) {
+
+ /*
+ * Writing an LN_TX entry requires looking at the Txn's
+ * lastLoggedLsn. The Txn may be used by multiple threads so
+ * ensure that the view we get is consistent. [#17204]
+ */
+ synchronized (logTxn) {
+ lsn = env.getLogManager().log(logEntry, isProvisional,
+ backgroundIO, oldLsn, dbImpl,
+ repContext);
+ }
+ } else {
+ lsn = env.getLogManager().log(logEntry, isProvisional,
+ backgroundIO, oldLsn, dbImpl,
+ repContext);
+ }
} catch (DatabaseException DE) {
/*
* If any exception happens during logging, then force this txn
* to onlyAbortable. [#15768]
*/
- locker.setOnlyAbortable();
+ if (locker != null) {
+ locker.setOnlyAbortable();
+ }
throw DE;
}
clearDirty();
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/MapLN.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/MapLN.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/MapLN.java 2008-03-25 03:26:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/MapLN.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: MapLN.java,v 1.86 2008/03/25 02:26:36 linda Exp $
+ * $Id: MapLN.java,v 1.87.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
@@ -129,10 +129,12 @@
databaseImpl = new DatabaseImpl();
}
+ @Override
public boolean isDeleted() {
return deleted;
}
+ @Override
void makeDeleted() {
deleted = true;
@@ -206,6 +208,7 @@
/**
* Initialize a node that has been faulted in from the log.
*/
+ @Override
public void postFetchInit(DatabaseImpl db, long sourceLsn)
throws DatabaseException {
@@ -234,18 +237,22 @@
* Dumping
*/
+ @Override
public String toString() {
return dumpString(0, true);
}
+ @Override
public String beginTag() {
return BEGIN_TAG;
}
+ @Override
public String endTag() {
return END_TAG;
}
+ @Override
public String dumpString(int nSpaces, boolean dumpTags) {
StringBuffer sb = new StringBuffer();
sb.append(super.dumpString(nSpaces, dumpTags));
@@ -265,6 +272,7 @@
/**
* Log type for transactional entries.
*/
+ @Override
protected LogEntryType getTransactionalLogType() {
return LogEntryType.LOG_MAPLN_TRANSACTIONAL;
}
@@ -272,6 +280,7 @@
/**
* @see Node#getLogType
*/
+ @Override
public LogEntryType getLogType() {
return LogEntryType.LOG_MAPLN;
}
@@ -279,6 +288,7 @@
/**
* @see LN#getLogSize
*/
+ @Override
public int getLogSize() {
return super.getLogSize() +
databaseImpl.getLogSize() +
@@ -288,6 +298,7 @@
/**
* @see LN#writeToLog
*/
+ @Override
public void writeToLog(ByteBuffer logBuffer) {
/* Ask ancestors to write to log. */
super.writeToLog(logBuffer);
@@ -299,6 +310,7 @@
/**
* @see LN#readFromLog
*/
+ @Override
public void readFromLog(ByteBuffer itemBuffer, byte entryVersion)
throws LogException {
@@ -322,6 +334,7 @@
* Dump additional fields. Done this way so the additional info can be
* within the XML tags defining the dumped log entry.
*/
+ @Override
protected void dumpLogAdditional(StringBuffer sb, boolean verbose) {
databaseImpl.dumpLog(sb, true);
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/NameLN.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/NameLN.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/NameLN.java 2008-02-06 19:48:02.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/NameLN.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: NameLN.java,v 1.28 2008/02/06 19:48:01 linda Exp $
+ * $Id: NameLN.java,v 1.29.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
@@ -51,10 +51,12 @@
id = new DatabaseId();
}
+ @Override
public boolean isDeleted() {
return deleted;
}
+ @Override
void makeDeleted() {
deleted = true;
}
@@ -71,18 +73,22 @@
* Dumping
*/
+ @Override
public String toString() {
return dumpString(0, true);
}
+ @Override
public String beginTag() {
return BEGIN_TAG;
}
+ @Override
public String endTag() {
return END_TAG;
}
+ @Override
public String dumpString(int nSpaces, boolean dumpTags) {
StringBuffer sb = new StringBuffer();
sb.append(super.dumpString(nSpaces, dumpTags));
@@ -105,6 +111,7 @@
/**
* Log type for transactional entries.
*/
+ @Override
protected LogEntryType getTransactionalLogType() {
return LogEntryType.LOG_NAMELN_TRANSACTIONAL;
}
@@ -112,6 +119,7 @@
/**
* @see Node#getLogType
*/
+ @Override
public LogEntryType getLogType() {
return LogEntryType.LOG_NAMELN;
}
@@ -119,6 +127,7 @@
/**
* @see LN#getLogSize
*/
+ @Override
public int getLogSize() {
return
super.getLogSize() + // superclass
@@ -129,6 +138,7 @@
/**
* @see LN#writeToLog
*/
+ @Override
public void writeToLog(ByteBuffer logBuffer) {
/* Ask ancestors to write to log. */
super.writeToLog(logBuffer); // super class
@@ -140,6 +150,7 @@
/**
* @see LN#readFromLog
*/
+ @Override
public void readFromLog(ByteBuffer itemBuffer, byte entryVersion)
throws LogException {
@@ -176,6 +187,7 @@
* Dump additional fields. Done this way so the additional info can be
* within the XML tags defining the dumped log entry.
*/
+ @Override
protected void dumpLogAdditional(StringBuffer sb, boolean verbose) {
id.dumpLog(sb, true);
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/Node.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/Node.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/Node.java 2008-05-06 18:01:34.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/Node.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Node.java,v 1.107 2008/05/06 18:01:34 linda Exp $
+ * $Id: Node.java,v 1.108.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
@@ -171,6 +171,7 @@
/**
* Default toString method at the root of the tree.
*/
+ @Override
public String toString() {
return this.dumpString(0, true);
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/NodeNotEmptyException.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/NodeNotEmptyException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/NodeNotEmptyException.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/NodeNotEmptyException.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: NodeNotEmptyException.java,v 1.17 2008/01/07 14:28:56 cwl Exp $
+ * $Id: NodeNotEmptyException.java,v 1.17.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/SearchResult.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/SearchResult.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/SearchResult.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/SearchResult.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SearchResult.java,v 1.16 2008/01/07 14:28:56 cwl Exp $:
+ * $Id: SearchResult.java,v 1.17.2.2 2010/01/04 15:30:36 cwl Exp $:
*/
package com.sleepycat.je.tree;
@@ -31,6 +31,7 @@
childNotResident = false;
}
+ @Override
public String toString() {
return
"exactParentFound="+ exactParentFound +
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/SplitRequiredException.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/SplitRequiredException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/SplitRequiredException.java 2008-05-20 17:52:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/SplitRequiredException.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SplitRequiredException.java,v 1.8 2008/05/20 17:52:36 linda Exp $
+ * $Id: SplitRequiredException.java,v 1.8.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/TrackingInfo.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/TrackingInfo.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/TrackingInfo.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/TrackingInfo.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: TrackingInfo.java,v 1.14 2008/01/07 14:28:56 cwl Exp $
+ * $Id: TrackingInfo.java,v 1.15.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
@@ -22,6 +22,7 @@
this.nodeId = nodeId;
}
+ @Override
public String toString() {
return "lsn=" + DbLsn.getNoFormatString(lsn) +
" node=" + nodeId;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/Tree.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/Tree.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/Tree.java 2008-05-30 14:04:16.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/Tree.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Tree.java,v 1.456 2008/05/30 14:04:16 mark Exp $
+ * $Id: Tree.java,v 1.458.2.5 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
@@ -169,8 +169,24 @@
maxDupTreeEntriesPerNode = database.getNodeMaxDupTreeEntries();
DbConfigManager configManager =
database.getDbEnvironment().getConfigManager();
- purgeRoot = configManager.getBoolean
- (EnvironmentParams.COMPRESSOR_PURGE_ROOT);
+
+ /*
+ * Root compression is no longer supported. Root compression has no
+ * impact on memory usage now that we evict the root IN. It reduces
+ * log space taken by INs for empty (but not removed) databases, yet
+ * requires logging an INDelete and MapLN; this provides very little
+ * benefit, if any. Because it requires extensive testing (which has
+ * not been done), this minor benefit is not worth the cost. And by
+ * removing it we no longer log INDelete, which reduces complexity
+ * going forward.
+ *
+ * In JE 3.3 we have made the minimal change (setting purgeRoot to
+ * false below) to disable this feature, while in 4.0 and later the
+ * supporting code will be removed.
+ *
+ * [#17546]
+ */
+ purgeRoot = false;
}
/**
@@ -243,14 +259,6 @@
super(target, key, lsn);
}
- /* Not used. */
- private RootChildReference(Node target,
- byte[] key,
- long lsn,
- byte existingState) {
- super(target, key, lsn, existingState);
- }
-
/* Caller is responsible for releasing rootLatch. */
@Override
public Node fetchTarget(DatabaseImpl database, IN in)
@@ -891,10 +899,6 @@
* child. Used by the checkpointer to avoid conflicting with work done
* by the evictor.
*
- * @param child The child node for which to find the parent. This node is
- * latched by the caller and is released by this function before returning
- * to the caller.
- *
* @return a SearchResult object. If the parent has been found,
* result.foundExactMatch is true. If any parent, exact or potential has
* been found, result.parent refers to that node.
@@ -1695,6 +1699,7 @@
*/
@SuppressWarnings("serial")
private static class RelatchRequiredException extends DatabaseException {
+ @Override
public synchronized Throwable fillInStackTrace() {
return this;
}
@@ -3149,8 +3154,7 @@
int startingCount =
(locker.createdNode(nodeId) ||
existingLNIsDeleted ||
- locker.getWriteLockInfo(nodeId).getAbortKnownDeleted()) ?
- 0 : 1;
+ (locker.getWriteLockInfo(nodeId).getAbortKnownDeleted()) ? 0 : 1);
DupCountLN dupCountLN = new DupCountLN(database.getDbEnvironment(),
startingCount);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/tree/TreeLocation.java libdb-je-java-3.3.98/src/com/sleepycat/je/tree/TreeLocation.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/tree/TreeLocation.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/tree/TreeLocation.java 2010-01-04 15:30:36.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: TreeLocation.java,v 1.16 2008/01/07 14:28:56 cwl Exp $
+ * $Id: TreeLocation.java,v 1.17.2.2 2010/01/04 15:30:36 cwl Exp $
*/
package com.sleepycat.je.tree;
@@ -27,6 +27,7 @@
childLsn = DbLsn.NULL_LSN;
}
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer(" releaseAndFindNotifyTargets(long nodeId, Locker locker)
+ protected Set releaseAndFindNotifyTargets(long nodeId,
+ Locker locker)
throws DatabaseException {
- return null;
+ if (locker.isTransactional()) {
+ return superiorLockManager.
+ releaseAndFindNotifyTargets(nodeId, locker);
+ } else {
+ return null;
+ }
}
/**
@@ -84,6 +115,12 @@
boolean demoteToRead)
throws DatabaseException {
+ if (owningLocker.isTransactional()) {
+ superiorLockManager.transfer
+ (nodeId, owningLocker, destLocker, demoteToRead);
+ } else {
+ return;
+ }
}
/**
@@ -94,6 +131,12 @@
Locker[] destLockers)
throws DatabaseException {
+ if (owningLocker.isTransactional()) {
+ superiorLockManager.transferMultiple
+ (nodeId, owningLocker, destLockers);
+ } else {
+ return;
+ }
}
/**
@@ -102,46 +145,56 @@
void demote(long nodeId, Locker locker)
throws DatabaseException {
+ if (locker.isTransactional()) {
+ superiorLockManager.demote(nodeId, locker);
+ } else {
+ return;
+ }
}
/**
* @see LockManager#isLocked
*/
- boolean isLocked(Long nodeId) {
+ boolean isLocked(Long nodeId)
+ throws DatabaseException {
- return false;
+ return superiorLockManager.isLocked(nodeId);
}
/**
* @see LockManager#isOwner
*/
- boolean isOwner(Long nodeId, Locker locker, LockType type) {
+ boolean isOwner(Long nodeId, Locker locker, LockType type)
+ throws DatabaseException {
- return false;
+ return superiorLockManager.isOwner(nodeId, locker, type);
}
/**
* @see LockManager#isWaiter
*/
- boolean isWaiter(Long nodeId, Locker locker) {
+ boolean isWaiter(Long nodeId, Locker locker)
+ throws DatabaseException {
- return false;
+ return superiorLockManager.isWaiter(nodeId, locker);
}
/**
* @see LockManager#nWaiters
*/
- int nWaiters(Long nodeId) {
+ int nWaiters(Long nodeId)
+ throws DatabaseException {
- return 0;
+ return superiorLockManager.nWaiters(nodeId);
}
/**
* @see LockManager#nOwners
*/
- int nOwners(Long nodeId) {
+ int nOwners(Long nodeId)
+ throws DatabaseException {
- return 0;
+ return superiorLockManager.nOwners(nodeId);
}
/**
@@ -150,7 +203,7 @@
Locker getWriteOwnerLocker(Long nodeId)
throws DatabaseException {
- return null;
+ return superiorLockManager.getWriteOwnerLocker(nodeId);
}
/**
@@ -163,7 +216,12 @@
MemoryBudget mb)
throws DatabaseException {
- return true;
+ if (locker.isTransactional()) {
+ return superiorLockManager.validateOwnership
+ (nodeId, locker, type, flushFromWaiters, mb);
+ } else {
+ return true;
+ }
}
/**
@@ -172,5 +230,6 @@
protected void dumpLockTable(LockStats stats)
throws DatabaseException {
+ superiorLockManager.dumpLockTable(stats);
}
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LatchedLockManager.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LatchedLockManager.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LatchedLockManager.java 2008-05-15 01:52:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LatchedLockManager.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LatchedLockManager.java,v 1.20 2008/05/15 01:52:43 linda Exp $
+ * $Id: LatchedLockManager.java,v 1.20.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockAttemptResult.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockAttemptResult.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockAttemptResult.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockAttemptResult.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LockAttemptResult.java,v 1.2 2008/01/07 14:28:56 cwl Exp $
+ * $Id: LockAttemptResult.java,v 1.2.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockConflict.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockConflict.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockConflict.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockConflict.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LockConflict.java,v 1.7 2008/01/07 14:28:56 cwl Exp $
+ * $Id: LockConflict.java,v 1.7.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockerFactory.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockerFactory.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockerFactory.java 2008-05-13 20:03:10.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockerFactory.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LockerFactory.java,v 1.18 2008/05/13 20:03:10 sam Exp $
+ * $Id: LockerFactory.java,v 1.18.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/Locker.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/Locker.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/Locker.java 2008-05-22 20:25:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/Locker.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Locker.java,v 1.121 2008/05/22 20:25:35 cwl Exp $
+ * $Id: Locker.java,v 1.122.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
@@ -801,6 +801,7 @@
/*
* Helpers
*/
+ @Override
public String toString() {
String className = getClass().getName();
className = className.substring(className.lastIndexOf('.') + 1);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockGrantType.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockGrantType.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockGrantType.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockGrantType.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LockGrantType.java,v 1.20 2008/01/07 14:28:56 cwl Exp $
+ * $Id: LockGrantType.java,v 1.21.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
@@ -37,6 +37,7 @@
this.name = name;
}
+ @Override
public String toString() {
return name;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockImpl.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockImpl.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockImpl.java 2008-05-19 17:52:20.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockImpl.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LockImpl.java,v 1.7 2008/05/19 17:52:19 linda Exp $
+ * $Id: LockImpl.java,v 1.8.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
@@ -975,6 +975,7 @@
/**
* Debug dumper.
*/
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(" LockAddr:").append(System.identityHashCode(this));
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockInfo.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockInfo.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockInfo.java 2008-05-30 14:04:18.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockInfo.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LockInfo.java,v 1.35 2008/05/30 14:04:17 mark Exp $
+ * $Id: LockInfo.java,v 1.36.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
@@ -85,6 +85,7 @@
return lockType;
}
+ @Override
public Object clone()
throws CloneNotSupportedException {
@@ -98,6 +99,7 @@
System.out.println(this);
}
+ @Override
public String toString() {
StringBuffer buf = new StringBuffer(500);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/Lock.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/Lock.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/Lock.java 2008-05-15 01:52:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/Lock.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Lock.java,v 1.71 2008/05/15 01:52:43 linda Exp $
+ * $Id: Lock.java,v 1.73.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockManager.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockManager.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockManager.java 2008-06-03 16:25:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockManager.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LockManager.java,v 1.141 2008/06/03 16:25:43 cwl Exp $
+ * $Id: LockManager.java,v 1.142.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
@@ -82,6 +82,12 @@
new RangeRestartException();
private static boolean lockTableDump = false;
+ /*
+ * @SuppressWarnings is used to stifle a type safety complaint about the
+ * assignment of lockTables = new Map[nLockTables]. There's no way to
+ * specify the type of the array.
+ */
+ @SuppressWarnings("unchecked")
public LockManager(EnvironmentImpl envImpl)
throws DatabaseException {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockResult.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockResult.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockResult.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockResult.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LockResult.java,v 1.18 2008/01/07 14:28:56 cwl Exp $
+ * $Id: LockResult.java,v 1.18.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockType.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockType.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockType.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockType.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LockType.java,v 1.22 2008/01/07 14:28:56 cwl Exp $
+ * $Id: LockType.java,v 1.23.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
@@ -199,6 +199,7 @@
return upgrade;
}
+ @Override
public String toString() {
return name;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockUpgrade.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockUpgrade.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/LockUpgrade.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/LockUpgrade.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: LockUpgrade.java,v 1.7 2008/01/07 14:28:56 cwl Exp $
+ * $Id: LockUpgrade.java,v 1.7.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/package.html libdb-je-java-3.3.98/src/com/sleepycat/je/txn/package.html
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/package.html 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/package.html 2010-01-04 15:30:38.000000000 +0000
@@ -5,10 +5,10 @@
See the file LICENSE for redistribution information.
- Copyright (c) 2002,2008 Oracle. All rights reserved.
+ Copyright (c) 2002,2010 Oracle. All rights reserved.
- $Id: package.html,v 1.8 2008/01/07 14:28:56 cwl Exp $
+ $Id: package.html,v 1.8.2.2 2010/01/04 15:30:37 cwl Exp $
-->
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/PreparedTxn.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/PreparedTxn.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/PreparedTxn.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/PreparedTxn.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PreparedTxn.java,v 1.6 2008/01/07 14:28:56 cwl Exp $
+ * $Id: PreparedTxn.java,v 1.6.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/ReadCommittedLocker.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/ReadCommittedLocker.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/ReadCommittedLocker.java 2008-03-18 16:53:06.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/ReadCommittedLocker.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ReadCommittedLocker.java,v 1.13 2008/03/18 15:53:05 mark Exp $
+ * $Id: ReadCommittedLocker.java,v 1.13.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/SyncedLockManager.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/SyncedLockManager.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/SyncedLockManager.java 2008-05-15 01:52:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/SyncedLockManager.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SyncedLockManager.java,v 1.18 2008/05/15 01:52:43 linda Exp $
+ * $Id: SyncedLockManager.java,v 1.18.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/ThinLockImpl.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/ThinLockImpl.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/ThinLockImpl.java 2008-05-15 01:52:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/ThinLockImpl.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ThinLockImpl.java,v 1.5 2008/05/15 01:52:43 linda Exp $
+ * $Id: ThinLockImpl.java,v 1.6.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
@@ -197,6 +197,7 @@
return true;
}
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/ThreadLocker.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/ThreadLocker.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/ThreadLocker.java 2008-03-18 16:53:06.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/ThreadLocker.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ThreadLocker.java,v 1.20 2008/03/18 15:53:05 mark Exp $
+ * $Id: ThreadLocker.java,v 1.20.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/TxnAbort.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/TxnAbort.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/TxnAbort.java 2008-05-13 01:57:02.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/TxnAbort.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: TxnAbort.java,v 1.25 2008/05/13 01:57:01 linda Exp $
+ * $Id: TxnAbort.java,v 1.26.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
@@ -41,6 +41,9 @@
if (!(other instanceof TxnAbort))
return false;
- return (id == ((TxnAbort) other).id);
+ TxnAbort otherAbort = (TxnAbort) other;
+
+ return ((id == otherAbort.id) &&
+ (repMasterNodeId == otherAbort.repMasterNodeId));
}
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/TxnCommit.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/TxnCommit.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/TxnCommit.java 2008-05-13 01:57:02.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/TxnCommit.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: TxnCommit.java,v 1.27 2008/05/13 01:57:01 linda Exp $
+ * $Id: TxnCommit.java,v 1.28.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
@@ -41,6 +41,9 @@
if (!(other instanceof TxnCommit))
return false;
- return (id == ((TxnCommit) other).id);
+ TxnCommit otherCommit = (TxnCommit) other;
+
+ return ((id == otherCommit.id) &&
+ (repMasterNodeId == otherCommit.repMasterNodeId));
}
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/TxnEnd.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/TxnEnd.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/TxnEnd.java 2008-05-21 18:50:02.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/TxnEnd.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: TxnEnd.java,v 1.40 2008/05/21 18:50:02 sam Exp $
+ * $Id: TxnEnd.java,v 1.41.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
@@ -25,7 +25,7 @@
private long lastLsn;
/* For replication - master node which wrote this record. */
- private int repMasterNodeId;
+ int repMasterNodeId;
TxnEnd(long id, long lastLsn, int repMasterNodeId) {
this.id = id;
@@ -56,7 +56,7 @@
return lastLsn;
}
- int getMasterNodeId() {
+ public int getMasterNodeId() {
return repMasterNodeId;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/Txn.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/Txn.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/Txn.java 2008-05-28 15:40:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/Txn.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Txn.java,v 1.194 2008/05/28 15:39:59 sam Exp $
+ * $Id: Txn.java,v 1.198.2.5 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
@@ -80,7 +80,7 @@
* write lock collections is done by synchronizing on the txn.
*/
private Set readLocks; // Set (nodeIds)
- private Map writeInfo; // key=nodeid
+ private Map writeInfo; // key=nodeid
private final int READ_LOCK_OVERHEAD = MemoryBudget.HASHSET_ENTRY_OVERHEAD;
private final int WRITE_LOCK_OVERHEAD =
@@ -101,7 +101,7 @@
* the mapping tree. (The normal code paths want to take locks, add
* cursors, etc.
*/
- protected Map undoDatabases;
+ protected Map undoDatabases;
/* Last LSN logged for this transaction. */
protected long lastLoggedLsn = DbLsn.NULL_LSN;
@@ -110,7 +110,7 @@
* First LSN logged for this transaction -- used for keeping track of the
* first active LSN point, for checkpointing. This field is not persistent.
*/
- private long firstLoggedLsn = DbLsn.NULL_LSN;
+ protected long firstLoggedLsn = DbLsn.NULL_LSN;
/* The configured durability at the time the transaction was created. */
private Durability defaultDurability;
@@ -279,11 +279,11 @@
Txn ret = null;
try {
ret = envImpl.isReplicated() ?
- envImpl.getReplicator().createRepTxn(envImpl,
- config,
- noAPIReadLock,
- 0 /* mandatedId */) :
- new Txn(envImpl, config, noAPIReadLock, 0 /* mandatedId */);
+ envImpl.getReplicator().createRepTxn(envImpl,
+ config,
+ noAPIReadLock,
+ 0 /* mandatedId */) :
+ new Txn(envImpl, config, noAPIReadLock, 0 /* mandatedId */);
ret.isAutoCommit = true;
ret.setRepContext(repContext);
ret.initApiReadLock();
@@ -541,10 +541,10 @@
/* Transfer handle locks to their owning handles. */
if (handleLockToHandleMap != null) {
- Iterator>> handleLockIter =
+ Iterator>> handleLockIter =
handleLockToHandleMap.entrySet().iterator();
while (handleLockIter.hasNext()) {
- Map.Entry> entry =
+ Map.Entry> entry =
handleLockIter.next();
Long nodeId = entry.getKey();
if (writeInfo != null) {
@@ -557,8 +557,8 @@
transferredWriteLockInfo.add(info);
}
}
- transferHandleLockToHandleSet
- (nodeId, entry.getValue());
+ transferHandleLockToHandleSet(nodeId,
+ entry.getValue());
}
}
@@ -569,33 +569,50 @@
int numReadLocks = clearReadLocks();
/*
- * Log the commit if we ever held any write locks. Note that
- * with dbhandle write locks, we may have held the write lock
- * but then had it transferred away.
+ * Log the commit if we ever logged any modifications for this
+ * txn. Refraining from logging empty commits is more efficient
+ * and makes for fewer edge cases for HA. Note that this is not
+ * the same as the question of whether we have held any write
+ * locks. Various scenarios, like RMW txns and
+ * Cursor.putNoOverwrite can take write locks without having
+ * actually made any modifications.
+ *
+ * If we have outstanding write locks, we must release them
+ * even if we haven't logged a commit. With dbhandle write
+ * locks, we may have held the write lock but then had it
+ * transferred away.
*/
int numWriteLocks = 0;
if (writeInfo != null) {
numWriteLocks = writeInfo.size();
- try {
- preLogCommitHook();
- } catch (DatabaseException preCommitException) {
- repAbortException = preCommitException;
- throw preCommitException;
- }
+ /*
+ * If nothing was written to log for this txn, no need to
+ * log a commit.
+ */
+ if (firstLoggedLsn != DbLsn.NULL_LSN) {
- try {
- commitLsn = logCommitEntry(durability.getLocalSync());
- } catch (Exception e) {
- /* Cleanup and propagate the exception. */
- postLogAbortHook();
- throw e;
- }
+ try {
+ preLogCommitHook();
+ } catch (DatabaseException preCommitException) {
+ repAbortException = preCommitException;
+ throw preCommitException;
+ }
- try {
- postLogCommitHook();
- } catch (DatabaseException postCommitException) {
- repNoAbortException = postCommitException;
+ try {
+ commitLsn =
+ logCommitEntry(durability.getLocalSync());
+ } catch (Exception e) {
+ /* Cleanup and propagate the exception. */
+ postLogAbortHook();
+ throw e;
+ }
+
+ try {
+ postLogCommitHook();
+ } catch (DatabaseException postCommitException) {
+ repNoAbortException = postCommitException;
+ }
}
/*
@@ -613,10 +630,10 @@
Set alreadyCountedLsnSet = new HashSet();
/* Release all write locks, clear lock collection. */
- Iterator> iter =
+ Iterator> iter =
writeInfo.entrySet().iterator();
while (iter.hasNext()) {
- Map.Entry entry = iter.next();
+ Map.Entry entry = iter.next();
Long nodeId = entry.getKey();
lockManager.release(nodeId, this);
/* Count obsolete LSNs for released write locks. */
@@ -743,7 +760,7 @@
SingleItemEntry commitEntry =
new SingleItemEntry(LogEntryType.LOG_TXN_COMMIT,
new TxnCommit(id, lastLoggedLsn,
- 0 /* masterNodeId */));
+ getReplicatorNodeId()));
switch (flushSyncBehavior) {
@@ -756,6 +773,7 @@
return logManager.logForceFlush(commitEntry,
false, // fsyncRequired
repContext);
+
default:
return logManager.log(commitEntry, repContext);
}
@@ -810,8 +828,6 @@
throws DatabaseException {
try {
- int numReadLocks;
- int numWriteLocks;
long abortLsn;
synchronized (this) {
@@ -825,7 +841,7 @@
SingleItemEntry abortEntry = new SingleItemEntry
(LogEntryType.LOG_TXN_ABORT,
new TxnAbort(id, lastLoggedLsn,
- 0 /* masterNodeId */));
+ getReplicatorNodeId()));
if (forceFlush) {
abortLsn = envImpl.getLogManager().
logForceFlush(abortEntry,
@@ -841,29 +857,6 @@
/* Undo the changes. */
undo();
-
- /*
- * Release all read locks after the undo (since the undo
- * may need to read in mapLNs).
- */
- numReadLocks = (readLocks == null) ? 0 : clearReadLocks();
-
- /*
- * Set database state for deletes before releasing any
- * write locks.
- */
- setDeletedDatabaseState(false);
-
- /* Throw away write lock collection. */
- numWriteLocks =
- (writeInfo == null) ? 0 : clearWriteLocks();
-
- /*
- * Let the delete related info (binreferences and dbs) get
- * gc'ed. Don't explicitly iterate and clear -- that's far
- * less efficient, gives GC wrong input.
- */
- deleteInfo = null;
}
}
@@ -879,8 +872,6 @@
Tracer.trace(Level.FINE,
envImpl,
"Abort:id = " + id +
- " numWriteLocks= " + numWriteLocks +
- " numReadLocks= " + numReadLocks +
" openCursors= " + openCursors);
if (openCursors) {
throw new DatabaseException
@@ -912,7 +903,7 @@
/**
* Rollback the changes to this txn's write locked nodes.
*/
- private void undo()
+ protected void undo()
throws DatabaseException {
Long nodeId = null;
@@ -974,6 +965,29 @@
DbLsn.getNoFormatString(undoLsn), e);
throw e;
}
+
+ /*
+ * Release all read locks after the undo (since the undo may need to
+ * read in mapLNs).
+ */
+ if (readLocks != null) {
+ clearReadLocks();
+ }
+
+ /* Set database state for deletes before releasing any write locks. */
+ setDeletedDatabaseState(false);
+
+ /* Throw away write lock collection. */
+ if (writeInfo != null) {
+ clearWriteLocks();
+ }
+
+ /*
+ * Let the delete related info (binreferences and dbs) get gc'ed. Don't
+ * explicitly iterate and clear -- that's far less efficient, gives GC
+ * wrong input.
+ */
+ deleteInfo = null;
}
private int clearWriteLocks()
@@ -981,10 +995,10 @@
int numWriteLocks = writeInfo.size();
/* Release all write locks, clear lock collection. */
- Iterator> iter =
+ Iterator> iter =
writeInfo.entrySet().iterator();
while (iter.hasNext()) {
- Map.Entry entry = iter.next();
+ Map.Entry entry = iter.next();
Long nodeId = entry.getKey();
lockManager.release(nodeId, this);
}
@@ -1018,11 +1032,11 @@
public void addLogInfo(long lastLsn)
throws DatabaseException {
- /* Save the last LSN for maintaining the transaction LSN chain. */
- lastLoggedLsn = lastLsn;
-
- /* Save handle to LSN for aborts. */
synchronized (this) {
+ /* Save the last LSN for maintaining the transaction LSN chain. */
+ lastLoggedLsn = lastLsn;
+
+ /* Save handle to LSN for aborts. */
/*
* If this is the first LSN, save it for calculating the first LSN
@@ -1101,7 +1115,7 @@
* that latch, needs to synchronize on individual txns, so we must avoid a
* latching hiearchy conflict.
*/
- private void cleanupDatabaseImpls(boolean isCommit)
+ protected void cleanupDatabaseImpls(boolean isCommit)
throws DatabaseException {
if (deletedDatabases != null) {
@@ -1136,8 +1150,8 @@
int delta = 0;
if (type.isWriteLock()) {
if (writeInfo == null) {
- writeInfo = new HashMap();
- undoDatabases = new HashMap();
+ writeInfo = new HashMap();
+ undoDatabases = new HashMap();
delta += MemoryBudget.TWOHASHMAPS_OVERHEAD;
}
@@ -1278,14 +1292,18 @@
public WriteLockInfo getWriteLockInfo(long nodeId)
throws DatabaseException {
- WriteLockInfo info = WriteLockInfo.basicWriteLockInfo;
+ WriteLockInfo wli = null;
synchronized (this) {
if (writeInfo != null) {
- info = writeInfo.get(nodeId);
+ wli = writeInfo.get(nodeId);
}
}
- return info;
+ if (wli == null) {
+ throw new UnsupportedOperationException
+ ("writeInfo is null in Txn.getWriteLockInfo");
+ }
+ return wli;
}
/**
@@ -1614,6 +1632,15 @@
close();
}
+ public boolean isClosed() {
+ return ((txnState & CLOSED) != 0);
+ }
+
+ /* Non replicated txns don't use a node id. */
+ protected int getReplicatorNodeId() {
+ return 0;
+ }
+
/*
* Log support
*/
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/TxnManager.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/TxnManager.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/TxnManager.java 2008-05-15 09:44:34.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/TxnManager.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: TxnManager.java,v 1.81 2008/05/15 09:44:34 chao Exp $
+ * $Id: TxnManager.java,v 1.81.2.4 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
@@ -14,6 +14,7 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
import javax.transaction.xa.Xid;
@@ -74,17 +75,17 @@
if (EnvironmentImpl.getFairLatches()) {
lockManager = new LatchedLockManager(envImpl);
} else {
- if (envImpl.isNoLocking()) {
- lockManager = new DummyLockManager(envImpl);
- } else {
- lockManager = new SyncedLockManager(envImpl);
- }
+ lockManager = new SyncedLockManager(envImpl);
+ }
+
+ if (envImpl.isNoLocking()) {
+ lockManager = new DummyLockManager(envImpl, lockManager);
}
this.envImpl = envImpl;
allTxns = new HashSet();
allXATxns = Collections.synchronizedMap(new HashMap());
- thread2Txn = Collections.synchronizedMap(new HashMap());
+ thread2Txn = new ConcurrentHashMap();
numBegins = 0;
numCommits = 0;
@@ -237,7 +238,7 @@
/**
* Called when XATransaction is prepared.
*/
- public void notePrepare() {
+ public void notePrepare() {
numXAPrepares++;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/TxnPrepare.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/TxnPrepare.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/TxnPrepare.java 2008-05-13 01:53:34.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/TxnPrepare.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: TxnPrepare.java,v 1.16 2008/05/13 01:53:34 linda Exp $
+ * $Id: TxnPrepare.java,v 1.17.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
@@ -50,6 +50,7 @@
/**
* @see Loggable#getLogSize
*/
+ @Override
public int getLogSize() {
return LogUtils.getPackedLongLogSize(id) +
LogUtils.getTimestampLogSize(time) +
@@ -59,6 +60,7 @@
/**
* @see Loggable#writeToLog
*/
+ @Override
public void writeToLog(ByteBuffer logBuffer) {
LogUtils.writePackedLong(logBuffer, id);
LogUtils.writeTimestamp(logBuffer, time);
@@ -68,6 +70,7 @@
/**
* @see Loggable#readFromLog
*/
+ @Override
public void readFromLog(ByteBuffer logBuffer, byte entryVersion) {
boolean unpacked = (entryVersion < 6);
id = LogUtils.readLong(logBuffer, unpacked);
@@ -78,6 +81,7 @@
/**
* @see Loggable#dumpLog
*/
+ @Override
public void dumpLog(StringBuffer sb, boolean verbose) {
sb.append("<").append(getTagName());
sb.append(" id=\"").append(id);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/txn/WriteLockInfo.java libdb-je-java-3.3.98/src/com/sleepycat/je/txn/WriteLockInfo.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/txn/WriteLockInfo.java 2008-01-07 14:28:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/txn/WriteLockInfo.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: WriteLockInfo.java,v 1.19 2008/01/07 14:28:56 cwl Exp $
+ * $Id: WriteLockInfo.java,v 1.19.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.txn;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbBackup.java libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbBackup.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbBackup.java 2008-01-24 14:59:30.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbBackup.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbBackup.java,v 1.14 2008/01/24 14:59:29 linda Exp $
+ * $Id: DbBackup.java,v 1.15.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.util;
@@ -15,7 +15,6 @@
import com.sleepycat.je.log.FileManager;
import com.sleepycat.je.utilint.DbLsn;
-
/**
* DbBackup is a helper class for stopping and restarting JE background
* activity in an open environment in order to simplify backup operations. It
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbDump.java libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbDump.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbDump.java 2008-05-15 01:52:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbDump.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbDump.java,v 1.55 2008/05/15 01:52:43 linda Exp $
+ * $Id: DbDump.java,v 1.56.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.util;
@@ -28,7 +28,6 @@
import com.sleepycat.je.LockMode;
import com.sleepycat.je.OperationStatus;
import com.sleepycat.je.config.EnvironmentParams;
-import com.sleepycat.je.util.DbScavenger;
import com.sleepycat.je.utilint.CmdUtil;
import com.sleepycat.je.utilint.Tracer;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbLoad.java libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbLoad.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbLoad.java 2008-05-13 01:44:54.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbLoad.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbLoad.java,v 1.52 2008/05/13 01:44:54 cwl Exp $
+ * $Id: DbLoad.java,v 1.52.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.util;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbPrintLog.java libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbPrintLog.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbPrintLog.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbPrintLog.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbPrintLog.java,v 1.46 2008/01/07 14:28:57 cwl Exp $
+ * $Id: DbPrintLog.java,v 1.46.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.util;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbRecover.java libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbRecover.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbRecover.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbRecover.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbRecover.java,v 1.17 2008/01/07 14:28:57 cwl Exp $
+ * $Id: DbRecover.java,v 1.17.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.util;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbRunAction.java libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbRunAction.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbRunAction.java 2008-05-30 14:04:18.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbRunAction.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbRunAction.java,v 1.45 2008/05/30 14:04:17 mark Exp $
+ * $Id: DbRunAction.java,v 1.46.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.util;
@@ -364,6 +364,7 @@
this.env = env;
}
+ @Override
public void run() {
StatsConfig clearConfig = new StatsConfig();
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbScavenger.java libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbScavenger.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbScavenger.java 2008-05-15 01:52:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbScavenger.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbScavenger.java,v 1.23 2008/05/15 01:52:43 linda Exp $
+ * $Id: DbScavenger.java,v 1.24.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.util;
@@ -126,6 +126,7 @@
/**
* Start the scavenger run.
*/
+ @Override
public void dump()
throws IOException, DatabaseException {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbSpace.java libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbSpace.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbSpace.java 2008-05-15 01:52:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbSpace.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbSpace.java,v 1.32 2008/05/15 01:52:43 linda Exp $
+ * $Id: DbSpace.java,v 1.32.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.util;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbStat.java libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbStat.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbStat.java 2008-05-13 20:33:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbStat.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbStat.java,v 1.27 2008/05/13 20:33:43 linda Exp $
+ * $Id: DbStat.java,v 1.27.2.2 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.util;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbVerify.java libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbVerify.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/util/DbVerify.java 2008-05-15 01:52:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/util/DbVerify.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbVerify.java,v 1.50 2008/05/15 01:52:43 linda Exp $
+ * $Id: DbVerify.java,v 1.50.2.4 2010/01/04 15:30:37 cwl Exp $
*/
package com.sleepycat.je.util;
@@ -315,7 +315,7 @@
}
if (doClose) {
- closeEnv();
+ closeEnv();
}
} catch (DatabaseException DE) {
ret = false;
@@ -345,39 +345,44 @@
out.println("Verifying database " + name);
}
- /*
- * First check the tree. Use DatabaseImpl.verify so we can get a status
- * return.
- */
- if (verifyConfig.getPrintInfo()) {
- out.println("Checking tree for " + name);
- }
- DatabaseStats stats = dbImpl.getEmptyStats();
- status = dbImpl.verify(verifyConfig, stats);
- if (verifyConfig.getPrintInfo()) {
+ if (checkLsns) {
+ /* Check the obsolete lsns */
+ if (verifyConfig.getPrintInfo()) {
+ out.println("Checking obsolete offsets for " + name);
+ }
+ try {
+ VerifyUtils.checkLsns(dbImpl, out);
+ } catch (DatabaseException e) {
+ if (verifyConfig.getPrintInfo()) {
+ out.println("Problem from checkLsns:" + e);
+ }
+ status = false;
+ }
+ } else {
/*
- * Intentionally use print, not println, because stats.toString()
- * puts in a newline too.
+ * Check the tree. Use DatabaseImpl.verify so we can get a status
+ * return.
*/
- out.print(stats);
- }
-
- /* Then check the obsolete lsns */
- if (verifyConfig.getPrintInfo()) {
- out.println("Checking obsolete offsets for " + name);
- }
- try {
- VerifyUtils.checkLsns(dbImpl, out);
- } catch (DatabaseException e) {
if (verifyConfig.getPrintInfo()) {
- out.println("Problem from checkLsns:" + e);
+ out.println("Checking tree for " + name);
+ }
+ DatabaseStats stats = dbImpl.getEmptyStats();
+ status = dbImpl.verify(verifyConfig, stats);
+ if (verifyConfig.getPrintInfo()) {
+
+ /*
+ * Intentionally use print, not println, because
+ * stats.toString() puts in a newline too.
+ */
+ out.print(stats);
}
- status = false;
}
+
if (verifyConfig.getPrintInfo()) {
out.println();
}
+
return status;
}
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/util/package.html libdb-je-java-3.3.98/src/com/sleepycat/je/util/package.html
--- libdb-je-java-3.3.62/src/com/sleepycat/je/util/package.html 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/util/package.html 2010-01-04 15:30:38.000000000 +0000
@@ -5,9 +5,9 @@
See the file LICENSE for redistribution information.
- Copyright (c) 2002,2008 Oracle. All rights reserved.
+ Copyright (c) 2002,2010 Oracle. All rights reserved.
- $Id: package.html,v 1.13 2008/01/07 14:28:57 cwl Exp $
+ $Id: package.html,v 1.13.2.2 2010/01/04 15:30:37 cwl Exp $
-->
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/Adler32.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/Adler32.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/Adler32.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/Adler32.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Adler32.java,v 1.14 2008/01/07 14:28:57 cwl Exp $
+ * $Id: Adler32.java,v 1.16.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
@@ -61,6 +61,7 @@
this.adler32ChunkSize = adler32ChunkSize;
}
+ @Override
public void update(byte[] b, int off, int len) {
if (len < adler32ChunkSize) {
super.update(b, off, len);
@@ -79,8 +80,7 @@
}
public static Checksum makeChecksum() {
- if (!EnvironmentImpl.IS_DALVIK &&
- EnvironmentImpl.USE_JAVA5_ADLER32) {
+ if (EnvironmentImpl.USE_JAVA5_ADLER32) {
int adler32ChunkSize = EnvironmentImpl.getAdler32ChunkSize();
if (adler32ChunkSize > 0) {
return new ChunkingAdler32(adler32ChunkSize);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/BitMap.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/BitMap.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/BitMap.java 2008-05-15 01:52:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/BitMap.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: BitMap.java,v 1.10 2008/05/15 01:52:44 linda Exp $
+ * $Id: BitMap.java,v 1.10.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/CmdUtil.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/CmdUtil.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/CmdUtil.java 2008-05-15 01:52:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/CmdUtil.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: CmdUtil.java,v 1.28 2008/05/15 01:52:44 linda Exp $
+ * $Id: CmdUtil.java,v 1.28.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/DaemonRunner.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/DaemonRunner.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/DaemonRunner.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/DaemonRunner.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DaemonRunner.java,v 1.8 2008/01/07 14:28:57 cwl Exp $
+ * $Id: DaemonRunner.java,v 1.8.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/DaemonThread.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/DaemonThread.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/DaemonThread.java 2008-05-13 01:44:54.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/DaemonThread.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DaemonThread.java,v 1.63 2008/05/13 01:44:54 cwl Exp $
+ * $Id: DaemonThread.java,v 1.64.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
@@ -111,6 +111,7 @@
}
}
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("");
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/DatabaseUtil.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/DatabaseUtil.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/DatabaseUtil.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/DatabaseUtil.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DatabaseUtil.java,v 1.4 2008/01/07 14:28:57 cwl Exp $
+ * $Id: DatabaseUtil.java,v 1.4.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/DbLsn.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/DbLsn.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/DbLsn.java 2008-05-13 01:44:54.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/DbLsn.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DbLsn.java,v 1.56 2008/05/13 01:44:54 cwl Exp $
+ * $Id: DbLsn.java,v 1.56.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/EventTrace.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/EventTrace.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/EventTrace.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/EventTrace.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EventTrace.java,v 1.15 2008/01/07 14:28:57 cwl Exp $
+ * $Id: EventTrace.java,v 1.16.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
@@ -36,6 +36,7 @@
comment = null;
}
+ @Override
public String toString() {
return comment;
}
@@ -99,6 +100,7 @@
event = new Exception();
}
+ @Override
public String toString() {
return Tracer.getStackTrace(event);
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/FileMapper.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/FileMapper.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/FileMapper.java 2008-05-20 03:27:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/FileMapper.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: FileMapper.java,v 1.8 2008/05/20 03:27:36 linda Exp $
+ * $Id: FileMapper.java,v 1.9.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
@@ -20,6 +20,7 @@
import com.sleepycat.je.DatabaseEntry;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.OperationStatus;
+import com.sleepycat.je.log.LogEntryType;
/**
* A FileMapper instance represents the VLSN->LSN mappings for a single log
@@ -45,6 +46,14 @@
private VLSN lastSyncVLSN;
/*
+ * The last VLSN in this file which is a replicated commit record. Akin
+ * to lastSyncVLSN, but used specifically to determine if a syncup is
+ * rolling back past a committed txn, and therefore whether the syncup
+ * needs to be a hard recovery, or can just be a soft partial rollback.
+ */
+ private VLSN lastCommitVLSN;
+
+ /*
* The file offset is really an unsigned int on disk, but must be
* represented as a long in Java.
*/
@@ -60,6 +69,7 @@
this.fileNumber = fileNumber;
this.vlsnToFileOffsetMap = new HashMap();
lastSyncVLSN = VLSN.NULL_VLSN;
+ lastCommitVLSN = VLSN.NULL_VLSN;
}
/* For reading from disk */
@@ -78,6 +88,10 @@
return lastSyncVLSN;
}
+ public VLSN getLastCommitVLSN() {
+ return lastCommitVLSN;
+ }
+
public void writeToDatabase(Database fileMapperDb)
throws DatabaseException {
@@ -111,24 +125,33 @@
}
/** Record the LSN location for this VLSN. */
- public void putLSN(long vlsn, long lsn, boolean isSyncPoint) {
+ public void putLSN(long vlsn,
+ long lsn,
+ LogEntryType entryType) {
assert DbLsn.getFileNumber(lsn) == fileNumber:
"unexpected lsn file num=" + DbLsn.getFileNumber(lsn) +
" while file mapper file number=" + fileNumber;
vlsnToFileOffsetMap.put(vlsn, DbLsn.getFileOffset(lsn));
- if (isSyncPoint) {
-
+ if (entryType.isSyncPoint()) {
VLSN thisVLSN = new VLSN(vlsn);
if (lastSyncVLSN.compareTo(thisVLSN) < 0) {
lastSyncVLSN = thisVLSN;
}
}
+
+ if (LogEntryType.LOG_TXN_COMMIT.equals(entryType)) {
+ VLSN thisVLSN = new VLSN(vlsn);
+ if (lastCommitVLSN.compareTo(thisVLSN) < 0) {
+ lastCommitVLSN = thisVLSN;
+ }
+ }
+
dirty = true;
}
- /*
+ /**
* Put all the VLSN->LSN mappings in the file mapper parameter into this
* one.
*/
@@ -141,6 +164,10 @@
lastSyncVLSN = other.lastSyncVLSN;
}
+ if (lastCommitVLSN.compareTo(other.lastCommitVLSN) < 0) {
+ lastCommitVLSN = other.lastCommitVLSN;
+ }
+
dirty = true;
}
@@ -169,7 +196,8 @@
public String toString() {
StringBuilder sb = new StringBuilder("");
return sb.toString();
@@ -180,11 +208,13 @@
* Doesn't persist the file number, because that's the key of the database.
* TODO: use packed numbers for the map in HA release.
*/
- private static class FileMapperBinding extends TupleBinding {
+ private static class FileMapperBinding extends TupleBinding {
- public Object entryToObject(TupleInput ti) {
+ public FileMapper entryToObject(TupleInput ti) {
FileMapper mapper = new FileMapper();
mapper.lastSyncVLSN = new VLSN(ti.readPackedLong());
+ mapper.lastCommitVLSN = new VLSN(ti.readPackedLong());
+
mapper.vlsnToFileOffsetMap = new HashMap();
int nEntries = ti.readInt();
for (int i = 0; i < nEntries; i++) {
@@ -195,9 +225,10 @@
return mapper;
}
- public void objectToEntry(Object object, TupleOutput to) {
- FileMapper mapper = (FileMapper) object;
+ public void objectToEntry(FileMapper mapper, TupleOutput to) {
to.writePackedLong(mapper.lastSyncVLSN.getSequence());
+ to.writePackedLong(mapper.lastCommitVLSN.getSequence());
+
int nEntries = mapper.vlsnToFileOffsetMap.size();
to.writeInt(nEntries);
for (Map.Entry entry :
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/HexFormatter.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/HexFormatter.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/HexFormatter.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/HexFormatter.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: HexFormatter.java,v 1.13 2008/01/07 14:28:57 cwl Exp $
+ * $Id: HexFormatter.java,v 1.13.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/InternalException.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/InternalException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/InternalException.java 2008-05-20 17:52:38.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/InternalException.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: InternalException.java,v 1.19 2008/05/20 17:52:37 linda Exp $
+ * $Id: InternalException.java,v 1.19.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/JarMain.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/JarMain.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/JarMain.java 2008-05-15 01:52:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/JarMain.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: JarMain.java,v 1.7 2008/05/15 01:52:44 linda Exp $
+ * $Id: JarMain.java,v 1.7.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/PropUtil.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/PropUtil.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/PropUtil.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/PropUtil.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PropUtil.java,v 1.25 2008/01/07 14:28:57 cwl Exp $
+ * $Id: PropUtil.java,v 1.26.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
@@ -38,7 +38,8 @@
* @throws DatabaseException if the property bag contains
* a property not specified in the set of allowed properties.
*/
- public static Properties validateProps(Properties props,
+ @SuppressWarnings("unchecked")
+ public static Properties validateProps(Properties props,
Set allowedProps,
String apiMethod)
throws DatabaseException {
@@ -60,7 +61,8 @@
/**
* @throws DatabaseException if the property is not valid.
*/
- public static void validateProp(String propName,
+ @SuppressWarnings("unchecked")
+ public static void validateProp(String propName,
Set allowedProps,
String apiMethod)
throws DatabaseException {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/TestHookExecute.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/TestHookExecute.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/TestHookExecute.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/TestHookExecute.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: TestHookExecute.java,v 1.7 2008/01/07 14:28:57 cwl Exp $
+ * $Id: TestHookExecute.java,v 1.7.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/TestHook.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/TestHook.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/TestHook.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/TestHook.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: TestHook.java,v 1.11 2008/01/07 14:28:57 cwl Exp $
+ * $Id: TestHook.java,v 1.11.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/TinyHashSet.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/TinyHashSet.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/TinyHashSet.java 2008-05-15 01:52:44.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/TinyHashSet.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: TinyHashSet.java,v 1.9 2008/05/15 01:52:44 linda Exp $
+ * $Id: TinyHashSet.java,v 1.9.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/TracerFormatter.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/TracerFormatter.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/TracerFormatter.java 2008-05-13 01:44:54.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/TracerFormatter.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: TracerFormatter.java,v 1.5 2008/05/13 01:44:54 cwl Exp $
+ * $Id: TracerFormatter.java,v 1.5.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/Tracer.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/Tracer.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/Tracer.java 2008-01-17 17:22:16.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/Tracer.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Tracer.java,v 1.52 2008/01/17 17:22:15 cwl Exp $
+ * $Id: Tracer.java,v 1.53.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
@@ -212,6 +212,7 @@
return msg.equals(((Tracer) other).msg);
}
+ @Override
public String toString() {
return (time + "/" + msg);
}
@@ -223,6 +224,7 @@
/**
* Just in case it's ever used as a hash key.
*/
+ @Override
public int hashCode() {
return toString().hashCode();
}
@@ -230,6 +232,7 @@
/**
* Override Object.equals
*/
+ @Override
public boolean equals(Object obj) {
/* Same instance? */
if (this == obj) {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/VLSN.java libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/VLSN.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/utilint/VLSN.java 2008-05-13 01:44:54.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/utilint/VLSN.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: VLSN.java,v 1.22 2008/05/13 01:44:54 cwl Exp $
+ * $Id: VLSN.java,v 1.23.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.je.utilint;
@@ -37,6 +37,7 @@
public VLSN() {
}
+ @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
@@ -50,6 +51,7 @@
return (otherVLSN.sequence == sequence);
}
+ @Override
public int hashCode() {
return Long.valueOf(sequence).hashCode();
}
@@ -173,6 +175,7 @@
return sequence == ((VLSN) other).sequence;
}
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(sequence);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/VerifyConfig.java libdb-je-java-3.3.98/src/com/sleepycat/je/VerifyConfig.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/VerifyConfig.java 2008-01-07 14:28:46.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/VerifyConfig.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: VerifyConfig.java,v 1.15 2008/01/07 14:28:46 cwl Exp $
+ * $Id: VerifyConfig.java,v 1.16.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
@@ -180,8 +180,9 @@
*
* @return the values for each configuration attribute.
*/
+ @Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append("propagateExceptions=").append(propagateExceptions);
return sb.toString();
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/je/XAEnvironment.java libdb-je-java-3.3.98/src/com/sleepycat/je/XAEnvironment.java
--- libdb-je-java-3.3.62/src/com/sleepycat/je/XAEnvironment.java 2008-01-07 14:28:46.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/je/XAEnvironment.java 2010-01-04 15:30:28.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: XAEnvironment.java,v 1.14 2008/01/07 14:28:46 cwl Exp $
+ * $Id: XAEnvironment.java,v 1.14.2.2 2010/01/04 15:30:27 cwl Exp $
*/
package com.sleepycat.je;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/BasicCursor.java libdb-je-java-3.3.98/src/com/sleepycat/persist/BasicCursor.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/BasicCursor.java 2008-02-05 23:28:22.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/BasicCursor.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,15 +1,18 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: BasicCursor.java,v 1.12 2008/02/05 23:28:21 mark Exp $
+ * $Id: BasicCursor.java,v 1.12.2.3 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist;
import java.util.Iterator;
+/* */
+import com.sleepycat.je.CacheMode;
+/* */
import com.sleepycat.je.DatabaseEntry;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.LockMode;
@@ -199,6 +202,18 @@
cursor.close();
}
+ /* */
+ public void setCacheMode(CacheMode cacheMode) {
+ cursor.getCursor().setCacheMode(cacheMode);
+ }
+ /* */
+
+ /* */
+ public CacheMode getCacheMode() {
+ return cursor.getCursor().getCacheMode();
+ }
+ /* */
+
void checkInitialized()
throws IllegalStateException {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/BasicIndex.java libdb-je-java-3.3.98/src/com/sleepycat/persist/BasicIndex.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/BasicIndex.java 2008-02-06 19:48:02.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/BasicIndex.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: BasicIndex.java,v 1.14 2008/02/06 19:48:01 linda Exp $
+ * $Id: BasicIndex.java,v 1.14.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/BasicIterator.java libdb-je-java-3.3.98/src/com/sleepycat/persist/BasicIterator.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/BasicIterator.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/BasicIterator.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: BasicIterator.java,v 1.9 2008/01/07 14:28:58 cwl Exp $
+ * $Id: BasicIterator.java,v 1.9.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/DatabaseNamer.java libdb-je-java-3.3.98/src/com/sleepycat/persist/DatabaseNamer.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/DatabaseNamer.java 2008-02-20 16:52:56.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/DatabaseNamer.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DatabaseNamer.java,v 1.4 2008/02/20 16:52:55 linda Exp $
+ * $Id: DatabaseNamer.java,v 1.4.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/DataValueAdapter.java libdb-je-java-3.3.98/src/com/sleepycat/persist/DataValueAdapter.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/DataValueAdapter.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/DataValueAdapter.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DataValueAdapter.java,v 1.9 2008/01/07 14:28:58 cwl Exp $
+ * $Id: DataValueAdapter.java,v 1.9.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/EntityCursor.java libdb-je-java-3.3.98/src/com/sleepycat/persist/EntityCursor.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/EntityCursor.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/EntityCursor.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,15 +1,18 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EntityCursor.java,v 1.12 2008/01/07 14:28:58 cwl Exp $
+ * $Id: EntityCursor.java,v 1.12.2.3 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist;
import java.util.Iterator;
+/* */
+import com.sleepycat.je.CacheMode;
+/* */
import com.sleepycat.je.CursorConfig;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.LockMode;
@@ -603,4 +606,32 @@
*/
void close()
throws DatabaseException;
+
+ /* */
+ /**
+ * Changes the {@code CacheMode} used for operations performed using this
+ * cursor. For a newly opened cursor, the default is {@link
+ * CacheMode#DEFAULT}.
+ *
+ * @param cacheMode is the {@code CacheMode} to use for subsequent
+ * operations using this cursor.
+ *
+ * @see CacheMode
+ */
+ void setCacheMode(CacheMode cacheMode);
+ /* */
+
+ /* */
+ /**
+ * Returns the {@code CacheMode} used for operations performed using this
+ * cursor. For a newly opened cursor, the default is {@link
+ * CacheMode#DEFAULT}.
+ *
+ * @return the CacheMode object used for operations performed with this
+ * cursor.
+ *
+ * @see CacheMode
+ */
+ CacheMode getCacheMode();
+ /* */
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/EntityIndex.java libdb-je-java-3.3.98/src/com/sleepycat/persist/EntityIndex.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/EntityIndex.java 2008-01-24 14:59:30.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/EntityIndex.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EntityIndex.java,v 1.21 2008/01/24 14:59:30 linda Exp $
+ * $Id: EntityIndex.java,v 1.22.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist;
@@ -16,11 +16,11 @@
import com.sleepycat.je.CursorConfig;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseEntry;
-import com.sleepycat.je.DatabaseException;
+import com.sleepycat.je.DatabaseException; // for javadoc
import com.sleepycat.je.Environment;
import com.sleepycat.je.EnvironmentConfig;
import com.sleepycat.je.LockMode;
-import com.sleepycat.je.SecondaryDatabase;
+import com.sleepycat.je.SecondaryDatabase; // for javadoc
import com.sleepycat.je.Transaction;
/**
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/EntityJoin.java libdb-je-java-3.3.98/src/com/sleepycat/persist/EntityJoin.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/EntityJoin.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/EntityJoin.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EntityJoin.java,v 1.10 2008/01/07 14:28:58 cwl Exp $
+ * $Id: EntityJoin.java,v 1.10.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/EntityStore.java libdb-je-java-3.3.98/src/com/sleepycat/persist/EntityStore.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/EntityStore.java 2008-05-19 20:33:32.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/EntityStore.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EntityStore.java,v 1.35 2008/05/19 20:33:31 mark Exp $
+ * $Id: EntityStore.java,v 1.35.2.3 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist;
@@ -166,13 +166,6 @@
}
/**
- * Only public for debugging.
- */
- void dumpCatalog() {
- store.dumpCatalog();
- }
-
- /**
* Returns the environment associated with this store.
*
* @return the environment.
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/EntityValueAdapter.java libdb-je-java-3.3.98/src/com/sleepycat/persist/EntityValueAdapter.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/EntityValueAdapter.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/EntityValueAdapter.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EntityValueAdapter.java,v 1.8 2008/01/07 14:28:58 cwl Exp $
+ * $Id: EntityValueAdapter.java,v 1.8.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/Conversion.java libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/Conversion.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/Conversion.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/Conversion.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Conversion.java,v 1.12 2008/01/07 14:28:58 cwl Exp $
+ * $Id: Conversion.java,v 1.14.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.evolve;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/Converter.java libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/Converter.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/Converter.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/Converter.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Converter.java,v 1.11 2008/01/07 14:28:58 cwl Exp $
+ * $Id: Converter.java,v 1.11.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.evolve;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/DeletedClassException.java libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/DeletedClassException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/DeletedClassException.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/DeletedClassException.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DeletedClassException.java,v 1.9 2008/01/07 14:28:58 cwl Exp $
+ * $Id: DeletedClassException.java,v 1.9.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.evolve;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/Deleter.java libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/Deleter.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/Deleter.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/Deleter.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Deleter.java,v 1.9 2008/01/07 14:28:58 cwl Exp $
+ * $Id: Deleter.java,v 1.9.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.evolve;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/EntityConverter.java libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/EntityConverter.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/EntityConverter.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/EntityConverter.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EntityConverter.java,v 1.11 2008/01/07 14:28:58 cwl Exp $
+ * $Id: EntityConverter.java,v 1.11.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.evolve;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/EvolveConfig.java libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/EvolveConfig.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/EvolveConfig.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/EvolveConfig.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EvolveConfig.java,v 1.8 2008/01/07 14:28:58 cwl Exp $
+ * $Id: EvolveConfig.java,v 1.8.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.evolve;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/EvolveEvent.java libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/EvolveEvent.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/EvolveEvent.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/EvolveEvent.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EvolveEvent.java,v 1.5 2008/01/07 14:28:58 cwl Exp $
+ * $Id: EvolveEvent.java,v 1.5.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.evolve;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/EvolveInternal.java libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/EvolveInternal.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/EvolveInternal.java 2008-02-05 23:28:22.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/EvolveInternal.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EvolveInternal.java,v 1.6 2008/02/05 23:28:21 mark Exp $
+ * $Id: EvolveInternal.java,v 1.6.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.evolve;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/EvolveListener.java libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/EvolveListener.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/EvolveListener.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/EvolveListener.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EvolveListener.java,v 1.9 2008/01/07 14:28:58 cwl Exp $
+ * $Id: EvolveListener.java,v 1.9.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.evolve;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/EvolveStats.java libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/EvolveStats.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/EvolveStats.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/EvolveStats.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EvolveStats.java,v 1.8 2008/01/07 14:28:58 cwl Exp $
+ * $Id: EvolveStats.java,v 1.8.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.evolve;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/IncompatibleClassException.java libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/IncompatibleClassException.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/IncompatibleClassException.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/IncompatibleClassException.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: IncompatibleClassException.java,v 1.7 2008/01/07 14:28:58 cwl Exp $
+ * $Id: IncompatibleClassException.java,v 1.7.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.evolve;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/Mutation.java libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/Mutation.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/Mutation.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/Mutation.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Mutation.java,v 1.9 2008/01/07 14:28:58 cwl Exp $
+ * $Id: Mutation.java,v 1.9.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.evolve;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/Mutations.java libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/Mutations.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/Mutations.java 2008-05-19 20:28:26.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/Mutations.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Mutations.java,v 1.15 2008/05/19 20:28:25 mark Exp $
+ * $Id: Mutations.java,v 1.15.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.evolve;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/package.html libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/package.html
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/package.html 2008-02-05 23:28:22.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/package.html 2008-06-06 19:23:04.000000000 +0000
@@ -1,4 +1,4 @@
-
+
Utilities for managing class evolution of persistent objects.
@@ -237,8 +237,8 @@
The {@link com.sleepycat.persist.model.PrimaryKey#sequence} property may be
added, removed, or changed to a different name.
-
The {@link com.sleepycat.persist.model.Persistent#proxyFor} property may be
-NOT be added, removed, or changed to a different class.
+
The {@link com.sleepycat.persist.model.Persistent#proxyFor} property may NOT
+be added, removed, or changed to a different class.
Warnings on Testing and Backups
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/Renamer.java libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/Renamer.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/evolve/Renamer.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/evolve/Renamer.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Renamer.java,v 1.10 2008/01/07 14:28:58 cwl Exp $
+ * $Id: Renamer.java,v 1.10.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.evolve;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/ForwardCursor.java libdb-je-java-3.3.98/src/com/sleepycat/persist/ForwardCursor.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/ForwardCursor.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/ForwardCursor.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ForwardCursor.java,v 1.9 2008/01/07 14:28:58 cwl Exp $
+ * $Id: ForwardCursor.java,v 1.9.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/AbstractInput.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/AbstractInput.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/AbstractInput.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/AbstractInput.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: AbstractInput.java,v 1.5 2008/01/07 14:28:59 cwl Exp $
+ * $Id: AbstractInput.java,v 1.5.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/Accessor.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/Accessor.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/Accessor.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/Accessor.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Accessor.java,v 1.13 2008/01/07 14:28:59 cwl Exp $
+ * $Id: Accessor.java,v 1.13.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/Catalog.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/Catalog.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/Catalog.java 2008-03-18 19:38:08.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/Catalog.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Catalog.java,v 1.15 2008/03/18 18:38:08 mark Exp $
+ * $Id: Catalog.java,v 1.15.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/CollectionProxy.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/CollectionProxy.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/CollectionProxy.java 2008-05-13 16:29:36.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/CollectionProxy.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: CollectionProxy.java,v 1.11 2008/05/13 16:29:35 mark Exp $
+ * $Id: CollectionProxy.java,v 1.11.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/ComplexFormat.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/ComplexFormat.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/ComplexFormat.java 2008-05-13 01:45:02.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/ComplexFormat.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ComplexFormat.java,v 1.41 2008/05/13 01:45:02 cwl Exp $
+ * $Id: ComplexFormat.java,v 1.44.2.3 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -25,6 +25,7 @@
import com.sleepycat.persist.evolve.Renamer;
import com.sleepycat.persist.model.ClassMetadata;
import com.sleepycat.persist.model.EntityMetadata;
+import com.sleepycat.persist.model.EntityModel;
import com.sleepycat.persist.model.FieldMetadata;
import com.sleepycat.persist.model.Relationship;
import com.sleepycat.persist.model.SecondaryKeyMetadata;
@@ -53,7 +54,7 @@
private boolean evolveNeeded;
private transient Accessor objAccessor;
private transient Accessor rawAccessor;
- private transient Format entityFormat;
+ private transient ComplexFormat entityFormat;
private transient Map secKeyAddresses;
private transient volatile Map rawFields;
private transient volatile FieldInfo[] rawInputFields;
@@ -67,7 +68,7 @@
this.clsMeta = clsMeta;
this.entityMeta = entityMeta;
secKeyFields = new ArrayList();
- nonKeyFields = FieldInfo.getInstanceFields(cls);
+ nonKeyFields = FieldInfo.getInstanceFields(cls, clsMeta);
/*
* Validate primary key metadata and move primary key field from
@@ -176,23 +177,33 @@
}
@Override
- ClassMetadata getClassMetadata() {
+ public ClassMetadata getClassMetadata() {
return clsMeta;
}
@Override
- EntityMetadata getEntityMetadata() {
+ public EntityMetadata getEntityMetadata() {
return entityMeta;
}
@Override
- Format getEntityFormat() {
+ ComplexFormat getEntityFormat() {
if (isInitialized()) {
+ /* The transient entityFormat field is set by initialize(). */
return entityFormat;
} else {
- for (Format format = this;
+
+ /*
+ * If not initialized, the entity format can be found by traversing
+ * the super formats. However, this is only possible for an
+ * existing format which has its superFormat field set.
+ */
+ if (isNew()) {
+ throw new IllegalStateException(toString());
+ }
+ for (ComplexFormat format = this;
format != null;
- format = format.getSuperFormat()) {
+ format = format.getComplexSuper()) {
if (format.isEntity()) {
return format;
}
@@ -281,7 +292,7 @@
}
@Override
- void initialize(Catalog catalog, int initVersion) {
+ void initialize(Catalog catalog, EntityModel model, int initVersion) {
Class type = getType();
boolean useEnhanced = false;
if (type != null) {
@@ -289,13 +300,13 @@
}
/* Initialize all fields. */
if (priKeyField != null) {
- priKeyField.initialize(catalog, initVersion);
+ priKeyField.initialize(catalog, model, initVersion);
}
for (FieldInfo field : secKeyFields) {
- field.initialize(catalog, initVersion);
+ field.initialize(catalog, model, initVersion);
}
for (FieldInfo field : nonKeyFields) {
- field.initialize(catalog, initVersion);
+ field.initialize(catalog, model, initVersion);
}
/* Set the superclass format for a new (never initialized) format. */
ComplexFormat superFormat = getComplexSuper();
@@ -309,7 +320,7 @@
}
/* Initialize the superclass format and validate the super accessor. */
if (superFormat != null) {
- superFormat.initializeIfNeeded(catalog);
+ superFormat.initializeIfNeeded(catalog, model);
Accessor superAccessor = superFormat.objAccessor;
if (type != null && superAccessor != null) {
if (useEnhanced) {
@@ -330,14 +341,27 @@
}
}
/* Find entity format, if any. */
- for (Format format = this;
+ for (ComplexFormat format = this;
format != null;
- format = format.getSuperFormat()) {
+ format = format.getComplexSuper()) {
if (format.isEntity()) {
entityFormat = format;
break;
}
}
+
+ /*
+ * Ensure that the current entity metadata is always referenced in
+ * order to return it to the user and to properly construct secondary
+ * key addresses. Secondary key metadata can change in an entity
+ * subclass or be created when a new subclass is used, but this will
+ * not cause evolution of the entity class; instead, the metadata is
+ * updated here. [#16467]
+ */
+ if (isEntity() && isCurrentVersion()) {
+ entityMeta = model.getEntityMetadata(getClassName());
+ }
+
/* Disallow proxy class that extends an entity class. [#15950] */
if (clsMeta.getProxiedClassName() != null && entityFormat != null) {
throw new IllegalArgumentException
@@ -378,7 +402,7 @@
secKeyAddresses = new HashMap();
ComplexFormat thisLatest = getComplexLatest();
if (thisLatest != this) {
- thisLatest.initializeIfNeeded(catalog);
+ thisLatest.initializeIfNeeded(catalog, model);
}
nextKeyLoop:
for (SecondaryKeyMetadata secKeyMeta :
@@ -793,9 +817,32 @@
ComplexFormat newFormat = (ComplexFormat) newFormatParam;
Mutations mutations = evolver.getMutations();
boolean thisChanged = false;
- boolean superChanged = false;
+ boolean hierarchyChanged = false;
Map allKeyNameMap = new HashMap();
+ /* The Evolver has already ensured that entities evolve to entities. */
+ assert isEntity() == newFormat.isEntity();
+ assert isEntity() == (entityMeta != null);
+ assert newFormat.isEntity() == (newFormat.entityMeta != null);
+
+ /*
+ * Keep track of the old and new entity class names for use in deleting
+ * and renaming secondary keys below. If the oldEntityClass is
+ * non-null this also signifies an entity class or subclass. Note that
+ * getEntityFormat cannot be called on a newly created format during
+ * evolution because its super format property is not yet initialized.
+ * [#16253]
+ */
+ String oldEntityClass;
+ String newEntityClass;
+ if (isEntity()) {
+ oldEntityClass = getClassName();
+ newEntityClass = newFormat.getClassName();
+ } else {
+ oldEntityClass = null;
+ newEntityClass = null;
+ }
+
/*
* Evolve all superclass formats, even when a deleted class appears in
* the hierarchy. This ensures that the super format's
@@ -826,7 +873,7 @@
if (oldSuper.oldToNewKeyMap != null) {
allKeyNameMap.putAll(oldSuper.oldToNewKeyMap);
}
- superChanged = true;
+ hierarchyChanged = true;
}
}
@@ -852,13 +899,13 @@
if (getSuperFormat() == null) {
if (newFormatCls.getSuperclass() != Object.class) {
thisChanged = true;
- superChanged = true;
+ hierarchyChanged = true;
}
} else {
if (!getSuperFormat().getLatestVersion().getClassName().equals
(newFormatCls.getSuperclass().getName())) {
thisChanged = true;
- superChanged = true;
+ hierarchyChanged = true;
}
}
@@ -877,6 +924,12 @@
if (oldSuperName.equals(newSuper2.getName())) {
foundNewSuper = newSuper2;
newLevel = tryNewLevel;
+ if (oldSuper.isEntity()) {
+ assert oldEntityClass == null;
+ assert newEntityClass == null;
+ oldEntityClass = oldSuper.getClassName();
+ newEntityClass = foundNewSuper.getName();
+ }
break;
}
}
@@ -895,7 +948,7 @@
/*
* The class hierarchy changed -- a new class was inserted.
*/
- superChanged = true;
+ hierarchyChanged = true;
/*
* Check that the new formats skipped over above are not at
@@ -925,7 +978,7 @@
* The class hierarchy changed, since an old class no longer
* appears.
*/
- superChanged = true;
+ hierarchyChanged = true;
/* Check that the old class can be safely removed. */
if (!oldSuper.isDeleted()) {
@@ -943,7 +996,7 @@
}
}
- if (isEntity() && isCurrentVersion()) {
+ if (oldEntityClass != null && isCurrentVersion()) {
Map secKeys =
oldSuper.clsMeta.getSecondaryKeys();
for (FieldInfo field : oldSuper.secKeyFields) {
@@ -982,22 +1035,27 @@
return false;
}
- /* Rename the secondary databases. */
- if (allKeyNameMap.size() > 0 && isEntity() && isCurrentVersion()) {
+ /* Rename and delete the secondary databases. */
+ if (allKeyNameMap.size() > 0 &&
+ oldEntityClass != null &&
+ newEntityClass != null &&
+ isCurrentVersion()) {
for (Map.Entry entry : allKeyNameMap.entrySet()) {
- String oldKeyName = entry.getKey();
- String newKeyName = entry.getValue();
+ String oldKeyName = entry.getKey();
+ String newKeyName = entry.getValue();
if (newKeyName != null) {
evolver.renameSecondaryDatabase
- (this, newFormat, oldKeyName, newKeyName);
+ (oldEntityClass, newEntityClass,
+ oldKeyName, newKeyName);
} else {
- evolver.deleteSecondaryDatabase(this, oldKeyName);
+ evolver.deleteSecondaryDatabase
+ (oldEntityClass, oldKeyName);
}
}
}
/* Use an EvolveReader if needed. */
- if (superChanged || thisChanged) {
+ if (hierarchyChanged || thisChanged) {
Reader reader = new EvolveReader(newLevels);
evolver.useEvolvedFormat(this, reader, newFormat);
} else {
@@ -1041,7 +1099,7 @@
String keyName = oldMeta.getKeyName();
if (deletedKeys.contains(keyName)) {
if (isCurrentVersion()) {
- evolver.deleteSecondaryDatabase(this, keyName);
+ evolver.deleteSecondaryDatabase(getClassName(), keyName);
}
} else {
SecondaryKeyMetadata newMeta = newSecondaryKeys.get(keyName);
@@ -1172,14 +1230,14 @@
/* Evolve primary key field. */
boolean evolveFailure = false;
- boolean evolveNeeded = false;
+ boolean localEvolveNeeded = false;
if (priKeyField != null) {
int result = evolver.evolveRequiredKeyField
(this, newFormat, priKeyField, newFormat.priKeyField);
if (result == Evolver.EVOLVE_FAILURE) {
evolveFailure = true;
} else if (result == Evolver.EVOLVE_NEEDED) {
- evolveNeeded = true;
+ localEvolveNeeded = true;
}
}
@@ -1190,7 +1248,7 @@
if (reader == FieldReader.EVOLVE_FAILURE) {
evolveFailure = true;
} else if (reader != null) {
- evolveNeeded = true;
+ localEvolveNeeded = true;
}
if (reader != FieldReader.EVOLVE_NEEDED) {
secKeyFieldReader = reader;
@@ -1203,7 +1261,7 @@
if (reader == FieldReader.EVOLVE_FAILURE) {
evolveFailure = true;
} else if (reader != null) {
- evolveNeeded = true;
+ localEvolveNeeded = true;
}
if (reader != FieldReader.EVOLVE_NEEDED) {
nonKeyFieldReader = reader;
@@ -1212,7 +1270,7 @@
/* Return result. */
if (evolveFailure) {
return Evolver.EVOLVE_FAILURE;
- } else if (evolveNeeded) {
+ } else if (localEvolveNeeded) {
return Evolver.EVOLVE_NEEDED;
} else {
return Evolver.EVOLVE_NONE;
@@ -1246,7 +1304,7 @@
Evolver evolver) {
Mutations mutations = evolver.getMutations();
boolean evolveFailure = false;
- boolean evolveNeeded = false;
+ boolean localEvolveNeeded = false;
boolean readerNeeded = false;
List fieldReaders = new ArrayList();
FieldReader currentReader = null;
@@ -1311,7 +1369,7 @@
newField = otherNewFields.get(newFieldIndex);
isNewSecKeyField = !isOldSecKeyField;
}
- evolveNeeded = true;
+ localEvolveNeeded = true;
readerNeeded = true;
}
@@ -1334,7 +1392,7 @@
(oldFieldIndex, oldField);
fieldReaders.add(currentReader);
readerNeeded = true;
- evolveNeeded = true;
+ localEvolveNeeded = true;
}
if (isOldSecKeyField) {
if (oldToNewKeyMap == null) {
@@ -1385,7 +1443,7 @@
oldToNewKeyMap = new HashMap();
}
oldToNewKeyMap.put(oldName, newName);
- evolveNeeded = true;
+ localEvolveNeeded = true;
}
} else if (isOldSecKeyField && !isNewSecKeyField) {
if (oldToNewKeyMap == null) {
@@ -1408,7 +1466,7 @@
isNewSecKeyField);
fieldReaders.add(currentReader);
readerNeeded = true;
- evolveNeeded = true;
+ localEvolveNeeded = true;
}
continue fieldLoop;
}
@@ -1464,7 +1522,7 @@
/* Formats are identical. Fall through. */
} else if (allClassesConverted) {
/* All old classes will be converted. Fall through. */
- evolveNeeded = true;
+ localEvolveNeeded = true;
} else if (WidenerInput.isWideningSupported
(oldLatestFormat, newFieldFormat, isOldSecKeyField)) {
/* Apply field widener and continue. */
@@ -1473,7 +1531,7 @@
isNewSecKeyField);
fieldReaders.add(currentReader);
readerNeeded = true;
- evolveNeeded = true;
+ localEvolveNeeded = true;
continue fieldLoop;
} else {
boolean refWidened = false;
@@ -1489,7 +1547,7 @@
}
if (refWidened) {
/* A reference type has been widened. Fall through. */
- evolveNeeded = true;
+ localEvolveNeeded = true;
} else {
/* Types are not compatible. */
evolver.addMissingMutation
@@ -1527,7 +1585,7 @@
* @SecondaryKey). [#15524]
*/
if (newFieldsMatched < newFields.size()) {
- evolveNeeded = true;
+ localEvolveNeeded = true;
readerNeeded = true;
}
@@ -1541,7 +1599,7 @@
} else {
return new MultiFieldReader(fieldReaders);
}
- } else if (evolveNeeded) {
+ } else if (localEvolveNeeded) {
return FieldReader.EVOLVE_NEEDED;
} else {
return null;
@@ -1903,12 +1961,13 @@
}
public void initializeReader(Catalog catalog,
+ EntityModel model,
int initVersion,
Format oldFormatParam) {
ComplexFormat oldFormat = (ComplexFormat) oldFormatParam;
newFormat = oldFormat.getComplexLatest();
- newFormat.initializeIfNeeded(catalog);
+ newFormat.initializeIfNeeded(catalog, model);
/* Create newHierarchy array. */
int newDepth = 0;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/CompositeKeyFormat.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/CompositeKeyFormat.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/CompositeKeyFormat.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/CompositeKeyFormat.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: CompositeKeyFormat.java,v 1.26 2008/01/07 14:28:59 cwl Exp $
+ * $Id: CompositeKeyFormat.java,v 1.27.2.3 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -16,6 +16,7 @@
import java.util.Map;
import com.sleepycat.persist.model.ClassMetadata;
+import com.sleepycat.persist.model.EntityModel;
import com.sleepycat.persist.model.FieldMetadata;
import com.sleepycat.persist.raw.RawField;
import com.sleepycat.persist.raw.RawObject;
@@ -97,7 +98,8 @@
}
/* Populate fields list in fieldNames order. */
- List instanceFields = FieldInfo.getInstanceFields(cls);
+ List instanceFields =
+ FieldInfo.getInstanceFields(cls, metadata);
fields = new ArrayList(instanceFields.size());
for (String fieldName : fieldNames) {
FieldInfo field = null;
@@ -141,7 +143,7 @@
}
@Override
- ClassMetadata getClassMetadata() {
+ public ClassMetadata getClassMetadata() {
if (metadata == null) {
throw new IllegalStateException(getClassName());
}
@@ -178,10 +180,10 @@
}
@Override
- void initialize(Catalog catalog, int initVersion) {
+ void initialize(Catalog catalog, EntityModel model, int initVersion) {
/* Initialize all fields. */
for (FieldInfo field : fields) {
- field.initialize(catalog, initVersion);
+ field.initialize(catalog, model, initVersion);
}
/* Create the accessor. */
Class type = getType();
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/ConverterReader.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/ConverterReader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/ConverterReader.java 2008-06-03 04:52:24.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/ConverterReader.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,13 +1,14 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ConverterReader.java,v 1.10 2008/06/03 04:52:23 mark Exp $
+ * $Id: ConverterReader.java,v 1.10.2.3 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
+import com.sleepycat.persist.model.EntityModel;
import com.sleepycat.persist.evolve.Converter;
import com.sleepycat.persist.raw.RawObject;
@@ -28,6 +29,7 @@
}
public void initializeReader(Catalog catalog,
+ EntityModel model,
int initVersion,
Format oldFormat) {
this.oldFormat = oldFormat;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/EnhancedAccessor.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/EnhancedAccessor.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/EnhancedAccessor.java 2008-03-18 19:38:08.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/EnhancedAccessor.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EnhancedAccessor.java,v 1.15 2008/03/18 18:38:08 mark Exp $
+ * $Id: EnhancedAccessor.java,v 1.15.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/Enhanced.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/Enhanced.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/Enhanced.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/Enhanced.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Enhanced.java,v 1.12 2008/01/07 14:28:59 cwl Exp $
+ * $Id: Enhanced.java,v 1.12.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/EntityInput.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/EntityInput.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/EntityInput.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/EntityInput.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EntityInput.java,v 1.19 2008/01/07 14:28:59 cwl Exp $
+ * $Id: EntityInput.java,v 1.19.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/EntityOutput.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/EntityOutput.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/EntityOutput.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/EntityOutput.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EntityOutput.java,v 1.16 2008/01/07 14:28:59 cwl Exp $
+ * $Id: EntityOutput.java,v 1.16.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/EnumFormat.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/EnumFormat.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/EnumFormat.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/EnumFormat.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EnumFormat.java,v 1.22 2008/01/07 14:28:59 cwl Exp $
+ * $Id: EnumFormat.java,v 1.22.2.3 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -16,6 +16,7 @@
import java.util.Map;
import java.util.Set;
+import com.sleepycat.persist.model.EntityModel;
import com.sleepycat.persist.raw.RawObject;
/**
@@ -59,7 +60,7 @@
}
@Override
- void initialize(Catalog catalog, int initVersion) {
+ void initialize(Catalog catalog, EntityModel model, int initVersion) {
if (values == null) {
Class cls = getType();
if (cls != null) {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/Evolver.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/Evolver.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/Evolver.java 2008-02-06 19:48:02.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/Evolver.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Evolver.java,v 1.14 2008/02/06 19:48:02 linda Exp $
+ * $Id: Evolver.java,v 1.15.2.3 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -213,7 +213,7 @@
* Called by PersistCatalog after calling evolveFormat or
* addNonEntityFormat for all old formats.
*
- * We do not require deletion of an unreferenced class for three
+ * We do not require deletion of an unreferenced class for two
* reasons: 1) built-in proxy classes may not be referenced, 2) the
* user may wish to declare persistent classes that are not yet used.
*/
@@ -221,12 +221,7 @@
/* Process unreferenced classes. */
for (Format oldFormat : unprocessedFormats) {
oldFormat.setUnused(true);
- Integer oldFormatId = oldFormat.getId();
- if (!evolvedFormats.containsKey(oldFormatId)) {
- evolvedFormats.put(oldFormatId, true);
- boolean result = evolveFormatInternal(oldFormat);
- evolvedFormats.put(oldFormatId, result);
- }
+ evolveFormat(oldFormat);
}
}
@@ -235,9 +230,12 @@
* methods for all potentially referenced non-entity formats.
*/
boolean evolveFormat(Format oldFormat) {
+ if (oldFormat.isNew()) {
+ return true;
+ }
boolean result;
- boolean trackEntityChanges =
- oldFormat.getLatestVersion().getEntityFormat() != null;
+ Format oldEntityFormat = oldFormat.getEntityFormat();
+ boolean trackEntityChanges = oldEntityFormat != null;
boolean saveNestedFormatsChanged = nestedFormatsChanged;
if (trackEntityChanges) {
nestedFormatsChanged = false;
@@ -255,7 +253,7 @@
}
if (trackEntityChanges) {
if (nestedFormatsChanged) {
- Format latest = oldFormat.getLatestVersion().getEntityFormat();
+ Format latest = oldEntityFormat.getLatestVersion();
if (latest != null) {
latest.setEvolveNeeded(true);
}
@@ -354,9 +352,11 @@
newFormat.getPreviousVersion() == null) {
assert newFormats.containsValue(newFormat);
Format oldLatestFormat = oldFormat.getLatestVersion();
- evolveFormat(oldLatestFormat);
+ if (!evolveFormat(oldLatestFormat)) {
+ return false;
+ }
if (oldLatestFormat == oldLatestFormat.getLatestVersion()) {
- assert !newFormats.containsValue(newFormat);
+ assert !newFormats.containsValue(newFormat) : newFormat;
/* newFormat equals oldLatestFormat and was discarded. */
newFormat = oldLatestFormat;
}
@@ -380,7 +380,7 @@
/* Apply class Renamer and continue if successful. */
if (renamer != null) {
- if (!applyRenamer(renamer, oldFormat, newFormat)) {
+ if (!applyClassRenamer(renamer, oldFormat, newFormat)) {
return false;
}
}
@@ -415,7 +415,7 @@
"@Entity or @Persistent annotation is still present");
return false;
}
- return applyDeleter(deleter, oldFormat, newFormat);
+ return applyClassDeleter(deleter, oldFormat, newFormat);
} else {
if (needDeleter) {
if (newFormat == null) {
@@ -456,8 +456,23 @@
assert renamedFormat == newFormat;
useEvolvedFormat(oldFormat, renamedFormat, renamedFormat);
} else if (newFormat != null &&
- oldFormat.getVersion() != newFormat.getVersion()) {
- /* The user wants a new version number, but no other changes. */
+ (oldFormat.getVersion() != newFormat.getVersion() ||
+ !oldFormat.isCurrentVersion())) {
+
+ /*
+ * If the user wants a new version number, but ther are no other
+ * changes, we will oblige. Or, if an attempt is being made to
+ * use an old version, then the following events happened and we
+ * must evolve the old format:
+ * 1) The (previously) latest version of the format was evolved
+ * because it is not equal to the live class version. Note that
+ * evolveFormatInternal always evolves the latest version first.
+ * 2) We are now attempting to evolve an older version of the same
+ * format, and it happens to be equal to the live class version.
+ * However, we're already committed to the new format, and we must
+ * evolve all versions.
+ * [#16467]
+ */
useEvolvedFormat(oldFormat, newFormat, newFormat);
} else {
/* The new format is discarded. */
@@ -482,9 +497,9 @@
setFormatsChanged(oldFormat);
}
- private boolean applyRenamer(Renamer renamer,
- Format oldFormat,
- Format newFormat) {
+ private boolean applyClassRenamer(Renamer renamer,
+ Format oldFormat,
+ Format newFormat) {
if (!checkUpdatedVersion(renamer, oldFormat, newFormat)) {
return false;
}
@@ -517,20 +532,18 @@
/**
* Called by ComplexFormat when a secondary key name is changed.
*/
- void renameSecondaryDatabase(Format oldFormat,
- Format newFormat,
+ void renameSecondaryDatabase(String oldEntityClass,
+ String newEntityClass,
String oldKeyName,
String newKeyName) {
renameDbs.put
- (Store.makeSecDbName
- (storePrefix, oldFormat.getClassName(), oldKeyName),
- Store.makeSecDbName
- (storePrefix, newFormat.getClassName(), newKeyName));
+ (Store.makeSecDbName(storePrefix, oldEntityClass, oldKeyName),
+ Store.makeSecDbName(storePrefix, newEntityClass, newKeyName));
}
- private boolean applyDeleter(Deleter deleter,
- Format oldFormat,
- Format newFormat) {
+ private boolean applyClassDeleter(Deleter deleter,
+ Format oldFormat,
+ Format newFormat) {
if (!checkUpdatedVersion(deleter, oldFormat, newFormat)) {
return false;
}
@@ -546,7 +559,7 @@
}
/*
- * Set the format to deleted last, so that the above test using
+ * Set the format to deleted last, so that the above test using
* isCurrentVersion works properly.
*/
oldFormat.setDeleted(true);
@@ -561,9 +574,9 @@
/**
* Called by ComplexFormat when a secondary key is dropped.
*/
- void deleteSecondaryDatabase(Format oldFormat, String keyName) {
+ void deleteSecondaryDatabase(String oldEntityClass, String keyName) {
deleteDbs.add(Store.makeSecDbName
- (storePrefix, oldFormat.getClassName(), keyName));
+ (storePrefix, oldEntityClass, keyName));
}
private boolean applyConverter(Converter converter,
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/FieldInfo.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/FieldInfo.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/FieldInfo.java 2008-06-03 04:52:24.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/FieldInfo.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: FieldInfo.java,v 1.24 2008/06/03 04:52:23 mark Exp $
+ * $Id: FieldInfo.java,v 1.25.2.3 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -12,10 +12,14 @@
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.Map;
+import com.sleepycat.persist.model.EntityModel;
import com.sleepycat.persist.raw.RawField;
+import com.sleepycat.persist.model.FieldMetadata;
+import com.sleepycat.persist.model.ClassMetadata;
/**
* A field definition used by ComplexFormat and CompositeKeyFormat.
@@ -35,14 +39,52 @@
* Returns a list of all non-transient non-static fields that are declared
* in the given class.
*/
- static List getInstanceFields(Class cls) {
- Field[] declaredFields = cls.getDeclaredFields();
- List fields =
- new ArrayList(declaredFields.length);
- for (Field field : declaredFields) {
- int mods = field.getModifiers();
- if (!Modifier.isTransient(mods) && !Modifier.isStatic(mods)) {
- fields.add(new FieldInfo(field));
+ static List getInstanceFields(Class cls,
+ ClassMetadata clsMeta) {
+ List fields = null;
+ if (clsMeta != null) {
+ Collection persistentFields =
+ clsMeta.getPersistentFields();
+ if (persistentFields != null) {
+ fields = new ArrayList(persistentFields.size());
+ String clsName = cls.getName();
+ for (FieldMetadata fieldMeta : persistentFields) {
+ if (!clsName.equals(fieldMeta.getDeclaringClassName())) {
+ throw new IllegalArgumentException
+ ("Persistent field " + fieldMeta +
+ " must be declared in " + clsName);
+ }
+ Field field;
+ try {
+ field = cls.getDeclaredField(fieldMeta.getName());
+ } catch (NoSuchFieldException e) {
+ throw new IllegalArgumentException
+ ("Persistent field " + fieldMeta +
+ " is not declared in this class");
+ }
+ if (!field.getType().getName().equals
+ (fieldMeta.getClassName())) {
+ throw new IllegalArgumentException
+ ("Persistent field " + fieldMeta +
+ " must be of type " + field.getType().getName());
+ }
+ if (Modifier.isStatic(field.getModifiers())) {
+ throw new IllegalArgumentException
+ ("Persistent field " + fieldMeta +
+ " may not be static");
+ }
+ fields.add(new FieldInfo(field));
+ }
+ }
+ }
+ if (fields == null) {
+ Field[] declaredFields = cls.getDeclaredFields();
+ fields = new ArrayList(declaredFields.length);
+ for (Field field : declaredFields) {
+ int mods = field.getModifiers();
+ if (!Modifier.isTransient(mods) && !Modifier.isStatic(mods)) {
+ fields.add(new FieldInfo(field));
+ }
}
}
return fields;
@@ -98,7 +140,7 @@
}
}
- void initialize(Catalog catalog, int initVersion) {
+ void initialize(Catalog catalog, EntityModel model, int initVersion) {
/*
* Reset the format if it was never initialized, which can occur when a
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/Format.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/Format.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/Format.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/Format.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Format.java,v 1.39 2008/01/07 14:28:59 cwl Exp $
+ * $Id: Format.java,v 1.40.2.3 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -18,6 +18,10 @@
import com.sleepycat.persist.evolve.Converter;
import com.sleepycat.persist.model.ClassMetadata;
import com.sleepycat.persist.model.EntityMetadata;
+import com.sleepycat.persist.model.EntityModel;
+import com.sleepycat.persist.model.FieldMetadata;
+import com.sleepycat.persist.model.PrimaryKeyMetadata;
+import com.sleepycat.persist.model.SecondaryKeyMetadata;
import com.sleepycat.persist.raw.RawField;
import com.sleepycat.persist.raw.RawObject;
import com.sleepycat.persist.raw.RawType;
@@ -339,7 +343,7 @@
/**
* Returns the format ID.
*/
- final int getId() {
+ public final int getId() {
return id;
}
@@ -511,7 +515,7 @@
* bidirectional dependencies. This method will do nothing if the format
* is already intialized.
*/
- final void initializeIfNeeded(Catalog catalog) {
+ final void initializeIfNeeded(Catalog catalog, EntityModel model) {
if (!initialized) {
initialized = true;
this.catalog = catalog;
@@ -535,10 +539,11 @@
}
/* Perform subclass-specific initialization. */
- initialize
- (catalog, catalog.getInitVersion(this, false /*forReader*/));
+ initialize(catalog, model,
+ catalog.getInitVersion(this, false /*forReader*/));
reader.initializeReader
- (catalog, catalog.getInitVersion(this, true /*forReader*/),
+ (catalog, model,
+ catalog.getInitVersion(this, true /*forReader*/),
this);
}
}
@@ -548,6 +553,7 @@
* called when no separate Reader exists, and does nothing.
*/
public void initializeReader(Catalog catalog,
+ EntityModel model,
int initVersion,
Format oldFormat) {
}
@@ -639,6 +645,14 @@
return null;
}
+ public ClassMetadata getClassMetadata() {
+ return null;
+ }
+
+ public EntityMetadata getEntityMetadata() {
+ return null;
+ }
+
/* -- End of RawType methods. -- */
/* -- Methods that may optionally be overridden by subclasses. -- */
@@ -680,26 +694,10 @@
}
/**
- * Returns the original model class metadata used to create this class, or
- * null if this is not a model class.
- */
- ClassMetadata getClassMetadata() {
- return null;
- }
-
- /**
- * Returns the original model entity metadata used to create this class, or
- * null if this is not an entity class.
- */
- EntityMetadata getEntityMetadata() {
- return null;
- }
-
- /**
* For an entity class or subclass, returns the base entity class; returns
* null in other cases.
*/
- Format getEntityFormat() {
+ ComplexFormat getEntityFormat() {
return null;
}
@@ -707,12 +705,17 @@
* Called for an existing format that may not equal the current format for
* the same class.
*
- *
If this method returns true, then it must have determined that the
- * old and new formats are equal, and it must have called either
- * Evolver.useOldFormat or useEvolvedFormat. If this method returns false,
- * then it must have determined that the old format could not be evolved to
- * the new format, and it must have called Evolver.addInvalidMutation,
- * addMissingMutation or addEvolveError.
+ *
If this method returns true, then it must have determined one of two
+ * things:
+ * - that the old and new formats are equal, and it must have called
+ * Evolver.useOldFormat; or
+ * - that the old format can be evolved to the new format, and it must
+ * have called Evolver.useEvolvedFormat.
+ *
+ *
If this method returns false, then it must have determined that the
+ * old format could not be evolved to the new format, and it must have
+ * called Evolver.addInvalidMutation, addMissingMutation or
+ * addEvolveError.
*/
abstract boolean evolve(Format newFormat, Evolver evolver);
@@ -748,7 +751,9 @@
* Initializes an uninitialized format, initializing its related formats
* (superclass formats and array component formats) first.
*/
- abstract void initialize(Catalog catalog, int initVersion);
+ abstract void initialize(Catalog catalog,
+ EntityModel model,
+ int initVersion);
/**
* Calls catalog.createFormat for formats that this format depends on, or
@@ -926,11 +931,173 @@
@Override
public String toString() {
- return "[RawType class: " + getClassName() +
- " version: " + getVersion() +
- " internal: " + getClass().getName() +
- ((reader != null) ?
- (" reader: " + reader.getClass().getName()) : "") +
- ']';
+ final String INDENT = " ";
+ final String INDENT2 = INDENT + " ";
+ StringBuffer buf = new StringBuffer(500);
+ if (isSimple()) {
+ addTypeHeader(buf, "SimpleType");
+ buf.append(" primitive=\"");
+ buf.append(isPrimitive());
+ buf.append("\"/>\n");
+ } else if (isEnum()) {
+ addTypeHeader(buf, "EnumType");
+ buf.append(">\n");
+ for (String constant : getEnumConstants()) {
+ buf.append(INDENT);
+ buf.append("");
+ buf.append(constant);
+ buf.append("\n");
+ }
+ buf.append("\n");
+ } else if (isArray()) {
+ addTypeHeader(buf, "ArrayType");
+ buf.append(" componentId=\"");
+ buf.append(getComponentType().getVersion());
+ buf.append("\" componentClass=\"");
+ buf.append(getComponentType().getClassName());
+ buf.append("\" dimensions=\"");
+ buf.append(getDimensions());
+ buf.append("\"/>\n");
+ } else {
+ addTypeHeader(buf, "ComplexType");
+ Format superType = getSuperType();
+ if (superType != null) {
+ buf.append(" superTypeId=\"");
+ buf.append(superType.getId());
+ buf.append("\" superTypeClass=\"");
+ buf.append(superType.getClassName());
+ buf.append('"');
+ }
+ Format proxiedFormat = getProxiedFormat();
+ if (proxiedFormat != null) {
+ buf.append(" proxiedTypeId=\"");
+ buf.append(proxiedFormat.getId());
+ buf.append("\" proxiedTypeClass=\"");
+ buf.append(proxiedFormat.getClassName());
+ buf.append('"');
+ }
+ PrimaryKeyMetadata priMeta = null;
+ Map secondaryKeys = null;
+ List compositeKeyFields = null;
+ ClassMetadata clsMeta = getClassMetadata();
+ if (clsMeta != null) {
+ compositeKeyFields = clsMeta.getCompositeKeyFields();
+ priMeta = clsMeta.getPrimaryKey();
+ secondaryKeys = clsMeta.getSecondaryKeys();
+ }
+ buf.append(" kind=\"");
+ buf.append(isEntity() ? "entity" :
+ ((compositeKeyFields != null) ? "compositeKey" :
+ "persistent"));
+ buf.append("\">\n");
+ Map fields = getFields();
+ if (fields != null) {
+ for (RawField field : fields.values()) {
+ String name = field.getName();
+ RawType type = field.getType();
+ buf.append(INDENT);
+ buf.append("\n");
+ }
+ EntityMetadata entMeta = getEntityMetadata();
+ if (entMeta != null) {
+ buf.append(INDENT);
+ buf.append("\n");
+ priMeta = entMeta.getPrimaryKey();
+ if (priMeta != null) {
+ buf.append(INDENT2);
+ buf.append("\n");
+ }
+ secondaryKeys = entMeta.getSecondaryKeys();
+ if (secondaryKeys != null) {
+ for (SecondaryKeyMetadata secMeta :
+ secondaryKeys.values()) {
+ buf.append(INDENT2);
+ buf.append("\n");
+ }
+ }
+ buf.append("\n");
+ }
+ }
+ buf.append("\n");
+ }
+ return buf.toString();
+ }
+
+ private void addTypeHeader(StringBuffer buf, String elemName) {
+ buf.append('<');
+ buf.append(elemName);
+ buf.append(" id=\"");
+ buf.append(getId());
+ buf.append("\" class=\"");
+ buf.append(getClassName());
+ buf.append("\" version=\"");
+ buf.append(getVersion());
+ buf.append('"');
+ Format currVersion = getLatestVersion();
+ if (currVersion != null) {
+ buf.append(" currentVersionId=\"");
+ buf.append(currVersion.getId());
+ buf.append('"');
+ }
+ Format prevVersion = getPreviousVersion();
+ if (prevVersion != null) {
+ buf.append(" previousVersionId=\"");
+ buf.append(prevVersion.getId());
+ buf.append('"');
+ }
}
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/KeyLocation.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/KeyLocation.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/KeyLocation.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/KeyLocation.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: KeyLocation.java,v 1.6 2008/01/07 14:28:59 cwl Exp $
+ * $Id: KeyLocation.java,v 1.6.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/MapProxy.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/MapProxy.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/MapProxy.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/MapProxy.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: MapProxy.java,v 1.6 2008/01/07 14:28:59 cwl Exp $
+ * $Id: MapProxy.java,v 1.6.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/NonPersistentFormat.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/NonPersistentFormat.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/NonPersistentFormat.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/NonPersistentFormat.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: NonPersistentFormat.java,v 1.14 2008/01/07 14:28:59 cwl Exp $
+ * $Id: NonPersistentFormat.java,v 1.14.2.3 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -11,6 +11,8 @@
import java.lang.reflect.Array;
import java.util.Map;
+import com.sleepycat.persist.model.EntityModel;
+
/**
* Format for a non-persistent class that is only used for declared field
* types and arrays. Currently used only for Object and interface types.
@@ -26,7 +28,7 @@
}
@Override
- void initialize(Catalog catalog, int initVersion) {
+ void initialize(Catalog catalog, EntityModel model, int initVersion) {
}
@Override
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/ObjectArrayFormat.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/ObjectArrayFormat.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/ObjectArrayFormat.java 2008-06-03 04:52:24.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/ObjectArrayFormat.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ObjectArrayFormat.java,v 1.27 2008/06/03 04:52:23 mark Exp $
+ * $Id: ObjectArrayFormat.java,v 1.27.2.3 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -14,6 +14,7 @@
import java.util.Set;
import com.sleepycat.je.DatabaseEntry;
+import com.sleepycat.persist.model.EntityModel;
import com.sleepycat.persist.raw.RawObject;
/**
@@ -71,7 +72,7 @@
}
@Override
- void initialize(Catalog catalog, int initVersion) {
+ void initialize(Catalog catalog, EntityModel model, int initVersion) {
/* Set the component format for a new (never initialized) format. */
if (componentFormat == null) {
Class cls = getType().getComponentType();
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/PersistCatalog.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/PersistCatalog.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/PersistCatalog.java 2008-03-18 19:38:08.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/PersistCatalog.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PersistCatalog.java,v 1.46 2008/03/18 18:38:08 mark Exp $
+ * $Id: PersistCatalog.java,v 1.47.2.3 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -17,6 +17,7 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
@@ -44,6 +45,7 @@
import com.sleepycat.persist.model.EntityMetadata;
import com.sleepycat.persist.model.EntityModel;
import com.sleepycat.persist.raw.RawObject;
+import com.sleepycat.persist.raw.RawType;
import com.sleepycat.util.RuntimeExceptionWrapper;
/**
@@ -264,12 +266,12 @@
}
}
}
+ model = new StoredModel(this);
for (Format format : formatList) {
if (format != null) {
- format.initializeIfNeeded(this);
+ format.initializeIfNeeded(this, model);
}
}
- model = new StoredModel(this);
success = true;
return;
}
@@ -374,7 +376,7 @@
/* Initialize all formats. */
for (Format format : formatList) {
if (format != null) {
- format.initializeIfNeeded(this);
+ format.initializeIfNeeded(this, model);
if (format == format.getLatestVersion()) {
latestFormatMap.put(format.getClassName(), format);
}
@@ -547,9 +549,10 @@
}
/**
- * If the given class format is not already present in the given map,
- * creates an uninitialized format, adds it to the map, and also collects
- * related formats in the map.
+ * If the given class format is not already present in the given map and
+ * a format for this class name does not already exist, creates an
+ * uninitialized format, adds it to the map, and also collects related
+ * formats in the map.
*/
public Format createFormat(Class type, Map newFormats) {
/* Return a new or existing format for this class. */
@@ -653,7 +656,20 @@
classes.add(format.getClassName());
}
}
- return classes;
+ return Collections.unmodifiableSet(classes);
+ }
+
+ /**
+ * Returns all formats as RawTypes.
+ */
+ public List getAllRawTypes() {
+ List list = new ArrayList();
+ for (RawType type : formatList) {
+ if (type != null) {
+ list.add(type);
+ }
+ }
+ return Collections.unmodifiableList(list);
}
/**
@@ -798,7 +814,7 @@
Catalog newFormatCatalog =
new ReadOnlyCatalog(newFormatList, newFormatMap);
for (Format newFormat : newFormats.values()) {
- newFormat.initializeIfNeeded(newFormatCatalog);
+ newFormat.initializeIfNeeded(newFormatCatalog, model);
newLatestFormatMap.put(newFormat.getClassName(), newFormat);
}
@@ -918,11 +934,24 @@
public Object convertRawObject(RawObject o, IdentityHashMap converted) {
Format format = (Format) o.getType();
if (this != format.getCatalog()) {
- String className = format.getClassName();
- format = getFormat(className);
+
+ /*
+ * Use the corresponding format in this catalog when the external
+ * raw object was created using a different catalog. Create the
+ * format if it does not already exist, for example, when this
+ * store is empty. [#16253].
+ */
+ String clsName = format.getClassName();
+ Class cls;
+ try {
+ cls = SimpleCatalog.classForName(clsName);
+ format = getFormat(cls, true /*openEntitySubclassIndexes*/);
+ } catch (ClassNotFoundException e) {
+ format = null;
+ }
if (format == null) {
throw new IllegalArgumentException
- ("External raw type not found: " + className);
+ ("External raw type not found: " + clsName);
}
}
Format proxiedFormat = format.getProxiedFormat();
@@ -934,19 +963,4 @@
}
return format.convertRawObject(this, false, o, converted);
}
-
- public void dump() {
- System.out.println("--- Begin formats ---");
- for (Format format : formatList) {
- if (format != null) {
- System.out.println
- ("ID: " + format.getId() +
- " class: " + format.getClassName() +
- " version: " + format.getVersion() +
- " current: " +
- (format == formatMap.get(format.getClassName())));
- }
- }
- System.out.println("--- End formats ---");
- }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/PersistComparator.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/PersistComparator.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/PersistComparator.java 2008-05-19 17:52:20.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/PersistComparator.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PersistComparator.java,v 1.11 2008/05/19 17:52:20 linda Exp $
+ * $Id: PersistComparator.java,v 1.11.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/PersistEntityBinding.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/PersistEntityBinding.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/PersistEntityBinding.java 2008-03-18 19:38:08.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/PersistEntityBinding.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PersistEntityBinding.java,v 1.20 2008/03/18 18:38:08 mark Exp $
+ * $Id: PersistEntityBinding.java,v 1.20.2.3 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -33,21 +33,10 @@
String entityClassName,
boolean rawAccess) {
this.catalog = catalog;
- if (rawAccess) {
- entityFormat = catalog.getFormat(entityClassName);
- if (entityFormat == null || !entityFormat.isEntity()) {
- throw new IllegalArgumentException
- ("Not an entity class: " + entityClassName);
- }
- } else {
- Class entityCls;
- try {
- entityCls = EntityModel.classForName(entityClassName);
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException(e);
- }
- entityFormat = catalog.getFormat
- (entityCls, true /*openEntitySubclassIndexes*/);
+ entityFormat = getOrCreateFormat(catalog, entityClassName, rawAccess);
+ if (!entityFormat.isEntity()) {
+ throw new IllegalArgumentException
+ ("Not an entity class: " + entityClassName);
}
this.rawAccess = rawAccess;
}
@@ -167,4 +156,24 @@
return format;
}
+
+ /**
+ * Utility method for getting or creating a format as appropriate for
+ * bindings and key creators.
+ */
+ static Format getOrCreateFormat(Catalog catalog,
+ String clsName,
+ boolean rawAccess) {
+ if (rawAccess) {
+ Format format = catalog.getFormat(clsName);
+ if (format == null) {
+ throw new IllegalArgumentException
+ ("Not a persistent class: " + clsName);
+ }
+ return format;
+ } else {
+ Class cls = SimpleCatalog.keyClassForName(clsName);
+ return catalog.getFormat(cls, true /*openEntitySubclassIndexes*/);
+ }
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/PersistKeyAssigner.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/PersistKeyAssigner.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/PersistKeyAssigner.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/PersistKeyAssigner.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PersistKeyAssigner.java,v 1.16 2008/01/07 14:28:59 cwl Exp $
+ * $Id: PersistKeyAssigner.java,v 1.16.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/PersistKeyBinding.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/PersistKeyBinding.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/PersistKeyBinding.java 2008-03-18 19:38:08.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/PersistKeyBinding.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PersistKeyBinding.java,v 1.22 2008/03/18 18:38:08 mark Exp $
+ * $Id: PersistKeyBinding.java,v 1.22.2.4 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -30,11 +30,8 @@
String clsName,
boolean rawAccess) {
this.catalog = catalog;
- keyFormat = catalog.getFormat(clsName);
- if (keyFormat == null) {
- throw new IllegalArgumentException
- ("Class is not persistent: " + clsName);
- }
+ keyFormat = PersistEntityBinding.getOrCreateFormat
+ (catalog, clsName, rawAccess);
if (!keyFormat.isSimple() &&
(keyFormat.getClassMetadata() == null ||
keyFormat.getClassMetadata().getCompositeKeyFields() == null)) {
@@ -60,7 +57,7 @@
keyFormat =
catalog.getFormat(cls, false /*openEntitySubclassIndexes*/);
}
- keyFormat.initializeIfNeeded(catalog);
+ keyFormat.initializeIfNeeded(catalog, null /*model*/);
}
/**
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/PersistKeyCreator.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/PersistKeyCreator.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/PersistKeyCreator.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/PersistKeyCreator.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PersistKeyCreator.java,v 1.18 2008/01/07 14:28:59 cwl Exp $
+ * $Id: PersistKeyCreator.java,v 1.18.2.3 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -49,13 +49,15 @@
public PersistKeyCreator(Catalog catalog,
EntityMetadata entityMeta,
String keyClassName,
- SecondaryKeyMetadata secKeyMeta) {
+ SecondaryKeyMetadata secKeyMeta,
+ boolean rawAccess) {
this.catalog = catalog;
- Format priKeyFormat =
- catalog.getFormat(entityMeta.getPrimaryKey().getClassName());
+ Format priKeyFormat = PersistEntityBinding.getOrCreateFormat
+ (catalog, entityMeta.getPrimaryKey().getClassName(), rawAccess);
priKeyFormatId = priKeyFormat.getId();
keyName = secKeyMeta.getKeyName();
- keyFormat = catalog.getFormat(keyClassName);
+ keyFormat = PersistEntityBinding.getOrCreateFormat
+ (catalog, keyClassName, rawAccess);
if (keyFormat == null) {
throw new IllegalArgumentException
("Not a key class: " + keyClassName);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/PrimitiveArrayFormat.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/PrimitiveArrayFormat.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/PrimitiveArrayFormat.java 2008-03-18 19:38:08.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/PrimitiveArrayFormat.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: PrimitiveArrayFormat.java,v 1.24 2008/03/18 18:38:08 mark Exp $
+ * $Id: PrimitiveArrayFormat.java,v 1.24.2.3 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -13,6 +13,7 @@
import java.util.Map;
import java.util.Set;
+import com.sleepycat.persist.model.EntityModel;
import com.sleepycat.persist.raw.RawObject;
/**
@@ -53,9 +54,14 @@
}
@Override
- void initialize(Catalog catalog, int initVersion) {
+ void initialize(Catalog catalog, EntityModel model, int initVersion) {
+
+ /*
+ * getExistingType is allowed (to support raw mode) because primitive
+ * arrays are always available in Java.
+ */
componentFormat = (SimpleFormat)
- catalog.getFormat(getType().getComponentType(),
+ catalog.getFormat(getExistingType().getComponentType(),
false /*openEntitySubclassIndexes*/);
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/ProxiedFormat.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/ProxiedFormat.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/ProxiedFormat.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/ProxiedFormat.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ProxiedFormat.java,v 1.24 2008/01/07 14:28:59 cwl Exp $
+ * $Id: ProxiedFormat.java,v 1.24.2.3 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -13,6 +13,7 @@
import java.util.Map;
import java.util.Set;
+import com.sleepycat.persist.model.EntityModel;
import com.sleepycat.persist.model.PersistentProxy;
import com.sleepycat.persist.raw.RawObject;
@@ -67,7 +68,7 @@
}
@Override
- void initialize(Catalog catalog, int initVersion) {
+ void initialize(Catalog catalog, EntityModel model, int initVersion) {
/* Set the proxy format for a new (never initialized) format. */
if (proxyFormat == null) {
assert proxyClassName != null;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/RawAbstractInput.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/RawAbstractInput.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/RawAbstractInput.java 2008-03-18 19:38:08.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/RawAbstractInput.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: RawAbstractInput.java,v 1.10 2008/03/18 18:38:08 mark Exp $
+ * $Id: RawAbstractInput.java,v 1.10.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/RawAccessor.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/RawAccessor.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/RawAccessor.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/RawAccessor.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: RawAccessor.java,v 1.9 2008/01/07 14:28:59 cwl Exp $
+ * $Id: RawAccessor.java,v 1.9.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/RawArrayInput.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/RawArrayInput.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/RawArrayInput.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/RawArrayInput.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: RawArrayInput.java,v 1.6 2008/01/07 14:28:59 cwl Exp $
+ * $Id: RawArrayInput.java,v 1.6.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/RawComplexInput.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/RawComplexInput.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/RawComplexInput.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/RawComplexInput.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: RawComplexInput.java,v 1.6 2008/01/07 14:28:59 cwl Exp $
+ * $Id: RawComplexInput.java,v 1.6.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/RawSingleInput.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/RawSingleInput.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/RawSingleInput.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/RawSingleInput.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: RawSingleInput.java,v 1.6 2008/01/07 14:28:59 cwl Exp $
+ * $Id: RawSingleInput.java,v 1.6.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/Reader.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/Reader.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/Reader.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/Reader.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,15 +1,17 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Reader.java,v 1.6 2008/01/07 14:28:59 cwl Exp $
+ * $Id: Reader.java,v 1.6.2.3 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
import java.io.Serializable;
+import com.sleepycat.persist.model.EntityModel;
+
/**
* Interface to the "read object" methods of the Format class. For the
* latest version format, the Format object provides the implementation of
@@ -21,7 +23,10 @@
*/
interface Reader extends Serializable {
- void initializeReader(Catalog catalog, int initVersion, Format oldFormat);
+ void initializeReader(Catalog catalog,
+ EntityModel model,
+ int initVersion,
+ Format oldFormat);
Object newInstance(EntityInput input, boolean rawAccess);
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/ReadOnlyCatalog.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/ReadOnlyCatalog.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/ReadOnlyCatalog.java 2008-03-18 19:38:08.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/ReadOnlyCatalog.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ReadOnlyCatalog.java,v 1.12 2008/03/18 18:38:08 mark Exp $
+ * $Id: ReadOnlyCatalog.java,v 1.12.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/RecordInput.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/RecordInput.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/RecordInput.java 2008-05-16 13:33:08.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/RecordInput.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: RecordInput.java,v 1.9 2008/05/16 13:33:07 mark Exp $
+ * $Id: RecordInput.java,v 1.9.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/RecordOutput.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/RecordOutput.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/RecordOutput.java 2008-05-16 13:33:08.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/RecordOutput.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: RecordOutput.java,v 1.10 2008/05/16 13:33:07 mark Exp $
+ * $Id: RecordOutput.java,v 1.10.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/ReflectionAccessor.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/ReflectionAccessor.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/ReflectionAccessor.java 2008-03-18 19:38:08.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/ReflectionAccessor.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ReflectionAccessor.java,v 1.23 2008/03/18 18:38:08 mark Exp $
+ * $Id: ReflectionAccessor.java,v 1.23.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/SimpleCatalog.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/SimpleCatalog.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/SimpleCatalog.java 2008-03-18 19:38:08.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/SimpleCatalog.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SimpleCatalog.java,v 1.26 2008/03/18 18:38:08 mark Exp $
+ * $Id: SimpleCatalog.java,v 1.26.2.3 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -191,7 +191,7 @@
*/
private void setFormat(int id, SimpleFormat format) {
format.setId(id);
- format.initializeIfNeeded(this);
+ format.initializeIfNeeded(this, null /*model*/);
formatList.set(id, format);
formatMap.put(format.getClassName(), format);
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/SimpleFormat.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/SimpleFormat.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/SimpleFormat.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/SimpleFormat.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: SimpleFormat.java,v 1.24 2008/01/07 14:28:59 cwl Exp $
+ * $Id: SimpleFormat.java,v 1.24.2.3 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -15,6 +15,7 @@
import java.util.Set;
import com.sleepycat.je.DatabaseEntry;
+import com.sleepycat.persist.model.EntityModel;
/**
* Format for simple types, including primitives. Additional methods are
@@ -60,7 +61,7 @@
}
@Override
- void initialize(Catalog catalog, int initVersion) {
+ void initialize(Catalog catalog, EntityModel model, int initVersion) {
}
@Override
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/StoredModel.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/StoredModel.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/StoredModel.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/StoredModel.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: StoredModel.java,v 1.12 2008/01/07 14:28:59 cwl Exp $
+ * $Id: StoredModel.java,v 1.12.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/Store.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/Store.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/Store.java 2008-05-19 20:33:32.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/Store.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Store.java,v 1.36 2008/05/19 20:33:32 mark Exp $
+ * $Id: Store.java,v 1.36.2.5 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
@@ -259,10 +259,6 @@
return storeName;
}
- public void dumpCatalog() {
- catalog.dump();
- }
-
/* */
public static Set getStoreNames(Environment env)
throws DatabaseException {
@@ -1045,7 +1041,7 @@
rel == Relationship.MANY_TO_MANY);
setBtreeComparator(config, secKeyMeta.getClassName());
PersistKeyCreator keyCreator = new PersistKeyCreator
- (catalog, entityMeta, keyClassName, secKeyMeta);
+ (catalog, entityMeta, keyClassName, secKeyMeta, rawAccess);
if (rel == Relationship.ONE_TO_MANY ||
rel == Relationship.MANY_TO_MANY) {
config.setMultiKeyCreator(keyCreator);
@@ -1322,9 +1318,10 @@
oneWritten = true;
nWritten += 1;
}
+ /* Update event stats, even if no listener. [#17024] */
+ EvolveInternal.updateEvent
+ (event, entityClassName, 1, oneWritten ? 1 : 0);
if (listener != null) {
- EvolveInternal.updateEvent
- (event, entityClassName, 1, oneWritten ? 1 : 0);
if (!listener.evolveProgress(event)) {
break;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/WidenerInput.java libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/WidenerInput.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/impl/WidenerInput.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/impl/WidenerInput.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: WidenerInput.java,v 1.6 2008/01/07 14:28:59 cwl Exp $
+ * $Id: WidenerInput.java,v 1.6.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.impl;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/KeySelector.java libdb-je-java-3.3.98/src/com/sleepycat/persist/KeySelector.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/KeySelector.java 2008-02-05 23:28:22.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/KeySelector.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: KeySelector.java,v 1.9 2008/02/05 23:28:21 mark Exp $
+ * $Id: KeySelector.java,v 1.9.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/KeysIndex.java libdb-je-java-3.3.98/src/com/sleepycat/persist/KeysIndex.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/KeysIndex.java 2008-02-05 23:28:22.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/KeysIndex.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: KeysIndex.java,v 1.10 2008/02/05 23:28:21 mark Exp $
+ * $Id: KeysIndex.java,v 1.10.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/KeyValueAdapter.java libdb-je-java-3.3.98/src/com/sleepycat/persist/KeyValueAdapter.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/KeyValueAdapter.java 2008-01-07 14:28:58.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/KeyValueAdapter.java 2010-01-04 15:30:38.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: KeyValueAdapter.java,v 1.8 2008/01/07 14:28:58 cwl Exp $
+ * $Id: KeyValueAdapter.java,v 1.8.2.2 2010/01/04 15:30:38 cwl Exp $
*/
package com.sleepycat.persist;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/model/AnnotationModel.java libdb-je-java-3.3.98/src/com/sleepycat/persist/model/AnnotationModel.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/model/AnnotationModel.java 2008-05-05 13:15:40.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/model/AnnotationModel.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: AnnotationModel.java,v 1.24 2008/05/05 13:15:40 mark Exp $
+ * $Id: AnnotationModel.java,v 1.25.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.model;
@@ -118,18 +118,25 @@
}
/* Get instance fields. */
List fields = new ArrayList();
- for (Field field : type.getDeclaredFields()) {
- int mods = field.getModifiers();
- if (!Modifier.isTransient(mods) && !Modifier.isStatic(mods)) {
- fields.add(field);
+ boolean nonDefaultRules = getInstanceFields(fields, type);
+ Collection nonDefaultFields = null;
+ if (nonDefaultRules) {
+ nonDefaultFields = new ArrayList(fields.size());
+ for (Field field : fields) {
+ nonDefaultFields.add(new FieldMetadata
+ (field.getName(), field.getType().getName(),
+ type.getName()));
}
+ nonDefaultFields =
+ Collections.unmodifiableCollection(nonDefaultFields);
}
/* Get the rest of the metadata and save it. */
metadata = new ClassMetadata
(className, version, proxiedClassName, isEntity,
getPrimaryKey(type, fields),
getSecondaryKeys(type, fields),
- getCompositeKeyFields(type, fields));
+ getCompositeKeyFields(type, fields),
+ nonDefaultFields);
classMap.put(className, metadata);
/* Add any new information about entities. */
updateEntityInfo(metadata);
@@ -137,6 +144,45 @@
return metadata;
}
+ /**
+ * Fills in the fields array and returns true if the default rules for
+ * field persistence were overridden.
+ */
+ private boolean getInstanceFields(List fields, Class> type) {
+ boolean nonDefaultRules = false;
+ for (Field field : type.getDeclaredFields()) {
+ boolean notPersistent =
+ (field.getAnnotation(NotPersistent.class) != null);
+ boolean notTransient =
+ (field.getAnnotation(NotTransient.class) != null);
+ if (notPersistent && notTransient) {
+ throw new IllegalArgumentException
+ ("Both @NotTransient and @NotPersistent not allowed");
+ }
+ if (notPersistent || notTransient) {
+ nonDefaultRules = true;
+ }
+ int mods = field.getModifiers();
+
+ if (!Modifier.isStatic(mods) &&
+ !notPersistent &&
+ (!Modifier.isTransient(mods) || notTransient)) {
+ /* Field is DPL persistent. */
+ fields.add(field);
+ } else {
+ /* If non-persistent, no other annotations should be used. */
+ if (field.getAnnotation(PrimaryKey.class) != null ||
+ field.getAnnotation(SecondaryKey.class) != null ||
+ field.getAnnotation(KeyField.class) != null) {
+ throw new IllegalArgumentException
+ ("@PrimaryKey, @SecondaryKey and @KeyField not " +
+ "allowed on non-persistent field");
+ }
+ }
+ }
+ return nonDefaultRules;
+ }
+
private PrimaryKeyMetadata getPrimaryKey(Class> type,
List fields) {
Field foundField = null;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/model/BytecodeEnhancer.java libdb-je-java-3.3.98/src/com/sleepycat/persist/model/BytecodeEnhancer.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/model/BytecodeEnhancer.java 2008-05-30 14:04:18.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/model/BytecodeEnhancer.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: BytecodeEnhancer.java,v 1.16 2008/05/30 14:04:18 mark Exp $
+ * $Id: BytecodeEnhancer.java,v 1.17.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.model;
@@ -171,8 +171,9 @@
throw abort();
}
FieldVisitor ret = super.visitField(access, name, desc, sig, value);
- if ((access & (ACC_STATIC | ACC_TRANSIENT)) == 0) {
- FieldInfo info = new FieldInfo(ret, name, desc);
+ if ((access & ACC_STATIC) == 0) {
+ FieldInfo info = new FieldInfo(ret, name, desc,
+ (access & ACC_TRANSIENT) != 0);
nonKeyFields.add(info);
ret = info;
}
@@ -247,7 +248,9 @@
} else {
for (int i = 0; i < nonKeyFields.size();) {
FieldInfo field = nonKeyFields.get(i);
- if (field.isPriKey) {
+ if (field.isTransient) {
+ nonKeyFields.remove(i);
+ } else if (field.isPriKey) {
if (priKeyField == null) {
priKeyField = field;
nonKeyFields.remove(i);
@@ -1453,10 +1456,15 @@
OrderInfo order;
boolean isPriKey;
boolean isSecKey;
+ boolean isTransient;
- FieldInfo(FieldVisitor parent, String name, String desc) {
+ FieldInfo(FieldVisitor parent,
+ String name,
+ String desc,
+ boolean isTransient) {
this.parent = parent;
this.name = name;
+ this.isTransient = isTransient;
type = Type.getType(desc);
}
@@ -1473,6 +1481,12 @@
} else if (desc.equals
("Lcom/sleepycat/persist/model/SecondaryKey;")) {
isSecKey = true;
+ } else if (desc.equals
+ ("Lcom/sleepycat/persist/model/NotPersistent;")) {
+ isTransient = true;
+ } else if (desc.equals
+ ("Lcom/sleepycat/persist/model/NotTransient;")) {
+ isTransient = false;
}
return ret;
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/model/ClassEnhancer.java libdb-je-java-3.3.98/src/com/sleepycat/persist/model/ClassEnhancer.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/model/ClassEnhancer.java 2008-02-05 23:28:22.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/model/ClassEnhancer.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ClassEnhancer.java,v 1.18 2008/02/05 23:28:22 mark Exp $
+ * $Id: ClassEnhancer.java,v 1.18.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.model;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/model/ClassEnhancerTask.java libdb-je-java-3.3.98/src/com/sleepycat/persist/model/ClassEnhancerTask.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/model/ClassEnhancerTask.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/model/ClassEnhancerTask.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ClassEnhancerTask.java,v 1.11 2008/01/07 14:28:59 cwl Exp $
+ * $Id: ClassEnhancerTask.java,v 1.11.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.model;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/model/ClassMetadata.java libdb-je-java-3.3.98/src/com/sleepycat/persist/model/ClassMetadata.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/model/ClassMetadata.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/model/ClassMetadata.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,14 +1,15 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ClassMetadata.java,v 1.13 2008/01/07 14:28:59 cwl Exp $
+ * $Id: ClassMetadata.java,v 1.14.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.model;
import java.io.Serializable;
+import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -37,9 +38,11 @@
private PrimaryKeyMetadata primaryKey;
private Map secondaryKeys;
private List compositeKeyFields;
+ private Collection persistentFields;
/**
* Used by an {@code EntityModel} to construct persistent class metadata.
+ * The optional {@link #getPersistentFields} property will be set to null.
*/
public ClassMetadata(String className,
int version,
@@ -48,6 +51,22 @@
PrimaryKeyMetadata primaryKey,
Map secondaryKeys,
List compositeKeyFields) {
+
+ this(className, version, proxiedClassName, entityClass, primaryKey,
+ secondaryKeys, compositeKeyFields, null /*persistentFields*/);
+ }
+
+ /**
+ * Used by an {@code EntityModel} to construct persistent class metadata.
+ */
+ public ClassMetadata(String className,
+ int version,
+ String proxiedClassName,
+ boolean entityClass,
+ PrimaryKeyMetadata primaryKey,
+ Map secondaryKeys,
+ List compositeKeyFields,
+ Collection persistentFields) {
this.className = className;
this.version = version;
this.proxiedClassName = proxiedClassName;
@@ -55,6 +74,7 @@
this.primaryKey = primaryKey;
this.secondaryKeys = secondaryKeys;
this.compositeKeyFields = compositeKeyFields;
+ this.persistentFields = persistentFields;
}
/**
@@ -119,6 +139,23 @@
return compositeKeyFields;
}
+ /**
+ * Returns an unmodifiable list of metadata for the persistent fields in
+ * this class, or null if the default rules for persistent fields should be
+ * used. All fields returned must be declared in this class and must be
+ * non-static.
+ *
+ *
By default (if null is returned) the persistent fields of a class
+ * will be all declared instance fields that are non-transient (are not
+ * declared with the transient keyword). The default rules
+ * may be overridden by an {@link EntityModel}. For example, the {@link
+ * AnnotationModel} overrides the default rules when the {@link
+ * NotPersistent} or {@link NotTransient} annotation is specified.
+ */
+ public Collection getPersistentFields() {
+ return persistentFields;
+ }
+
@Override
public boolean equals(Object other) {
if (other instanceof ClassMetadata) {
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/model/DeleteAction.java libdb-je-java-3.3.98/src/com/sleepycat/persist/model/DeleteAction.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/model/DeleteAction.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/model/DeleteAction.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: DeleteAction.java,v 1.8 2008/01/07 14:28:59 cwl Exp $
+ * $Id: DeleteAction.java,v 1.8.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.model;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/model/Entity.java libdb-je-java-3.3.98/src/com/sleepycat/persist/model/Entity.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/model/Entity.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/model/Entity.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: Entity.java,v 1.15 2008/01/07 14:28:59 cwl Exp $
+ * $Id: Entity.java,v 1.15.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.model;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/model/EntityMetadata.java libdb-je-java-3.3.98/src/com/sleepycat/persist/model/EntityMetadata.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/model/EntityMetadata.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/model/EntityMetadata.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EntityMetadata.java,v 1.13 2008/01/07 14:28:59 cwl Exp $
+ * $Id: EntityMetadata.java,v 1.13.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.model;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/model/EntityModel.java libdb-je-java-3.3.98/src/com/sleepycat/persist/model/EntityModel.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/model/EntityModel.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/model/EntityModel.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: EntityModel.java,v 1.20 2008/01/07 14:28:59 cwl Exp $
+ * $Id: EntityModel.java,v 1.20.2.3 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.model;
@@ -214,6 +214,22 @@
}
/**
+ * Returns all versions of all known types.
+ *
+ * @return an unmodifiable list of types.
+ *
+ * @throws IllegalStateException if this method is called for a model that
+ * is not associated with an open store.
+ */
+ public final List getAllRawTypes() {
+ if (catalog != null) {
+ return catalog.getAllRawTypes();
+ } else {
+ throw new IllegalStateException("Store is not open");
+ }
+ }
+
+ /**
* Converts a given raw object to a live object according to the current
* class definitions.
*
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/model/FieldMetadata.java libdb-je-java-3.3.98/src/com/sleepycat/persist/model/FieldMetadata.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/model/FieldMetadata.java 2008-01-07 14:29:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/model/FieldMetadata.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: FieldMetadata.java,v 1.12 2008/01/07 14:28:59 cwl Exp $
+ * $Id: FieldMetadata.java,v 1.13.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.model;
@@ -78,4 +78,10 @@
ClassMetadata.hashCode(className) +
ClassMetadata.hashCode(declaringClassName);
}
+
+ @Override
+ public String toString() {
+ return "[FieldMetadata name: " + name + " className: " + className +
+ " declaringClassName: " + declaringClassName + ']';
+ }
}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/model/KeyField.java libdb-je-java-3.3.98/src/com/sleepycat/persist/model/KeyField.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/model/KeyField.java 2008-02-27 21:58:14.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/model/KeyField.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: KeyField.java,v 1.12 2008/02/27 21:58:14 mark Exp $
+ * $Id: KeyField.java,v 1.12.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.model;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/model/ModelInternal.java libdb-je-java-3.3.98/src/com/sleepycat/persist/model/ModelInternal.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/model/ModelInternal.java 2008-02-05 23:28:22.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/model/ModelInternal.java 2010-01-04 15:30:40.000000000 +0000
@@ -1,9 +1,9 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2002,2008 Oracle. All rights reserved.
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
*
- * $Id: ModelInternal.java,v 1.9 2008/02/05 23:28:22 mark Exp $
+ * $Id: ModelInternal.java,v 1.9.2.2 2010/01/04 15:30:39 cwl Exp $
*/
package com.sleepycat.persist.model;
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/model/NotPersistent.java libdb-je-java-3.3.98/src/com/sleepycat/persist/model/NotPersistent.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/model/NotPersistent.java 1970-01-01 00:00:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/model/NotPersistent.java 2010-03-22 21:53:34.000000000 +0000
@@ -0,0 +1,42 @@
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
+ *
+ * $Id: NotPersistent.java,v 1.1.2.3 2010/03/22 21:53:33 mark Exp $
+ */
+
+package com.sleepycat.persist.model;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Overrides the default rules for field persistence and defines a field as
+ * being non-persistent even when it is not declared with the
+ * transient keyword.
+ *
+ *
By default, the persistent fields of a class are all declared instance
+ * fields that are non-transient (are not declared with the
+ * transient keyword). The default rules may be overridden by
+ * specifying the {@link NotPersistent} or {@link NotTransient} annotation.
+ *
+ *
For example, the following field is non-transient (persistent) with
+ * respect to Java serialization but is transient with respect to the DPL.
+ *
+ * @see NotTransient
+ * @author Mark Hayes
+ */
+@Documented @Retention(RUNTIME) @Target(FIELD)
+public @interface NotPersistent {
+}
diff -Nru libdb-je-java-3.3.62/src/com/sleepycat/persist/model/NotTransient.java libdb-je-java-3.3.98/src/com/sleepycat/persist/model/NotTransient.java
--- libdb-je-java-3.3.62/src/com/sleepycat/persist/model/NotTransient.java 1970-01-01 00:00:00.000000000 +0000
+++ libdb-je-java-3.3.98/src/com/sleepycat/persist/model/NotTransient.java 2010-03-22 21:53:34.000000000 +0000
@@ -0,0 +1,42 @@
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 2002,2010 Oracle. All rights reserved.
+ *
+ * $Id: NotTransient.java,v 1.1.2.3 2010/03/22 21:53:33 mark Exp $
+ */
+
+package com.sleepycat.persist.model;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Overrides the default rules for field persistence and defines a field as
+ * being persistent even when it is declared with the transient
+ * keyword.
+ *
+ *
By default, the persistent fields of a class are all declared instance
+ * fields that are non-transient (are not declared with the
+ * transient keyword). The default rules may be overridden by
+ * specifying the {@link NotPersistent} or {@link NotTransient} annotation.
+ *
+ *
For example, the following field is transient with respect to Java
+ * serialization but is persistent with respect to the DPL.