Attachment #467602: fragmentation avoidance for most commonly fragmented files for bug #581606

View | Details | Raw Unified | Return to bug 581606
Collapse All | Expand All

(-)a/netwerk/cookie/nsCookieService.cpp (+3 lines)
Line     Link Here 
 Lines 734-739   nsCookieService::TryInitDB(PRBool aDelet Link Here 
734
  rv = mStorageService->OpenDatabase(cookieFile, getter_AddRefs(mDBState->dbConn));
734
  rv = mStorageService->OpenDatabase(cookieFile, getter_AddRefs(mDBState->dbConn));
735
  NS_ENSURE_SUCCESS(rv, rv);
735
  NS_ENSURE_SUCCESS(rv, rv);
736
736
737
  // Grow cookie db in 512KB increments
738
  mDBState->dbConn->SetDbGrowthIncrement(512*1024);
739
737
  PRBool tableExists = PR_FALSE;
740
  PRBool tableExists = PR_FALSE;
738
  mDBState->dbConn->TableExists(NS_LITERAL_CSTRING("moz_cookies"), &tableExists);
741
  mDBState->dbConn->TableExists(NS_LITERAL_CSTRING("moz_cookies"), &tableExists);
739
  if (!tableExists) {
742
  if (!tableExists) {
(-)a/storage/public/mozIStorageConnection.idl (+6 lines)
Line     Link Here 
 Lines 334-337   interface mozIStorageConnection : nsISup Link Here 
334
   * @return previous registered handler.
334
   * @return previous registered handler.
335
   */
335
   */
336
  mozIStorageProgressHandler removeProgressHandler();
336
  mozIStorageProgressHandler removeProgressHandler();
337
338
  /**
339
   * Controls SQLITE_FCNTL_CHUNK_SIZE setting in sqlite. This helps avoid fragmentation..
340
   * @param chunkSize the database file will grow in multiples of chunkSize
341
   */
342
  void setDbGrowthIncrement(in PRInt32 chunkSize);
337
};
343
};
(-)a/storage/src/mozStorageConnection.cpp (+7 lines)
Line     Link Here 
 Lines 1044-1048   Connection::RemoveProgressHandler(mozISt Link Here 
1044
  return NS_OK;
1044
  return NS_OK;
1045
}
1045
}
1046
1046
1047
NS_IMETHODIMP
1048
Connection::SetDbGrowthIncrement(PRInt32 aChunkSize)
1049
{
1050
  ::sqlite3_file_control(mDBConn, NULL, SQLITE_FCNTL_CHUNK_SIZE, &aChunkSize);
1051
  return NS_OK;
1052
}
1053
1047
} // namespace storage
1054
} // namespace storage
1048
} // namespace mozilla
1055
} // namespace mozilla
(-)a/toolkit/components/places/src/nsNavHistory.cpp (+3 lines)
Line     Link Here 
 Lines 691-696   nsNavHistory::InitDB() Link Here 
691
  // a transaction for performances.
691
  // a transaction for performances.
692
  mozStorageTransaction transaction(mDBConn, PR_FALSE);
692
  mozStorageTransaction transaction(mDBConn, PR_FALSE);
693
693
694
  // Grow places in 10MB increments
695
  mDBConn->SetDbGrowthIncrement(10*1024*1024);
696
694
  // Initialize the other Places services' database tables before creating our
697
  // Initialize the other Places services' database tables before creating our
695
  // statements. Some of our statements depend on these external tables, such as
698
  // statements. Some of our statements depend on these external tables, such as
696
  // the bookmarks or favicon tables.
699
  // the bookmarks or favicon tables.
(-)a/toolkit/components/url-classifier/src/nsUrlClassifierDBService.cpp (+1 lines)
Line     Link Here 
 Lines 3418-3423   nsUrlClassifierDBServiceWorker::OpenDb() Link Here 
3418
    }
3418
    }
3419
  }
3419
  }
3420
3420
3421
  connection->SetDbGrowthIncrement(5*1024*1024);
3421
  rv = connection->ExecuteSimpleSQL(NS_LITERAL_CSTRING("PRAGMA synchronous=OFF"));
3422
  rv = connection->ExecuteSimpleSQL(NS_LITERAL_CSTRING("PRAGMA synchronous=OFF"));
3422
  NS_ENSURE_SUCCESS(rv, rv);
3423
  NS_ENSURE_SUCCESS(rv, rv);
3423
3424

Return to bug 581606