Storage space for deleted blobs not freed in JDS 3.51 and below.

By: Ben Matterson

Abstract: Some workarounds for using blobs with JDataStore 3.51.

Blob Storage Issue

JDataStore versions 3.51 and below do not reclaim space for blob storage when a row is deleted.

Note: This is fixed for JDataStore version 4.0.

This affects columns of type CHAR, BINARY, and OBJECT if there length exceeds the MaxInline property for that column. The default MaxInline property for a column is 64 bytes. The MaxInline property for a column can be set to a max of about 1300 bytes when a 4k page size is used for a JDataStore database.

If you must use JDataStore 3.51 The following workarounds might be of use to you:
  • Execute an update statement setting all blob columns to null before deleting the row. This makes the the delete operation slower, but update will properly release the blob storage.
  • You can increase the max inline storage for blob columns. This defaults to 64 bytes, but you could easily change this to 1300 bytes (max row size is roughly 1/3 the JDataStore block size). If you increase the block size, you could go even higher. This property controls how much blob storage will used inside a table's record storage before spilling into blob storage. Since table storage is reclaimed properly, blobs under the max inline storage for blob columns will not have this problem. You can set this property when you create the table using a sql statement by specifying the object column types as "OBJECT(0, 1300)". This creates a column with a 0 precision and 1300 byte max inline setting. For a BINARY COLUMN use "BINARY(0, 1300)". For a String column use "CHAR(, ). Strings may not need such a high maxInline setting as Object.
  • StorageDataSet.empty() method will properly reclaim space.
  • Copy the table row by row to another table without using DataStoreConnection.copyStreams(), then delete the old table.
  • Drop the table from the database.

Server Response from: ETNASC01