Open AsterDY opened 2 weeks ago
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Attention: Patch coverage is 75.70850%
with 60 lines
in your changes missing coverage. Please review.
Project coverage is 71.58%. Comparing base (
99f5b35
) to head (95e7de9
). Report is 17 commits behind head on main.
Files | Patch % | Lines |
---|---|---|
ast/node.go | 77.57% | 14 Missing and 10 partials :warning: |
ast/buffer.go | 68.88% | 11 Missing and 3 partials :warning: |
ast/parser.go | 81.66% | 9 Missing and 2 partials :warning: |
api.go | 0.00% | 4 Missing :warning: |
ast/iterator.go | 55.55% | 1 Missing and 3 partials :warning: |
ast/search.go | 70.00% | 2 Missing and 1 partial :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:exclamation: There is a different number of reports uploaded between BASE (99f5b35) and HEAD (95e7de9). Click for more details.
HEAD has 5 uploads less than BASE
| Flag | BASE (99f5b35) | HEAD (95e7de9) | |------|------|------| ||7|2|
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Background
Since sonic uses
Lazy-Load
design to parse JSON nodes on demands, it doesn't supportconcurrently-Read
by default. But in practice, we found many users may use it in such scenarios and cause panic.Desgin
Thus we design one kind of
State Transition Lock
to achieve the goal by least cost. In brief:Lazy
state (parse transversely on demands). Every node has only two state:Parsed
(bool, number, or object slice...) orRaw
(JSON), and the only transit direction isRaw->Parsed
;Get()
) will check its state usingAtomic Load
:Write Lock
Raw()
andMarshalJSON()
). In these circumstances, we need keep the Raw state to achieve the best performance. Thus useRead Lock
to keep the state.Performance
Get
, about 5~10%. Thus we not enable it by default, except user manually setSearchOption.ConcurrentRead=true
or create JSON node byNewNodeSafeRead()
or callNode.LoadAll()/Load()