y-crdt / y-octo

CRDT implementation which is compatible with https://github.com/yjs/yjs
https://octobase.pro/
Other
187 stars 5 forks source link

fix: conflict check when reference right is none #40

Closed darkskygit closed 7 months ago

darkskygit commented 7 months ago

fix a edge case:

Node {
  id: { client: 1, id: 2}
  left: { client: 1, id: 3}
  right: { client: 1, id: 3}
}

in old version, this will lead to a dead loop of node's conflict resolve logics that refered to this node

codecov-commenter commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (4d6a29c) 77.96% compared to head (e027223) 78.12%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #40 +/- ## ========================================== + Coverage 77.96% 78.12% +0.15% ========================================== Files 52 52 Lines 7752 7771 +19 ========================================== + Hits 6044 6071 +27 + Misses 1708 1700 -8 ``` | [Flag](https://app.codecov.io/gh/y-crdt/y-octo/pull/40/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [node-binding-test](https://app.codecov.io/gh/y-crdt/y-octo/pull/40/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `36.92% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 7 months ago

Benchmark for Linux

Click to view benchmark | Test | Base | PR | % | | --- | --- | --- | --- | | codec/jwst decode var_int (32 bit) | 212.2±0.28µs | 212.8±1.59µs | **+0.28%** | | codec/jwst decode var_uint (32 bit) | 180.8±0.65µs | 180.7±0.46µs | **-0.06%** | | codec/jwst decode var_uint (64 bit) | 180.4±0.53µs | 180.6±0.60µs | **+0.11%** | | codec/jwst encode var_int (32 bit) | 334.8±7.90µs | 334.0±2.14µs | -0.24% | | codec/jwst encode var_uint (32 bit) | 250.9±11.17µs | 248.0±3.27µs | -1.16% | | codec/jwst encode var_uint (64 bit) | 249.1±6.14µs | 249.0±3.42µs | -0.04% | | codec/lib0 decode var_int (64 bit) | 185.8±2.28µs | 186.6±3.00µs | +0.43% | | codec/lib0 decode var_uint (32 bit) | 155.0±5.67µs | 152.8±2.23µs | **-1.42%** | | codec/lib0 decode var_uint (64 bit) | 154.7±3.18µs | 154.4±2.75µs | -0.19% | | codec/lib0 encode var_int (64 bit) | 384.8±3.61µs | 385.0±1.19µs | +0.05% | | codec/lib0 encode var_uint (32 bit) | 372.9±0.45µs | 373.7±0.37µs | **+0.21%** | | codec/lib0 encode var_uint (64 bit) | 373.1±1.64µs | 373.8±0.88µs | **+0.19%** | | ops/array/jwst/insert | 105.5±0.64µs | 105.2±0.45µs | **-0.28%** | | ops/array/jwst/insert range | 155.2±2.06µs | 158.2±0.83µs | **+1.93%** | | ops/array/jwst/remove | 60.3±0.33µs | 60.9±0.33µs | **+1.00%** | | ops/array/yrs/insert | 58.0±2.19µs | 51.5±0.44µs | **-11.21%** | | ops/array/yrs/insert range | 74.7±0.21µs | 75.8±1.02µs | **+1.47%** | | ops/array/yrs/remove | 63.2±0.70µs | 66.5±0.30µs | **+5.22%** | | ops/map/jwst/get | 207.2±1.85ns | 209.4±4.64ns | **+1.06%** | | ops/map/jwst/insert | 3.2±0.03µs | 3.2±0.02µs | -0.00% | | ops/map/jwst/remove | 4.3±0.01µs | 4.3±0.08µs | -0.00% | | ops/map/yrs/get | 262.4±5.63ns | 261.3±0.81ns | **-0.42%** | | ops/map/yrs/insert | 3.9±0.11µs | 3.9±0.03µs | -0.00% | | ops/map/yrs/remove | 5.0±0.01µs | 5.0±0.03µs | -0.00% | | ops/text/jwst/insert | 67.4±0.41µs | 67.6±0.51µs | **+0.30%** | | ops/text/jwst/remove | 1396.5±11.89ns | 1411.7±7.94ns | **+1.09%** | | ops/text/yrs/insert | 27.4±0.89µs | 27.0±0.19µs | **-1.46%** | | ops/text/yrs/remove | 1728.3±3.95ns | 1714.8±18.44ns | **-0.78%** | | update/parse with jwst/basic.bin | 39.8±0.27µs | 39.2±0.12µs | **-1.51%** | | update/parse with jwst/database.bin | 31.8±0.33µs | 31.7±0.11µs | **-0.31%** | | update/parse with jwst/large.bin | 3.2±0.02ms | 3.2±0.03ms | -0.00% | | update/parse with jwst/with-subdoc.bin | 5.2±0.04µs | 5.5±0.03µs | **+5.77%** | | update/parse with yrs/basic.bin | 29.9±0.50µs | 30.3±0.15µs | **+1.34%** | | update/parse with yrs/database.bin | 24.1±0.09µs | 24.3±0.11µs | **+0.83%** | | update/parse with yrs/large.bin | 2.4±0.01ms | 2.3±0.01ms | **-4.17%** | | update/parse with yrs/with-subdoc.bin | 3.5±0.03µs | 4.1±0.01µs | **+17.14%** |

Benchmark for Windows

Click to view benchmark | Test | Base | PR | % | | --- | --- | --- | --- | | codec/jwst decode var_int (32 bit) | 243.1±1.40µs | 242.4±0.72µs | **-0.29%** | | codec/jwst decode var_uint (32 bit) | 180.7±3.57µs | 180.2±4.10µs | -0.28% | | codec/jwst decode var_uint (64 bit) | 207.1±2.18µs | 207.2±1.63µs | +0.05% | | codec/jwst encode var_int (32 bit) | 303.4±2.97µs | 302.8±3.70µs | -0.20% | | codec/jwst encode var_uint (32 bit) | 267.9±5.38µs | 271.0±2.05µs | **+1.16%** | | codec/jwst encode var_uint (64 bit) | 267.3±3.76µs | 264.9±2.76µs | **-0.90%** | | codec/lib0 decode var_int (64 bit) | 186.7±3.32µs | 184.1±5.58µs | -1.39% | | codec/lib0 decode var_uint (32 bit) | 157.5±8.68µs | 155.5±6.33µs | -1.27% | | codec/lib0 decode var_uint (64 bit) | 160.2±8.69µs | 159.6±7.89µs | -0.37% | | codec/lib0 encode var_int (64 bit) | 384.7±1.83µs | 385.5±3.04µs | +0.21% | | codec/lib0 encode var_uint (32 bit) | 375.4±5.31µs | 373.2±1.47µs | **-0.59%** | | codec/lib0 encode var_uint (64 bit) | 373.9±2.62µs | 373.5±1.75µs | -0.11% | | ops/array/jwst/insert | 124.0±0.78µs | 124.7±2.70µs | **+0.56%** | | ops/array/jwst/insert range | 183.7±1.48µs | 180.1±0.64µs | **-1.96%** | | ops/array/jwst/remove | 68.5±0.28µs | 66.2±0.29µs | **-3.36%** | | ops/array/yrs/insert | 76.5±0.93µs | 72.7±0.39µs | **-4.97%** | | ops/array/yrs/insert range | 100.2±1.61µs | 99.5±0.91µs | **-0.70%** | | ops/array/yrs/remove | 105.5±1.96µs | 104.1±0.90µs | **-1.33%** | | ops/map/jwst/get | 266.9±11.97ns | 268.8±3.86ns | +0.71% | | ops/map/jwst/insert | 5.1±0.03µs | 4.8±0.04µs | **-5.88%** | | ops/map/jwst/remove | 9.2±0.08µs | 6.7±0.02µs | **-27.17%** | | ops/map/yrs/get | 269.9±4.54ns | 268.9±3.88ns | -0.37% | | ops/map/yrs/insert | 5.7±0.11µs | 5.8±0.06µs | **+1.75%** | | ops/map/yrs/remove | 6.9±0.05µs | 7.4±0.03µs | **+7.25%** | | ops/text/jwst/insert | 88.2±0.51µs | 84.6±0.64µs | **-4.08%** | | ops/text/jwst/remove | 2.2±0.02µs | 2.1±0.02µs | **-4.55%** | | ops/text/yrs/insert | 33.4±0.46µs | 31.9±0.21µs | **-4.49%** | | ops/text/yrs/remove | 2.6±0.03µs | 2.5±0.02µs | **-3.85%** | | update/parse with jwst/basic.bin | 57.8±0.61µs | 58.3±0.47µs | **+0.87%** | | update/parse with jwst/database.bin | 45.0±0.91µs | 46.1±0.19µs | **+2.44%** | | update/parse with jwst/large.bin | 2.9±0.13ms | 2.8±0.06ms | **-3.45%** | | update/parse with jwst/with-subdoc.bin | 8.4±0.10µs | 8.7±0.15µs | **+3.57%** | | update/parse with yrs/basic.bin | 43.7±0.71µs | 44.0±0.26µs | **+0.69%** | | update/parse with yrs/database.bin | 35.5±0.18µs | 35.6±0.31µs | **+0.28%** | | update/parse with yrs/large.bin | 2.1±0.14ms | 2.2±0.08ms | **+4.76%** | | update/parse with yrs/with-subdoc.bin | 7.3±0.07µs | 7.3±0.05µs | -0.00% |