HashIndex.java
/**
   * Deletes the specified data entry from the index file.
   * 
   * @throws IllegalArgumentException if the entry doesn't exist
   */
Deletes the specified data entry from the index file.

@throws IllegalArgumentException if the entry doesn't exist
Deletes the specified data entry from the index file . @throws IllegalArgumentException if the entry doesn ' t exist
public void deleteEntry(SearchKey key, RID rid) {
	  Page directoryPage = new Page();
	  Minibase.BufferManager.pinPage(headId, directoryPage, PIN_DISKIO);
	  int hashIndex = key.getHash(DEPTH);
	  PageId primaryBucketId = new PageId(directoryPage.getIntValue(hashIndex * INT_SIZE));
	  HashBucketPage primaryBucketPage = new HashBucketPage();
	  if (INVALID_PAGEID == primaryBucketId.pid)
	  { 
		  throw new IllegalArgumentException("Attempted to delete an entry that did not exist!");
	  }
	  Minibase.BufferManager.pinPage(primaryBucketId, primaryBucketPage, PIN_DISKIO); 
	  DataEntry entry = new DataEntry(key, rid);
	  if (primaryBucketPage.deleteEntry(entry))
	  {
		  Minibase.BufferManager.unpinPage(primaryBucketId, UNPIN_DIRTY);
	  }
	  else
	  {
		  Minibase.BufferManager.unpinPage(primaryBucketId, UNPIN_CLEAN);
	  }
	  Minibase.BufferManager.unpinPage(headId, UNPIN_CLEAN);
  }
public void deleteEntry ( SearchKey key , RID rid ) { Page directoryPage = new Page ( ) ; Minibase . BufferManager . pinPage ( headId , directoryPage , PIN_DISKIO ) ; int hashIndex = key . getHash ( DEPTH ) ; PageId primaryBucketId = new PageId ( directoryPage . getIntValue ( hashIndex * INT_SIZE ) ) ; HashBucketPage primaryBucketPage = new HashBucketPage ( ) ; if ( INVALID_PAGEID == primaryBucketId . pid ) { throw new IllegalArgumentException ( "Attempted to delete an entry that did not exist!" ) ; } Minibase . BufferManager . pinPage ( primaryBucketId , primaryBucketPage , PIN_DISKIO ) ; DataEntry entry = new DataEntry ( key , rid ) ; if ( primaryBucketPage . deleteEntry ( entry ) ) { Minibase . BufferManager . unpinPage ( primaryBucketId , UNPIN_DIRTY ) ; } else { Minibase . BufferManager . unpinPage ( primaryBucketId , UNPIN_CLEAN ) ; } Minibase . BufferManager . unpinPage ( headId , UNPIN_CLEAN ) ; }
Deletes the specified data entry from the index file.
Deletes the specified data entry from the index file .
// Load the directory page // Find what primary bucket this needs to be deleted from // Get the page Id of the primary bucket page at that index // No primary bucket page for that index  // Load the primary bucket page // Build the entry object // Delete the entry in our hash bucket and unpin clean/dirty as appropriate // Unpin our directory page to leave it as we found it