Skip to content
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.

database file size not updating? #308

Closed
@ghost

Description

First off, thanks for putting together a great DB. I've been using it on several projects and like it a lot.

I did notice today that I have two databases with the same number of rows: 30,974
I was amazed to see that their file sizes are exactly the same: 134,217,728 bytes

However, they contain a different number of buckets and different values (although the keys are the same).

I also noticed that after deleting tens of thousands of key/value pairs from the database with the following code, the file size remained unchanged.

db.Update(func(tx *bolt.Tx) error {
  b := tx.Bucket([]byte("bucketName"))
  err := b.Delete([]byte("keyToDelete"))
  return err
})

I double checked the database and it's only returning the correct quantity of key/value pairs when iterating with a ForEach, so the delete did appear to work.

Before deleting the key/value pairs from each database, I moved them to a backup. The two backup files for the two databases are different files sizes: 67,108,864 and 16,777,216 bytes

So, it looks like it's writing different volumes, but I expected the file sizes of the original databases to be reduced by those respective amounts.

Maybe this isn't an issue, but I'm just curious as to why the file sizes are remaining the same after the deletes and why two different databases would have the same number of bytes.

Thanks!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions