Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log Entries created on remote/other Peers are not Pinned Locally #1163

Open
justin0mcateer opened this issue Feb 22, 2024 · 5 comments
Open

Comments

@justin0mcateer
Copy link

In the previous implementation of OpLog.joinEntry, Log entries retrieved from other nodes were 'put' in the IPFSBlockStorage and optionally (via configuration) pinned. In the rewrite of OpLog.joinEntry _entries.put is no longer called and so the remotely created Log entries are no longer stored locally.

This results in the behavior that all Peers which have previously written to the log MUST be online or traversal of the Log will fail and unhandled exception in IPFSBlockStorage.get. This does not seem to be desirable behavior.

This code will crash with an unhandled promise rejection if any block fails to be fetched, which currently appears to occur if any previous log writer is offline:
https://github.com/orbitdb/orbitdb/blob/main/src/storage/ipfs-block.js#L61

In older versions of the code (prior to the OpLog.joinEntry rewrite), fetched OpLog entries were persisted locally:
https://github.com/orbitdb/orbitdb/blob/v1.0.0/src/oplog/log.js#L269

@haydenyoung
Copy link
Member

Is the peer using an in-memory blockstore for Helia? What happens if you configure the node with a persistent blockstore?

E.g.

import { LevelBlockstore } from 'blockstore-level' 

const blockstore = new LevelBlockstore('./some/path')
const libp2p = await createLibp2p()
const helia = await createHelia({ libp2p, blockstore })

My understanding is that the replicated block should also be pinned on the remote peer (isPinned should == "true" on the remote peer also).

@haydenyoung
Copy link
Member

haydenyoung commented Feb 26, 2024

Just to add that a persistent datastore may also be needed as I believe pins are stored to datastore not blockstore.

import { LevelBlockstore } from 'blockstore-level' 
import { LevelDatastore } from 'datastore-level' 

const blockstore = new LevelBlockstore('./some/path/helia/blocks')
const datastore = new LevelDatastore('./some/path/helia/data')
const libp2p = await createLibp2p()
const helia = await createHelia({ libp2p, blockstore, datastore })

(sorry haven't been able to actually confirm this, just going on a hunch re: datastore and pins).

@justin0mcateer
Copy link
Author

justin0mcateer commented Feb 26, 2024 via email

@justin0mcateer
Copy link
Author

My understanding is that the replicated block should also be pinned on the remote peer (isPinned should == "true" on the remote peer also).

I am not really sure what you are referring to here. The only way to pin anything in Helia is either locally, or via the 'Pinning API'. There isn't any way to compel another node to Pin your data.

@haydenyoung
Copy link
Member

Does IPFSBlockStorage fail immediately (I.e. as soon as the remote node is offline) or does it happen over time (I.e. the remote node has been offline for some time)? What would be the steps for me to reproduce this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants