Data lost during sync


(Egor Ovcharenko) #1

Bug report

I had some important notes, worked on them yesterday from several workspaces (1 Windows and 1 MacOS), and today two notes are completely gone! Not in trash, but gone. How did this happen? and how can I recover them?

Info

  • Platforms: macOS + Windows
  • App Version: latest

Reproduce

See above


(Takuya Matsuyama) #2

Hi Egor,

Thank you for the report.
That’s strange. But basically it does not delete notes unless you manually deleted them.
Have you set up the backup?
Deleted notes should be stored in _deleted folder.
If you accidentally overwritten the note, you can restore old revisions of it.
Hope that helps.
If it does not help, I’m sorry but I can’t restore your notes.


(Egor Ovcharenko) #3

Thanks for a quick reply. That is strange indeed. The tags that I’ve assigned to these notes are present but they don’t contain any notes inside. I don’t think I have overwritten those notes with others, they were too different. And I am pretty sure I’ve never empties the Trash, and they are not there now.

As for the backup - no, I haven’t enabled it. Maybe it should be turned on by default?

Anyway, thanks for the help, let’s just hope it’s one time glitch, otherwise I love Inkdrop.


(Takuya Matsuyama) #4

If they have been accidentally deleted during sync, they are still stored in your local database.
You can get a list of locally deleted documents by running this code in Developer Tools:

var db = inkdrop.main.dataStore.getLocalDB()
var changes = await db.pouch.changes({
  since: 0
})
var { results } = changes
var deletedIds = results
  .filter(change => change.deleted)
  .filter(change => change.id.startsWith('note:'))
  .map(change => change.id)
console.log('Deleted IDs:', deletedIds)

To get revisions of a deleted document:

await db.pouch.get("note:*****", { revs: true, open_revs: "all" })

You get something like:

[
  {
    "ok": {
      "_id": "note:_fjreUO3w",
      "_rev": "3-630a66dcebb069914e17e812d2d0cc93",
      "_deleted": true,
      "_revisions": {
        "start": 3,
        "ids": [
          "630a66dcebb069914e17e812d2d0cc93",
          "c242ec8592ba8b8f4034d539ba306b70",
          "96fb06c4c3c41480c136992dc3aeca2d"
        ]
      }
    }
  }
]

Then, get a previous revision like so:

await db.pouch.get("note:_fjreUO3w", { rev: "2-c242ec8592ba8b8f4034d539ba306b70" })

Backup configuration depends on environment, so it’s optional. But it would be nice to encourage with a message or something.
Thank you for the suggestion and hope that helps.