Skip to content

feat: support deletion for memory graph#606

Merged
Wwwsylvia merged 13 commits into
oras-project:mainfrom
wangxiaoxuan273:deletable-memory
Oct 16, 2023
Merged

feat: support deletion for memory graph#606
Wwwsylvia merged 13 commits into
oras-project:mainfrom
wangxiaoxuan273:deletable-memory

Conversation

@wangxiaoxuan273
Copy link
Copy Markdown
Contributor

@wangxiaoxuan273 wangxiaoxuan273 commented Sep 25, 2023

Signed-off-by: Xiaoxuan Wang wangxiaoxuan119@gmail.com

Part 1/4 of #454

Based on draft PR #582

Current behavior regarding graph.Memory.Remove(node):

  • node entry in m.successors and m.nodes is removed.
  • node is removed from its successors predecessors list.
  • node entry in m.predecessors is NOT removed, unless all its predecessors no longer exist.
  • node is NOT removed from its predecessors' m.successors list. The m.successors is always in accordance with the actual content.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 25, 2023

Codecov Report

❌ Patch coverage is 96.49123% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.11%. Comparing base (e8e4f84) to head (012930a).
⚠️ Report is 122 commits behind head on main.

Files with missing lines Patch % Lines
internal/graph/memory.go 96.36% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #606      +/-   ##
==========================================
+ Coverage   74.84%   75.11%   +0.26%     
==========================================
  Files          58       59       +1     
  Lines        5328     5420      +92     
==========================================
+ Hits         3988     4071      +83     
- Misses        987      994       +7     
- Partials      353      355       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread internal/graph/benchmark_test.go Outdated
Comment thread internal/graph/deletablememory.go Outdated
Comment thread internal/graph/deletablememory_test.go Outdated
Comment thread internal/graph/memory.go
Comment thread internal/graph/memory_test.go Outdated
Comment thread internal/graph/memory_test.go
Comment thread internal/graph/memory_test.go Outdated
Comment thread internal/graph/memory.go
@Wwwsylvia
Copy link
Copy Markdown
Member

Wwwsylvia commented Oct 9, 2023

Can we share the benchmark result here? So that the community understands why we merge Memory and DeletableMemory.

@wangxiaoxuan273
Copy link
Copy Markdown
Contributor Author

wangxiaoxuan273 commented Oct 9, 2023

Can we share the benchmark result here? So that the community understands why we merge Memory and DeletableMemory.

Here are the benchmark results of the original graph.Memory implementation (titled Memory, which was optimized for concurrent reads and adds, there was no delete functionality), compared to the current one (titled DeletableMemory, which enables concurrent delete):

  • for function Index
Screenshot 2023-09-25 at 18 11 14
  • for function IndexAll
Screenshot 2023-09-25 at 18 13 09
  • for function Predecessors
Screenshot 2023-09-25 at 18 16 26

The performance is similar, so we use the current implementation.

Copy link
Copy Markdown
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread internal/graph/memory_test.go Outdated
Comment thread internal/graph/memory_test.go Outdated
@shizhMSFT
Copy link
Copy Markdown
Contributor

The benchmark looks good to me. We can merge this PR once you have addressed @Wwwsylvia 's comments and above minor comments related to the graphs in the test files.

Copy link
Copy Markdown
Member

@Wwwsylvia Wwwsylvia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. Some comments may need rephrasing.

Comment thread internal/graph/memory.go Outdated
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
Copy link
Copy Markdown
Member

@Wwwsylvia Wwwsylvia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Wwwsylvia Wwwsylvia merged commit 459a246 into oras-project:main Oct 16, 2023
@wangxiaoxuan273 wangxiaoxuan273 deleted the deletable-memory branch October 16, 2023 04:59
shizhMSFT pushed a commit that referenced this pull request Nov 20, 2023
Part 4/4 of #454 

This PR should be reviewed and merged after PR #606 #607 #608

---------

Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
@Wwwsylvia Wwwsylvia mentioned this pull request Jan 26, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants