Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@swilly22
Copy link
Contributor

Support for GRAPH.EFFECT replicating modifications to both replicas and AOF

@swilly22 swilly22 requested a review from AviAvni January 14, 2023 18:59
@swilly22 swilly22 force-pushed the effects branch 3 times, most recently from dd92c2b to a8c0587 Compare February 3, 2023 17:48
@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Patch coverage: 95.57% and project coverage change: +0.11 🎉

Comparison is base (ab4d85b) 90.36% compared to head (bebf1e7) 90.48%.

❗ Current head bebf1e7 differs from pull request most recent head b52b41f. Consider uploading reports for the commit b52b41f to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2826      +/-   ##
==========================================
+ Coverage   90.36%   90.48%   +0.11%     
==========================================
  Files         283      287       +4     
  Lines       28072    28747     +675     
==========================================
+ Hits        25367    26011     +644     
- Misses       2705     2736      +31     
Impacted Files Coverage Δ
src/commands/commands.c 46.15% <0.00%> (-3.85%) ⬇️
src/graph/entities/edge.c 83.87% <ø> (ø)
...ializers/decoders/prev/v11/decode_graph_entities.c 0.00% <0.00%> (ø)
...ializers/decoders/prev/v12/decode_graph_entities.c 0.00% <0.00%> (ø)
src/commands/cmd_config.c 92.20% <70.00%> (-3.74%) ⬇️
src/value.c 91.37% <93.33%> (+0.57%) ⬆️
src/commands/cmd_effect.c 93.75% <93.75%> (ø)
src/graph/graph_statistics.c 96.15% <93.75%> (-3.85%) ⬇️
src/undo_log/undo_log.c 98.62% <95.00%> (+0.04%) ⬆️
src/configuration/config.c 90.22% <95.45%> (+0.29%) ⬆️
... and 20 more

... and 5 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@swilly22 swilly22 added the x:perf Performance related issue/PR ( not affecting functionality ) label Feb 8, 2023
Copy link
Contributor

@AviAvni AviAvni left a comment

Choose a reason for hiding this comment

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

nice

UndoLog *undolog = QueryCtx_GetUndoLog();
uint n = UndoLog_Length(*undolog);

if(n > 2048 || n == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why 2048?


if(n > 2048 || n == 0) {
// either no changes or too many changes, do not use effects
return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't check if there is non-deterministic change

Config_VKEY_MAX_ENTITY_COUNT,
Config_DELTA_MAX_PENDING_CHANGES
Config_DELTA_MAX_PENDING_CHANGES,
Config_REPLICATE_EFFECTS
Copy link
Contributor

Choose a reason for hiding this comment

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

are you sure we want it to changed during runtime?
did you test what happen if you change this during traffic?
also need to test that we can load aof file mixed with effect and queries

bool has_indecise = GraphContext_HasIndices(gc);
UndoLog *undo_log = (log == true) ? QueryCtx_GetUndoLog() : NULL;

for (uint i = 0; i < n; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe

if(log == true) {
	for (uint i = 0; i < n; i++) {
		// add each deleted edge to undo-log
 		UndoLog_DeleteEdge(undo_log, edges + i);
 	}
}

if(has_indecise == true) {
	for (uint i = 0; i < n; i++) {
 		// remove edge from relevant indices
 		_DeleteEdgeFromIndices(gc, edges + i);
 	}
 }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't want to perform 2N operations

@AviAvni
Copy link
Contributor

AviAvni commented Mar 2, 2023

we need to add summary of the changes and then update matrix size so the matrix policy will be not or only resize when applying effect

@swilly22 swilly22 force-pushed the effects branch 3 times, most recently from a21b477 to db97417 Compare March 30, 2023 06:02
@swilly22 swilly22 merged commit 728d93d into master Apr 6, 2023
@swilly22 swilly22 deleted the effects branch April 6, 2023 15:35
total execution time / number of changes: 5ms / 5 = 1ms.
if the average modification time is greater then `EFFECTS_THRESHOLD` the query
will be replicated to both replicas and AOF as a graph effect otherwise the original
query will be replicated.
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: Add:
0: always replicate the effect; -1: always replicate the original query.

Copy link
Member

Choose a reason for hiding this comment

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

Please add:
(Since RedisGraph v2.12)

AviAvni pushed a commit that referenced this pull request Apr 30, 2023
* update with master

* wait for replica

* wait after each query

* refactor test

* effect configuration

* wip

* determine when to use effects

* remove stats

* skip replica config

* adjust constraint test

* use readonly query whenever possible

* debuging

* pass array and len to update labels

* set edge endpoints

* mostly repositioning

* remove debugging prints
AviAvni added a commit that referenced this pull request Apr 30, 2023
* Effects (#2826)

* update with master

* wait for replica

* wait after each query

* refactor test

* effect configuration

* wip

* determine when to use effects

* remove stats

* skip replica config

* adjust constraint test

* use readonly query whenever possible

* debuging

* pass array and len to update labels

* set edge endpoints

* mostly repositioning

* remove debugging prints

* Update graph.query.md (#3029)

BFS: 3 arguments instead of 4

* Clear errno before strtol() (#3021)

Co-authored-by: Roi Lipman <[email protected]>

* Validate with fix (#3018)

* wip

* fix validations

* touchup

* no if branch when children are not visited

* migrate and add tests, fix RETURN validation

* doc addition

---------

Co-authored-by: Roi Lipman <[email protected]>

* Refactor execution-plan freeing mechanism (#2946)

* Refactor execution-plan freeing mechanism

Co-authored-by: razmon <[email protected]>

* use rax to store labels

* fix comments

* add comment

* addressing review comments

* addressed review comments

* fix

* leak fix

* free ops deepest first

* addressing review comments

* Update execution_plan.c

remove dict init

* Update execution_plan.c

include setjmp

* touchup

* touchup

---------

Co-authored-by: Ofir Moskovich <[email protected]>
Co-authored-by: Avi Avni <[email protected]>
Co-authored-by: Roi Lipman <[email protected]>

* Fix optimize label scan (2) (#3034)

* introduce swap candidates to Label-Scan

* doc-fix

* fix

* tests fix

* Update test_optimizations_plan.py

* Update scan_functions.h

* move context to heap

* fix leak

* for index scan as well

* addressing review comments

* touchup

* Update scan_functions.c

* Update scan_functions.c

---------

Co-authored-by: Roi Lipman <[email protected]>

* Fix LockWrite crash (#3039)

* JoinConsume(): Propagaget reset if stream depleted

* WIP: Test FOREACH

* fix foreach crash

* fix tests

* fix

---------

Co-authored-by: Avi Avni <[email protected]>

* Fix for Xenial (OpenMP 4.0/4.5) (#3017)

* Fix for Xenial (OpenMP 4.5)

* fixes 1

* fixes 2

* fixes 3

* fixes 4

* fixes 5

* fixes 6

* fixes 7

---------

Co-authored-by: Avi Avni <[email protected]>

* accumulate updates (#3005)

* accumulate updates

* fix leaks

* add test

* unify default dictType definitions

* fix

* fix 2

* add test

* wip fix

* wip fix

* fix crash

* add effect log

* early review

* fix build

* fix test

* fixes

* fix

* refactoring in progress

* refactoring continue

* write effects directly into buffer

* effects-buffer

* no need to clone value

* no need to clone string

* address review comments

* address review

* fix

* address review comment

* address reivew

* fix perf issue

* fix build

* refactoring

* fix perf

* fix build

* fix

* fix leak

* remove redundant flags

* compute change against new attribute-set

* fix perf

* address review

* fix

* fix

* adding comments

---------

Co-authored-by: razmon <[email protected]>
Co-authored-by: Raz Monsonego <[email protected]>
Co-authored-by: swilly22 <[email protected]>
Co-authored-by: Roi Lipman <[email protected]>

* Fix rewrite `DELETE` clauses (#3067)

* fix and test

* add example

---------

Co-authored-by: Avi Avni <[email protected]>

* Reattach on reset (#3070)

* formatting

* reattach iterator on reset

* disable graphblas memory pool (#3068)

* bump version 2.12.1

---------

Co-authored-by: Roi Lipman <[email protected]>
Co-authored-by: Lior Kogan <[email protected]>
Co-authored-by: nafraf <[email protected]>
Co-authored-by: Raz Monsonego <[email protected]>
Co-authored-by: Ofir Moskovich <[email protected]>
Co-authored-by: Rafi Einstein <[email protected]>
Co-authored-by: razmon <[email protected]>
Co-authored-by: swilly22 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement x:perf Performance related issue/PR ( not affecting functionality )

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants