What to do with all the Shards?

I noticed in the Zetetic >Shards folder there are a lot of changeset db files dating back several years. How many of these do I need to keep for data integrity and how many of them can I delete?

Hi @yunamc

Thanks for posting with this question.

As you make changes in the Codebook interface and sync, small encrypted changeset files (codebook-changesets-[n].db) representative of these changes are uploaded to Google Drive/Dropbox (into the Zetetic > Shards folder as you mentioned). Each Codebook device “tracks” which of these changes its seen (and which changes Google Drive/Dropbox has seen from itself). This allows Codebook sync to operate in an efficient manner in which it only uploads/downloads encrypted chunks of changes which it needs to.

Over time, these changeset files will build up (as you see) as Codebook has no way of knowing whether all the devices have seen all the changes (of if you have changes in the remote which no current device has). If all your current Codebook devices cumulatively have all your Codebook data present, then you can perform an overwrite/merge combination from your devices to clear out the codebook-changesets history in the remote and establish a new history with only a few changesets representative of your current Codebook data.

Here are the instructions to do that:

If you’re syncing with Google Drive or Dropbox

  1. Enable Sync Operations on the device which you believe to be most up-to-date by following these instructions: Codebook Help - Sync Operations
  2. On that same device, set the Operation to Overwrite and start the Overwrite.
  3. On every other device you’re syncing with, enable sync operations by following these steps: Codebook Help - Sync Operations
  4. Set the operation to Merge and start the Merge. Choose Google Drive or Dropbox as the conflict authority.

If you’re syncing over Desktop WiFi

  1. Enable Sync Operations on your mobile device by following these instructions: Codebook Help - Sync Operations
  2. Set the operation to Merge on your mobile device and start the Merge. Choose whichever device you feel to be “most correct” as the conflict authority.
  3. Repeat steps 1 & 2 for every other mobile device you’re syncing with.
  4. If you have any other Desktops/Laptops, repeat steps 1 & 2 with one of the mobiles and the other Desktops/Laptops.

Note: Choosing the conflict authority doesn’t choose all the data from one device, it’s only used in edge cases where the Standard conflict resolution can’t determine which record was updated more recently as described here: Codebook Help - Sync Operations

If you just delete the entire Zetetic/Shards folder each Codebook device will still “think” there’s another remote out there which it hasn’t synced with (and hold onto local changesets forever), so it’s necessary to perform the Overwrite/Merge combinations steps listed above to “cleanup/reset” the local tracking history as well.

The overwrite/merge combination will take some additional time compared to the standard sync operation as it’s fully re-establishing the remote and each merge needs to compare the changes from each device with what’s present in the remote. You shouldn’t need to do it frequently as the uploaded changesets should generally be small (with the exception of when you add larger images).

Please let me know if this answers your question and if you’re able to perform the Overwrite/Merge combination to consolidate your changesets in Google Drive if so desired. Thanks!

Thanks. Will test it out.