HashBucketPage.java
/**
   * Deletes a data entry from this page.  If a page in the list 
   * (not the primary page) becomes empty, it is deleted from the list.
   * 
   * To delete a data entry from a bucket, apply deleteEntry to the
   * primary page of the bucket.
   * 
   * 
   * @return true if deleting made this page dirty, false otherwise
   * @throws IllegalArgumentException if the entry is not in the list.
   */
Deletes a data entry from this page.  If a page in the list
(not the primary page) becomes empty, it is deleted from the list.

To delete a data entry from a bucket, apply deleteEntry to the
primary page of the bucket.

@return true if deleting made this page dirty, false otherwise
@throws IllegalArgumentException if the entry is not in the list.
Deletes a data entry from this page . If a page in the list ( not the primary page ) becomes empty it is deleted from the list . To delete a data entry from a bucket apply deleteEntry to the primary page of the bucket . @return true if deleting made this page dirty false otherwise @throws IllegalArgumentException if the entry is not in the list .
public boolean deleteEntry(DataEntry entry) {
	  boolean dirty = false;
	  try
	  {
		  dirty = super.deleteEntry(entry);	
	  }
	  catch (IllegalArgumentException e)
	  {
		  PageId nextPageId = new PageId();
		  nextPageId = this.getNextPage();
		  if (INVALID_PAGEID == nextPageId.pid) 	  
		  {
			  throw new IllegalArgumentException("deleteEntry failed.  Entry not found!");
		  }
		  HashBucketPage nextPage = new HashBucketPage();
		  Minibase.BufferManager.pinPage(nextPageId, nextPage, PIN_DISKIO);
		  if (nextPage.deleteEntry(entry))
		  {
			  if (0 == nextPage.getEntryCount())
			  {
				  this.setNextPage(nextPage.getNextPage());
				  Minibase.BufferManager.unpinPage(nextPageId, UNPIN_CLEAN);				  
				  Minibase.BufferManager.freePage(nextPageId);
				  dirty = true;
			  }
			  else
			  {
				  Minibase.BufferManager.unpinPage(nextPageId, UNPIN_DIRTY);
			  }
		  }
		  else
		  {
			  Minibase.BufferManager.unpinPage(nextPageId, UNPIN_CLEAN);
		  }	 		    
	  }
	  return dirty;
  }
public boolean deleteEntry ( DataEntry entry ) { boolean dirty = false ; try { dirty = super . deleteEntry ( entry ) ; } catch ( IllegalArgumentException e ) { PageId nextPageId = new PageId ( ) ; nextPageId = this . getNextPage ( ) ; if ( INVALID_PAGEID == nextPageId . pid ) { throw new IllegalArgumentException ( "deleteEntry failed.  Entry not found!" ) ; } HashBucketPage nextPage = new HashBucketPage ( ) ; Minibase . BufferManager . pinPage ( nextPageId , nextPage , PIN_DISKIO ) ; if ( nextPage . deleteEntry ( entry ) ) { if ( 0 == nextPage . getEntryCount ( ) ) { this . setNextPage ( nextPage . getNextPage ( ) ) ; Minibase . BufferManager . unpinPage ( nextPageId , UNPIN_CLEAN ) ; Minibase . BufferManager . freePage ( nextPageId ) ; dirty = true ; } else { Minibase . BufferManager . unpinPage ( nextPageId , UNPIN_DIRTY ) ; } } else { Minibase . BufferManager . unpinPage ( nextPageId , UNPIN_CLEAN ) ; } } return dirty ; }
Deletes a data entry from this page.
Deletes a data entry from this page .
// Try to delete the entry from this page, if it throws an IllegalArgumentException, then // the entry is not on this page // Entry is not on this page so attempt to delete from the next page // There is no page after this one so we just throw an IllegalArgumentException // since the entry is nowhere on the list. // Note that this exception will not be caught by deleteEntry (intentional) // because it is not called from within the try block. // Delete the entry from the next page // nextPage ended up dirty after deleteEntry // If this left the next page empty, then we need to delete that page and update our next page Id // Leave page unpinned dirty (page was dirtied by call to deleteEntry) // nextPage ended up clean after deleteEntry // Leave page unpinned clean (page was not dirtied by call to deleteEntry)