Conversation
…e merge result by modifying the contents.
Pull Request Test Coverage Report for Build 2435065658
💛 - Coveralls |
roylee17
left a comment
There was a problem hiding this comment.
Is this still needed? From your comment, the culprit is the merger instead, right?
If the enc.WriteString(key) was not enough, the keySize = len(key) probably will won't save it, either.
I'm just taking it for granted that truncating to 2 bytes is the right thing. Not familiar with the history of the comment. The point of You are correct though that I did NOT find something in the blockchain that triggers an actual problem here. It was the merger that had screwed up the data. I just started focusing here because the panic was in |
|
Might be better to use |
|
I see. I had a quick glance through the codebase, and it does seems that we don't have checker for the name length (not 100% sure) |
|
If I read the graph right, it does cut 40GB of memory allocation (from LoadChanges and Pebble background compaction) during that 1hr. The improvements should reflect in faster sync time after all. I'm having full syncs (before and after the changes) from scratch over the weekend on a dev server. |
|
It might only affect CPU usage during sync. Or it might only affect the "Building entire claimtrie in RAM" phase. For my runs, I think the peer would only provide blocks at a certain rate and that controlled the overall time. |
|
The key size is for names, which are limited in the mempool to 256 (or 255) bytes. Even if we expand them to the worst possible length with our normalization, they won't be longer than 4x that. Hence, two bytes will always be long enough for the length of a name. When I originally coded this I couldn't see any difference in runtime (wall-clock) performance. |
|
Ran some tests over the weekend, and it turned out the sync time improves only slightly 13h 54m vs 13h 38m while RamTrie rebuild time significantly reduced, this is very helpful to the development Sync timeBefore: After: (Re) Startup timeBefore: After: |


Unbundled from PR: #43
See that for usage/testing.
Based on work by @BrannonKing in mem_pressure_try_2 and reduce_memory_pressure.
The stuff in 92d8b5f is something that seems unsafe which I found while debugging. The database was being corrupted, and I was seeing crashes in Change.Unmarshal() trying to read bytes that weren't there.
Eventually I figured out the problem was in the merger, and submitted 728ddc4