db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject svn commit: rev 55723 - in incubator/derby/code/trunk/java/engine/org/apache/derby: iapi/services/io iapi/store/raw iapi/store/raw/log iapi/store/raw/xact impl/store/raw impl/store/raw/log impl/store/raw/xact
Date Wed, 27 Oct 2004 19:07:48 GMT
Author: mikem
Date: Wed Oct 27 12:07:48 2004
New Revision: 55723

Removed:
   incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/D_TruncationPoint.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/SaveLWMOperation.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/TruncationPoint.java
Modified:
   incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/log/LogFactory.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/CheckpointOperation.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/D_LogToFile.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/Xact.java
Log:
committing patch from tsuresh@Source-Zone.org

Cleaned up some calls that are not being used in log facttory. Attached 
is the diff file. I am  not sure how
patch  command handles deleted files.



Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
Wed Oct 27 12:07:48 2004
@@ -1673,11 +1673,6 @@
         public static final int LOGOP_SET_RESERVED_SPACE = 
                 (MIN_ID_2 + 287);
 
-        /* org.apache.derby.impl.store.raw.log.SaveLWMOperation */
-        public static final int LOGOP_SAVE_LWM =
-                (MIN_ID_2 + 114);
-
-
         /* org.apache.derby.impl.store.raw.data.RemoveFileOperation */
         public static final int LOGOP_REMOVE_FILE =
                 (MIN_ID_2 + 291);

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java
Wed Oct 27 12:07:48 2004
@@ -710,62 +710,6 @@
 	*/
 	public void idle() throws StandardException;
 
-	/*
-		Log truncation support - only applies to rawStore that supports logging
-		and log truncation control.
-
-		The RawStore will maintain a set of log instances called truncation low
-		water marks.  These TruncationLWMs are identified by UUID.  Once set,
-		the RawStore will not truncate any log record pass any TruncationLWM.
-		The client must reset these TruncationLWM or delete them from RawStore
-		or else the log will fill up.
-
-		These TruncationLWMs are durable across crashes
-	*/
-
-	/**
-		Set truncation low water mark.  If instant is null, set this named
-		truncation LWM to be the earliest legal log instant currently still
-		available - i.e., the first log instant that has not been truncated.
-		If a truncation low water mark of this name does not exist this creates
-		it.  If a truncation low water mark of this name already exists then
-		this call will move it to a new log instant.
-		<P>
-		When this returns the system will durably remember the new low water
-		mark.
-		
-		@param name The name of the new low water mark. 
-		@return The truncation low water mark log instant.
-
-		@exception StandardException StandardCloudscape error policy
-	*/
-	LogInstant setTruncationLWM(UUID name, DatabaseInstant instant) 
-		 throws StandardException; 
-
-
-	/**
-		Remove a truncation low water mark.  An exception will be thrown if it
-		is not already set. 
-		<P>
-		When this returns the low water mark is removed from the system
-		permanently. 
-
-		@param name The name of the truncation low water mark.
-
-		@exception StandardException StandardCloudscape error policy
-	*/
-	void removeTruncationLWM(UUID name) throws StandardException;
-
-	/**
-		Get a truncatin low water mark.  If it is not set, return null.
-
-		@param name The name of the truncation low water mark.
-
-		@exception StandardException StandardCloudscape error policy
-	*/
-	LogInstant getTruncationLWM(UUID name) throws StandardException;
-
-
 	/**
 	    Get a flushed scan.
 		@param start The instant for the beginning of the scan.

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/log/LogFactory.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/log/LogFactory.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/log/LogFactory.java
Wed Oct 27 12:07:48 2004
@@ -109,68 +109,6 @@
 	*/
 	public void flush(LogInstant where) throws StandardException;
 
-	/**
-		@see RawStoreFactory#setTruncationLWM
-
-		@param name - the name of the truncation low water mark. 
-		@param rawStoreFactory - the raw store
-		@param dataFactory - the data factory
-		@param transactionFactory - the transaction factory
-
-		@return The exact instant to which this set the truncation low
-		water mark.
-
-		@exception StandardException StandardCloudscape error policy
-	*/
-
-	public LogInstant setTruncationLWM(UUID name, 
-									   LogInstant instant,
-									   RawStoreFactory rawStoreFactory, 
-									   TransactionFactory transFactory)
-		 throws StandardException;
-
-	/**
-		Internal to RawStore, setting the truncationLWM below the log
-
-		@param name - the name of the truncation low water mark. 
-		@exception StandardException cloudscape standard error policy
-
-	  */
-	public void setTruncationLWM(UUID name, LogInstant instant)
-		 throws StandardException;
-
-
-	/**
-		Get back a truncation LWM
-		@exception StandardException cloudscape standard error policy
-	*/
-	public LogInstant getTruncationLWM(UUID name)
-		 throws StandardException;
-
-	/**
-		Remove a truncation LWM - logged
-
-		@param name - the name of the truncation low water mark. 
-		@param rawStoreFactory - the raw store
-		@param dataFactory - the data factory
-		@param transactionFactory - the transaction factory
-		
-		@exception StandardException cloudscape standard error policy
-	*/
-	void removeTruncationLWM(UUID name,
-							 RawStoreFactory rawStoreFactory, 
-							 TransactionFactory transFactory)
-		 throws StandardException;
-
-	/**
-		Remove a truncation LWM - underneath the log
-
-		@param name - the name of the truncation low water mark. 
-		@exception StandardException cloudscape standard error policy
-	*/
-	void removeTruncationLWM(UUID name)
-		 throws StandardException;
-
 
 	/**
 		Get a LogScan to scan flushed records from the log.

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java
Wed Oct 27 12:07:48 2004
@@ -272,22 +272,6 @@
 
 
 	/**
-		Add a truncation LWM to the log factory
-
-		@exception StandardException Standard Cloudscape error policy
-	*/
-	public abstract void addTruncationLWM(UUID name, LogInstant instant)
-		 throws StandardException;
-
-
-	/**
-		Remove a truncation LWM from the log factory
-		@exception StandardException Standard Cloudscape error policy
-	*/
-	public abstract void removeTruncationLWM(UUID name) throws StandardException;
-
-
-	/**
 		Status that needs to go into the begin transaction log record, if there
 		is one, to help with recovery
 	*/

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java	(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/RawStore.java	Wed
Oct 27 12:07:48 2004
@@ -824,28 +824,6 @@
 	}
 
 
-	/*
-	 * log truncation support
-	 */
-	public LogInstant setTruncationLWM(UUID name, DatabaseInstant instant)
-		 throws StandardException
-	{
-		return logFactory.setTruncationLWM(name, (LogInstant)instant, this, xactFactory);
-	}
-
-	public LogInstant getTruncationLWM(UUID name)
-		 throws StandardException
-	{
-		return logFactory.getTruncationLWM(name);
-	}
-
-	public void removeTruncationLWM(UUID name)
-		 throws StandardException
-	{
-		logFactory.removeTruncationLWM(name, this, xactFactory);
-	}
-
-
 	public ScanHandle openFlushedScan(DatabaseInstant start, int groupsIWant)
 		 throws StandardException
 	{

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/CheckpointOperation.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/CheckpointOperation.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/CheckpointOperation.java
Wed Oct 27 12:07:48 2004
@@ -53,19 +53,12 @@
 	// undo LWM
 	protected long	undoLWM;
 
-	// other log trunaction points - after the checkpoint is read from the log
-	// after a recovery, the array is then used to populate the in memory
-	// truncation lwm table.
-	protected TruncationPoint[]	truncationLWM;
-
 	protected Formatable transactionTable;
 
-	public CheckpointOperation(long redoLWM, long undoLWM, 
-							   TruncationPoint[] tpoints, Formatable ttab)
+	public CheckpointOperation(long redoLWM, long undoLWM, Formatable ttab)
 	{
 		this.redoLWM = redoLWM;
 		this.undoLWM = undoLWM;
-		this.truncationLWM = tpoints;
 		this.transactionTable = ttab;
 	}
 
@@ -80,19 +73,8 @@
 	{
 		CompressedNumber.writeLong(out, redoLWM);
 		CompressedNumber.writeLong(out, undoLWM);
-		if (truncationLWM == null)
-			CompressedNumber.writeInt(out, 0);	// no other truncation LWM
-		else
-		{
-			CompressedNumber.writeInt(out, truncationLWM.length);
-			for (int i = 0; i < truncationLWM.length; i++)
-			{
-				out.writeObject(truncationLWM[i].getName());
-
-				LogCounter l = (LogCounter)(truncationLWM[i].getLogInstant());
-				CompressedNumber.writeLong(out,l.getValueAsLong());
-			}
-		}
+		// RESOLVE: Following write Not needed, keeping it to avoid upgrade/downgrade issues.
+		CompressedNumber.writeInt(out, 0);	// no other truncation LWM
 
 		if (transactionTable == null)
 			CompressedNumber.writeInt(out, 0);
@@ -108,23 +90,8 @@
 		redoLWM = CompressedNumber.readLong(in);
 		undoLWM = CompressedNumber.readLong(in);
 
+		// RESOLVE: Following read Not required, keeping it to avoid upgrade/downgrade issues.
 		int tsize = CompressedNumber.readInt(in); // is there any truncationLWM?
-		if (tsize == 0)
-			truncationLWM = null;
-		else
-		{
-			truncationLWM = new TruncationPoint[tsize];
-			UUID name;
-			LogInstant instant;
-
-			for (int i = 0; i < tsize; i++)
-			{
-				name = (UUID)in.readObject();
-
-				long l = CompressedNumber.readLong(in);
-				truncationLWM[i] = new TruncationPoint(name, new LogCounter(l));
-			}
-		}
 
 		int haveTTab = CompressedNumber.readInt(in);
 		if (haveTTab == 1)
@@ -219,10 +186,6 @@
 		return undoLWM;
 	}
 
-	public TruncationPoint[] truncationLWM()
-	{
-		return truncationLWM;
-	}
 
 	public Formatable getTransactionTable()
 	{
@@ -243,17 +206,6 @@
 				.append("Checkpoint : \tredoLWM ")
 				.append(redolwm.toString())
 				.append("\n\t\tundoLWM ").append(undolwm.toString());
-
-			if (truncationLWM != null)
-			{
-				LogCounter logLWM;
-				for (int i = truncationLWM.length-1; i >= 0; i--)
-				{
-					logLWM = (LogCounter)(truncationLWM[i].getLogInstant());
-					str.append(" truncation point ").append(i)
-						.append(" ").append(logLWM.toString());
-				}
-			}
 
 			if (transactionTable != null)
 			{

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/D_LogToFile.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/D_LogToFile.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/D_LogToFile.java
Wed Oct 27 12:07:48 2004
@@ -41,20 +41,9 @@
 		r.append("    lastFlush(offset): "+ltf.lastFlush+"\n");
 		r.append("    logFileNumber: "+ltf.logFileNumber+"\n");
 		r.append("    firstLogFileNumber: "+ltf.firstLogFileNumber+"\n");
-		if (ltf.truncPoints == null)
-		{
-			r.append("    truncPoints: null\n");
-		}
-		else
-		{
-			for(Enumeration e=ltf.truncPoints.elements();
-				e.hasMoreElements();)
-			{
-				Object tp = e.nextElement();
-				r.append("        tp: "+
-						 DiagnosticUtil.toDiagString(tp));
-			}
-		}
 		return r.toString();
 	}
 }
+
+
+

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
Wed Oct 27 12:07:48 2004
@@ -16,8 +16,6 @@
 import org.apache.derby.impl.store.raw.log.LogCounter;
 import org.apache.derby.impl.store.raw.log.LogRecord;
 import org.apache.derby.impl.store.raw.log.StreamLogScan;
-import org.apache.derby.impl.store.raw.log.SaveLWMOperation;
-import org.apache.derby.impl.store.raw.log.TruncationPoint;
 
 // need this to print nested exception that corrupts the database
 import org.apache.derby.iapi.services.context.ErrorStringBuilder;
@@ -350,22 +348,11 @@
 	private boolean			 recoveryNeeded = true; // log needs to be recovered
 	private boolean			 inCheckpoint = false; 	// in the middle of a checkpoint
 	private boolean			 inRedo = false;        // in the middle of redo loop
-	private boolean			 movingTruncPt = false;	// in the middle of moving
-													// a truncationLWM
 	private boolean          inLogSwitch = false;
 
 	// make sure we don't do anything after the log factory has been stopped
 	private boolean			 stopped = false;
 
-	Vector 			 		 truncPoints; // a list of truncationLWM
-								// 
-								// MT - This value is set during recovery or
-								// during set/remove TruncationLWM.  In the
-								// former single thread is assumed.  In the
-								// latter must synchronized on this for
-								// access or change.
-
-
 	// if log is to go to another device, this variable is set.  If null, then
 	// log goes to the log subdirectory underneath the data directory
 	String logDevice;
@@ -715,23 +702,6 @@
                             LogCounter.getLogFileNumber(undoLWM);
                     }
 
-					TruncationPoint[] tpoints =
-						currentCheckpoint.truncationLWM();
-
-					if (tpoints != null)
-					{
-						LogInstant earliestLWM = restoreTruncationLWMs(tpoints);
-
-						if (earliestLWM != null)
-						{
-							if (((LogCounter)earliestLWM).getLogFileNumber() < 
-                                    firstLogFileNumber)
-                            {
-								firstLogFileNumber = 
-                                    ((LogCounter)earliestLWM).getLogFileNumber();
-                            }
-						}
-					}
 
 					// if the checkpoint record doesn't have a transaction
 					// table, we need to rebuild it by scanning the log from
@@ -1504,35 +1474,9 @@
 			// send the checkpoint record to the log
 			Formatable transactionTable = tf.getTransactionTable();
 
-			// If the truncpoint changes between this time and the time the
-			// checkpoint log record gets written to disk, this is not a
-			// problem.  During recovery, we first get the truncation points
-			// from the checkpoint.  Then during redo, we will encounter any
-			// changes that ever happen to the set of truncation LWMs, so we
-			// will end up picking up everything up to the point of crash.
-			TruncationPoint[] tpoints = null;
-			synchronized(this)
-			{
-				if (truncPoints != null)
-				{
-					// make a snap shot copy of all the truncation LWMs
-					
-					int numTpoints = truncPoints.size();
-
-					tpoints = new TruncationPoint[numTpoints];
-					TruncationPoint t;
-					for (int i = 0; i < numTpoints; i++)
-					{
-						t = (TruncationPoint)truncPoints.elementAt(i);
-						tpoints[i] = 
-                            new TruncationPoint(t.getName(), t.getLogInstant());
-					}
-				}
-			}
-
 			CheckpointOperation nextCheckpoint = 
 				new CheckpointOperation(
-                    redoLWM_long, undoLWM_long, tpoints, transactionTable);
+                    redoLWM_long, undoLWM_long, transactionTable);
 
 			cptran.logAndDo(nextCheckpoint);
 
@@ -2115,9 +2059,6 @@
 		// one truncation at a time
 		synchronized (this)
 		{
-			if (movingTruncPt)	// don't truncate the log while someone is mucking
-				return -1;			// with truncation LWMs
-
 			firstLogNeeded = LogCounter.getLogFileNumber(checkpoint.undoLWM());
 
 			if (SanityManager.DEBUG)
@@ -2126,41 +2067,6 @@
 					SanityManager.DEBUG(DBG_FLAG, "truncatLog: undoLWM firstlog needed " + firstLogNeeded);
 			}
 
-			if (truncPoints != null) // other interesting truncation point in memory
-			{
-				TruncationPoint p;
-				LogCounter logLWM;
-				for (int i = truncPoints.size()-1; i >=0; i--)
-				{
-					p = (TruncationPoint)truncPoints.elementAt(i);
-					logLWM = (LogCounter)(p.getLogInstant());
-					if (firstLogNeeded > logLWM.getLogFileNumber())
-						firstLogNeeded = logLWM.getLogFileNumber();
-				}
-			}
-
-			if (SanityManager.DEBUG)
-			{
-				if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
-					SanityManager.DEBUG(DBG_FLAG, "truncatLog: in memory truncationLWM firstlog needed "
+ firstLogNeeded);
-			}
-
-			// now go thru the current checkpoint log record.  Somebody may
-			// have change the truncation LWM between the time the
-			// checkpoint record snapshot was taken and now.  And we better
-			// not truncate and violate either set of LWMs
-			TruncationPoint[] tps = checkpoint.truncationLWM();
-			if (tps != null)
-			{
-				LogCounter logLWM;
-				for (int i = tps.length-1; i >= 0; i--)
-				{
-					logLWM = (LogCounter)(tps[i].getLogInstant());
-					if (firstLogNeeded > logLWM.getLogFileNumber())
-						firstLogNeeded = logLWM.getLogFileNumber();
-				}
-			}
-
 			if (SanityManager.DEBUG)
 			{
 				if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
@@ -3801,298 +3707,6 @@
         }
     }
 
-	/*
-	 * trunction LWM support
-	 */
-
-	/**
-	    Set or add a truncationLWM with the given name.  If instant is null,
-		set the truncationLWM to the beginning of the log. The truncation point
-		is guaranteed to be durable. 
-
-		<P>MT - MT safe
-
-		@exception StandardException  Standard cloudscape exception policy
-	*/
-	public LogInstant setTruncationLWM(UUID name,
-									   LogInstant instant,
-									   RawStoreFactory rsf,
-									   TransactionFactory tf)
-		 throws StandardException
-	{
-		checkCorrupt();
-
-		if (SanityManager.DEBUG)
-			SanityManager.ASSERT(name != null, "null UUID name");
-
-
-		synchronized(this)
-		{
-			if (instant == null)
-				instant = new LogCounter(firstLogInstant());
-			else
-			{
-				long firstlog = firstLogInstant();
-				long instant_long = ((LogCounter)instant).getValueAsLong();
-
-				// make sure it is legal
-				if (instant_long < firstlog || instant_long > currentInstant())
-				{
-					throw StandardException.newException(
-                            SQLState.LOG_TRUNC_LWM_ILLEGAL, 
-                            name, instant, 
-                            new LogCounter(firstlog), 
-                            new LogCounter(currentInstant())); 
-				}
-			}
-
-			// Set it now before we log it so that we won't truncate the log in
-			// between. This will stablelize the head of the log if this is
-			// setting the first truncation LWM or setting it backwards.
-			setTruncationLWM(name, instant);
-
-			// If we move the truncation point forward, need to prevent log
-			// truncation from happening until AFTER the log record is written
-			// and log is flushed, otherwise, if the log is truncated before
-			// the SaveLWM operation is sent to the log stream, the previous
-			// LWM will point to a non-existant log record if the system
-			// crashed in the middle.
-			movingTruncPt = true;
-		}
-					
-		RawTransaction itran = null;
-		try
-		{
-
-			// log it to make it durable
-			Loggable lop = new SaveLWMOperation(name, instant, true /* set */);
-
-			// start an internal transaction to log this
-			itran = tf.startInternalTransaction(rsf, ContextService.getFactory().getCurrentContextManager());
-			itran.logAndDo(lop);
-			itran.commit();
-
-			// flush the log
-			synchronized (this) {
-				flush(logFileNumber, endPosition);
-			}
-
-			itran.close();
-			itran = null;
-		}
-		finally
-		{
-			// allow log truncation to proceed
-			synchronized(this)
-			{
-				movingTruncPt = false;
-			}
-
-			if (itran != null)
-			{
-				itran.abort();
-				itran.close();
-			}
-
-		}
-
-		return instant;
-	}
-
-	/**
-		Set or add a truncationLWM with the given name and log instance.
-		This is called underneath the log.
-
-		<P>MT - MT unsafe, caller provide synchronization
-
-		@exception StandardException if the given log instant is older than the
-		first log instance known to this log factory, an exception will be thrown
-	*/
-	public void setTruncationLWM(UUID name, LogInstant instant)
-		 throws StandardException
-	{
-		if (stopped)
-        {
-            throw StandardException.newException(SQLState.LOG_FACTORY_STOPPED);
-        }
-
-		if (inRedo)
-		{
-			// in recovery - if this sets the truncation point further back
-			// from where the current checkpoint sets the first log, it is not
-			// a problem (as long as the log file is still there, which
-			// hopefully it is).
-
-			// This can come about if the checkpoint is taken and
-			// determined that the first useful log is N.  Before log
-			// file N-1 is truncated, a setTruncationLWM with null
-			// instant is called, which sets it to N-1.
-			// Before the next checkpoint is taken, the system crashed.
-			if (firstLogFileNumber < 0 || ((LogCounter)instant).getLogFileNumber() < firstLogFileNumber)
-				firstLogFileNumber = ((LogCounter)instant).getLogFileNumber();
-		}
-
-		TruncationPoint tpoint = null;
-
-		synchronized(this)
-		{
-			if (truncPoints == null)
-				truncPoints = new Vector(1, 1);
-			else
-				tpoint = findTruncPoint(name);
-			
-			// not an existing truncationLWM.  Add it to the list
-			if (tpoint == null)
-			{
-				tpoint = new TruncationPoint(name, instant);
-				truncPoints.addElement(tpoint);
-			}
-			else
-			{
-				// existing truncaionLWM, change it,
-				tpoint.setLogInstant(instant);
-			}
-		}
-	}
-
-
-	/**
-		Find a truncationLWM with the given name.  If that truncationLWM was
-		never set or was removed, return null.
-
-		<P>MT - MT safe.  Whole routine is synchronized on this
-	*/
-	public LogInstant getTruncationLWM(UUID name)
-	{
-		TruncationPoint tpoint;
-		LogInstant instant = null;
-
-		synchronized(this)
-		{
-			if ((tpoint = findTruncPoint(name)) != null)
-			{
-				instant = tpoint.getLogInstant();
-
-				if (SanityManager.DEBUG)
-				{
-					LogCounter first = new LogCounter(firstLogInstant());
-					if (instant.lessThan(first))
-						SanityManager.THROWASSERT(
-							"truncation LWM " + instant +
-							" is < firstlog ( " + first + ") !");
-				}
-			}
-			// don't return from out of a sync block
-		}
-
-		return instant;
-
-	}
-
-	
-	/**
-		Remove a truncationLWM - logged
-
-		<P>MT - MT aware: multiple threads can call removeTruncationLWM if
-		different LWMs are removed, but if multiple threads want to remove the
-		same LWM, an exception will be thrown.
-
-		@exception StandardException if that truncationLWM cannot be found.
-	*/
-	public void removeTruncationLWM(UUID name, 
-									RawStoreFactory rsf,
-									TransactionFactory tf)
-		 throws StandardException
-	{
-		if (SanityManager.DEBUG)
-			SanityManager.ASSERT(name != null, "null UUID name");
-
-		if (corrupt != null)
-        {
-			throw StandardException.newException(
-                    SQLState.LOG_STORE_CORRUPT, corrupt);
-        }
-
-		if (stopped)
-            throw StandardException.newException(SQLState.LOG_FACTORY_STOPPED);
-
-		synchronized(this)
-		{
-			if (findTruncPoint(name) == null)
-            {
-                throw StandardException.newException(
-                        SQLState.LOG_TRUNC_LWM_NULL);
-            }
-
-			// remove it now, only log it for persistence.  Don't wait till the
-			// log is written out because I can't prevent 2 threads from
-			// removing the same LWM if they both go thru this routine
-			// simultaneously.  Can't keep the log factory in single thread for
-			// so long.
-
-			removeTruncationLWM(name); 
-		}
-
-		Loggable lop = new SaveLWMOperation(name, null, false /* unset */);
-		// start an interanl transaction to log this
-		RawTransaction itran = tf.startInternalTransaction(rsf, ContextService.getFactory().getCurrentContextManager());
-		try
-		{
-			itran.logAndDo(lop);
-		}
-		finally
-		{
-			itran.commit();
-			itran.close();
-		}
-	}
-
-
-	/**
-		Remove a truncationLWM - underneath a log record
-		@exception StandardException  Standard cloudscape exception policy
-	*/
-	public void removeTruncationLWM(UUID name)
-		 throws StandardException
-	{
-
-		if (corrupt != null)
-        {
-			throw StandardException.newException(
-                    SQLState.LOG_STORE_CORRUPT, corrupt);
-        }
-		
-		// During run time, we are called inside a synchronized block.
-		// During recovery redo, no log truncation is going to happen.
-		// So no need to synchronize here.
-		
-		// if it has already been removed, don't bother with it.
-		synchronized(this)
-		{
-			TruncationPoint tpoint = findTruncPoint(name);
-			if (tpoint != null)
-				truncPoints.removeElement(tpoint);
-		}
-	}
-
-	/**
-		Find a truncationLWM.
-
-		<P>MT - MT unsafe.  Caller must provide synchronization
-	*/
-	private TruncationPoint findTruncPoint(UUID name)
-	{
-		if (truncPoints == null)
-			return null;
-
-		for (int i = truncPoints.size()-1; i >= 0; i--)
-		{
-			TruncationPoint tpoint = (TruncationPoint)(truncPoints.elementAt(i));
-			if (tpoint.isEqual(name))
-				return tpoint;
-		}
-		return null;
-	}
 
 	/**
 	  Open a forward scan of the transaction log.
@@ -4188,41 +3802,6 @@
 			SanityManager.ASSERT(logFileNumber > 0 && lastFlush > 0);
 
 		return new LogCounter(logFileNumber,lastFlush);
-	}
-
-	/** restore/replace truncpoints using the passed in arrays 
-	    Called during recovery, no need for synchronization
-	 */
-	private LogInstant restoreTruncationLWMs(TruncationPoint[] tpoints)
-	{
-		if (truncPoints != null)
-			truncPoints.removeAllElements();
-
-		if (tpoints == null || tpoints.length == 0)
-			return null;
-
-		if (truncPoints == null)	
-			truncPoints = new Vector(tpoints.length, 1);
-
-		LogInstant earliestLWM = null;
-
-		for (int i = 0; i < tpoints.length; i++)
-		{
-			TruncationPoint t = tpoints[i];
-
-			if (SanityManager.DEBUG)
-				SanityManager.DEBUG(DBG_FLAG, 
-									"Restoring tpoint " + t.getName() + " " + t.getLogInstant()); 
-
-			// The tpoints come out of the checkpoint log record, OK to just
-			// stuff it into the truncation table because the checkpoint log
-			// record is never going to change it.
-			truncPoints.addElement(t);
-
-			if (earliestLWM == null || t.getLogInstant().lessThan(earliestLWM))
-				earliestLWM = t.getLogInstant();
-		}
-		return earliestLWM;
 	}
 
 

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/Xact.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/Xact.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/xact/Xact.java
Wed Oct 27 12:07:48 2004
@@ -1512,27 +1512,6 @@
 		return savePoints.size();
 	}
 
-	/**
-		@exception StandardException  Standard cloudscape exception policy
-	*/
-	public void addTruncationLWM(UUID name, LogInstant instant)
-		 throws StandardException
-	{
-		setActiveState();
-
-		logFactory.setTruncationLWM(name, instant);
-	}
-
-	/**
-		@exception StandardException  Standard cloudscape exception policy
-	*/
-	public void removeTruncationLWM(UUID name) throws StandardException
-	{
-		setActiveState();
-
-		logFactory.removeTruncationLWM(name);
-	}
-
 
 	/*
 	**	Implementation specific methods

Mime
View raw message