I'm getting an error moving a node in Leo. It's a very large/deep node if that matters.
This large node, X, is/was a root. I added a new root node, Y, then tried to move X under Y which resulted in the attached error.
--
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/sANduRjZDVI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/CAMF8tS1j42g_U6rs5b0sUO9kAaVG7ys998R-uN1yma%3D6t4tejg%40mail.gmail.com.
I had root nodes like the following, I selected node B and inserted a new node below, i.e. using insert-node Y.Then I attempted to move X under Y. Note that I repeated this and also tried to move deep nodes within X at lower levels which also resulted in the error.Node X currently has ~6,700 descendant nodes.
--
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/sANduRjZDVI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/CAMF8tS3MiyXu6xx3nvaU3gzfYRRoK2WhyV6tO3ni85NPCSUK-w%40mail.gmail.com.
I had root nodes like the following, I selected node B and inserted a new node below, i.e. using insert-node Y.Then I attempted to move X under Y. Note that I repeated this and also tried to move deep nodes within X at lower levels which also resulted in the error.Node X currently has ~6,700 descendant nodes.ABXDKevin(I'll also add this to the Git ticket)On Wed, 2020-09-02 at 08:08 -0500, Edward K. Ream wrote:
--On Wed, Sep 2, 2020 at 7:38 AM k-hen <percepti...@gmail.com> wrote:I'm getting an error moving a node in Leo. It's a very large/deep node if that matters.Thanks for this report. I have just created #1639 for this issue.This large node, X, is/was a root. I added a new root node, Y, then tried to move X under Y which resulted in the attached error.How exactly did you add Y? Did you use insert-node-before?Usually, adding Y (say with Ctrl-I) would not create a new root. After creating Y, you would then have to move Y to the root, which in this case would likely init Leo's data structures properly.Edward
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/sANduRjZDVI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-e...@googlegroups.com.
Thanks re: the clarification, yes they are 'top-level' then.Unfortunately I'm unable to send this _particular_ outline due to client confidentiality,but am happy to run whatever code or tests that you'd like me too.
"""Remove all sensitive material in this outline, except for this node."""
# Warning: This script is dangerous! Use on a copy of your outline.
n = 1
v0 = c.p.v
for p in c.all_unique_positions():
if p.v != v0:
p.h = f"node {n}"
p.b = ''
n += 1
c.redraw()--
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/sANduRjZDVI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/3d6a2dc6-d63f-493f-9554-e70eb1223124o%40googlegroups.com.
Ok, got it, will need a bit of time, but will get back to you soon.
--
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/sANduRjZDVI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/9afd5fe4-7fd3-4e68-91d7-283f02367601o%40googlegroups.com.
My tentative conclusion is that there may be a bug in fc.retrieveVnodesFromDb. However, there are no special cases in this code, so what the bug could possibly be is a big mystery. Iirc, Vitalije wrote this code. Any insights would be appreciated.
from collections import defaultdict
def relink_outline(c):
'''Normalizes outline fixing broken links'''
parDict = defaultdict(list)
for p in c.all_positions():
parDict[p.gnx].append(p._parentVnode())
gnx2v = c.fileCommands.gnxDict
for gnx, parents in parDict.items():
v = gnx2v[gnx]
v.parents = parents
c.checkOutline()
relink_outline(c)
My tentative conclusion is that there may be a bug in fc.retrieveVnodesFromDb. However, there are no special cases in this code, so what the bug could possibly be is a big mystery. Iirc, Vitalije wrote this code. Any insights would be appreciated.I am almost 100% sure that the fc.retrieveVnodesFromDb works correctly. It just restores outline from the rows retrieved from db. Saving and loading from db work in tandem. If the outline being saved has broken links, then the outline loaded afterwards will have broken links too.
Most likely outline got broken links during some modification and later was saved as such.Here is a script that can fix broken links:from collections import defaultdict
def relink_outline(c):
'''Normalizes outline fixing broken links'''
parDict = defaultdict(list)
for p in c.all_positions():
parDict[p.gnx].append(p._parentVnode())
gnx2v = c.fileCommands.gnxDict
for gnx, parents in parDict.items():
v = gnx2v[gnx]
v.parents = parents
c.checkOutline()
relink_outline(c)
When saving to xml information about parent links is omitted. When loading from xml file, correct parent links are infered again. Perhaps I can change writing to db to omitt parent links and just infer them when loading from db.
It is still a mistery how k-hen got his outline to this invalid state. My guess is that it was caused during the updating clones in both @file files and @nosent files. That would explain why we haven't noticed this bug before. It is not very common to have shared clones in both @nosent and @file files.
--
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/sANduRjZDVI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/56aa7952-a09d-4da5-b176-206916448e26o%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/sANduRjZDVI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/56aa7952-a09d-4da5-b176-206916448e26o%40googlegroups.com.
For the record, unfortunately this script didn't fix the issue - it still wasn't happy.I had to convert to .leo xml and then back to .db.I think there's still a lot of value in fixing the DB format, but hopefully in a way that won't limit it's potential performance.