Replies: 3 comments 3 replies
-
Since it's just a question, so I converted it into a discussion topic.
It guarantees repeatable read. If you close the readonly transaction, then there will be no guarantee on repeatable read. No transaction, no guarantees.
Yes, it's correct based on current design & implementation. Let me know if you have any thoughts to improve this. |
Beta Was this translation helpful? Give feedback.
-
@ahrtr Yes, backups can be improved: WriteTo isn't using the mmap'ed data during the long-running operation, so there's no need to block further mmaps. All it needs the Tx for is making sure that old pages don't get reused, right? So while WriteTo is running, we don't need to have Now, achieving that can be tricky, and, from what I can see, will require API contract changes either way: a) We can just do b) We can add DB.WriteTo which opens its own transaction and does early c) add Tx.SafeWriteTo which is like Tx.WriteTo but documented to invalidate byte slices and cursors, i.e. (a) in a separate method d) add a database flag that enables the new behavior of Tx.WriteTo described in (a) e) change Tx.WriteTo to the new behavior described in (a), but add a database flag that restores the old one in case anyone relies on it Or maybe we even decide that it's very unlikely that anyone in the wild carries byte slices or cursors over the call to WriteTo, and just do (a). I would be happy to contribute implementation of either approach. |
Beta Was this translation helpful? Give feedback.
-
Firstly, I assume that you understand how bbolt works. Refer to https://github.com/ahrtr/etcd-issues/blob/master/docs/cncf_storage_tag_etcd.md#storage-boltdb-feature Let me try to summarize this. What Is the Problem?
It may take a long time for What do we expect?
Potential solution(preferred) Increase the db size before executing
|
Beta Was this translation helpful? Give feedback.
-
Tx.WriteTo is fundamentally a long-running operation, it needs to read and write the entire size of the database. If, meanwhile, a write transaction needs the database to grow, everything gets stuck until the backup (WriteTo) completes. This is unfortunate.
After writing the meta pages, why does
Tx.WriteTo
need to keep holding the transaction open? Can we make a different method that simply returns the open file and size, and allows the caller to proceed with io.CopyN, while releasing the read transaction?Any pitfalls here? I guess there's a concern about some required pages being overwritten, resulting in an inconsistent state? If yes, is there another way to avoid WriteTo blocking mmap resizing, perhaps (again, in a new method) by taking over the Tx entirely, and marking it as not blocking mmaps?
Beta Was this translation helpful? Give feedback.
All reactions