Skip to content

[MOD-8035] Add field index error for JSON field indexing failures#5150

Merged
meiravgri merged 11 commits intomasterfrom
meiravg_field_indexing_error_in_json
Nov 12, 2024
Merged

[MOD-8035] Add field index error for JSON field indexing failures#5150
meiravgri merged 11 commits intomasterfrom
meiravg_field_indexing_error_in_json

Conversation

@meiravgri
Copy link
Collaborator

@meiravgri meiravgri commented Nov 3, 2024

Introduce tracking field-level indexing error in JSON.

move  dialects stats to global_stats
The counter is update at runtime, once the error occured.
It reflects the total number of indexing errors in all living indices.
The counter should be decreased whenever an index is dropped.

introduce FieldSpec_AddError that adds an error to a specific field.
it also updates the global field error counter.

We expose the global counter value in INFO modules, along with each field type stats.

the name of the fields count for each type was changed from "Field_type_name" to "Total"
wait for bg index after FT.ALTER to avoid flakyness
@meiravgri meiravgri changed the title Add field index error for JSON field indexing failures [MOD-8035 ] Add field index error for JSON field indexing failures Nov 3, 2024
@meiravgri meiravgri changed the title [MOD-8035 ] Add field index error for JSON field indexing failures [MOD-8035] Add field index error for JSON field indexing failures Nov 3, 2024
@codecov
Copy link

codecov bot commented Nov 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.55%. Comparing base (5884687) to head (35a1caa).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5150   +/-   ##
=======================================
  Coverage   86.55%   86.55%           
=======================================
  Files         193      193           
  Lines       34756    34757    +1     
=======================================
+ Hits        30083    30084    +1     
  Misses       4673     4673           

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

Base automatically changed from meiravg_mod7955_expose_index_errors to master November 4, 2024 17:09
/**
* Exposing all the fields that > 0 to INFO command.
* Add or increase `toAdd` number of errors to the global index errors counter of field_type.
* `toAdd` can be negative to decrease the counter.

Choose a reason for hiding this comment

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

in which case?

}

void FieldsGlobalStats_UpdateIndexError(FieldType field_type, int toAdd) {
FieldIndexErrorCounter[INDEXTYPE_TO_POS(field_type)] += toAdd;

Choose a reason for hiding this comment

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

adding int to size_t

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we are doing it to allow negative toAdd

// indexing errors
RedisModule_InfoAddFieldDouble(ctx, "errors_indexing_failures", indexing_errors.indexing_failures);
// highest number of failures out of all specs
RedisModule_InfoAddFieldDouble(ctx, "errors_indexing_failures_max", indexing_errors.max_indexing_failures);

Choose a reason for hiding this comment

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

what is the real world purpose for this field? also consider rename to max_indexing_errors or something similar


env.assertEqual(error_dict, expected_error_dict)

def test_multiple_index_failures_json(env):

Choose a reason for hiding this comment

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

skip(no_json=True)

return f'Tag={count}' \
f'{",Sortable=" + str(sortable_count) if sortable_count else ""}' \
f'{",NoIndex=" + str(no_index_count) if no_index_count else ""}' \
f'{",CaseSensitive=" + str(case_sensitive_count) if case_sensitive_count else ""}' \

Choose a reason for hiding this comment

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

I know it is not a part of this PR but do we have a tests that checks what happens when the values are 0?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes
fields options like sortable etc, are only printed when set (you can see here that the string is empty)
IndexErrors is always printed and is 0 zero in some of the tests

@meiravgri meiravgri requested a review from DvirDukhan November 12, 2024 12:35
@meiravgri meiravgri added this pull request to the merge queue Nov 12, 2024
Merged via the queue into master with commit f045e21 Nov 12, 2024
@meiravgri meiravgri deleted the meiravg_field_indexing_error_in_json branch November 12, 2024 15:38
@redisearch-backport-pull-request
Copy link
Contributor

Backport failed for 2.8, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 2.8
git worktree add -d .worktree/backport-5150-to-2.8 origin/2.8
cd .worktree/backport-5150-to-2.8
git switch --create backport-5150-to-2.8
git cherry-pick -x f045e21b8356fe2e4e7e2c4f06d3bed1b5c645b2

redisearch-backport-pull-request bot pushed a commit that referenced this pull request Nov 12, 2024
)

* move fieldsStats from RSGlobalConfig to RSGlobalStats

move  dialects stats to global_stats

* Introduce a global counter for indexing failures for each field type.
The counter is update at runtime, once the error occured.
It reflects the total number of indexing errors in all living indices.
The counter should be decreased whenever an index is dropped.

introduce FieldSpec_AddError that adds an error to a specific field.
it also updates the global field error counter.

We expose the global counter value in INFO modules, along with each field type stats.

the name of the fields count for each type was changed from "Field_type_name" to "Total"

* fix test

* skip test_redis_info_errors in cluster

wait for bg index after FT.ALTER to avoid flakyness

* revert change in INFO MODULES field count name

* fix test format

* add field indesing failure when encountered in json

* skip json tests of not json

(cherry picked from commit f045e21)
@redisearch-backport-pull-request
Copy link
Contributor

Successfully created backport PR for 2.10:

redisearch-backport-pull-request bot pushed a commit that referenced this pull request Nov 12, 2024
)

* move fieldsStats from RSGlobalConfig to RSGlobalStats

move  dialects stats to global_stats

* Introduce a global counter for indexing failures for each field type.
The counter is update at runtime, once the error occured.
It reflects the total number of indexing errors in all living indices.
The counter should be decreased whenever an index is dropped.

introduce FieldSpec_AddError that adds an error to a specific field.
it also updates the global field error counter.

We expose the global counter value in INFO modules, along with each field type stats.

the name of the fields count for each type was changed from "Field_type_name" to "Total"

* fix test

* skip test_redis_info_errors in cluster

wait for bg index after FT.ALTER to avoid flakyness

* revert change in INFO MODULES field count name

* fix test format

* add field indesing failure when encountered in json

* skip json tests of not json

(cherry picked from commit f045e21)
@redisearch-backport-pull-request
Copy link
Contributor

Successfully created backport PR for 8.0:

meiravgri added a commit that referenced this pull request Nov 12, 2024
)

* move fieldsStats from RSGlobalConfig to RSGlobalStats

move  dialects stats to global_stats

* Introduce a global counter for indexing failures for each field type.
The counter is update at runtime, once the error occured.
It reflects the total number of indexing errors in all living indices.
The counter should be decreased whenever an index is dropped.

introduce FieldSpec_AddError that adds an error to a specific field.
it also updates the global field error counter.

We expose the global counter value in INFO modules, along with each field type stats.

the name of the fields count for each type was changed from "Field_type_name" to "Total"

* fix test

* skip test_redis_info_errors in cluster

wait for bg index after FT.ALTER to avoid flakyness

* revert change in INFO MODULES field count name

* fix test format

* add field indesing failure when encountered in json

* skip json tests of not json

(cherry picked from commit f045e21)
github-merge-queue bot pushed a commit that referenced this pull request Nov 13, 2024
…es (#5203)

[MOD-8035] Add field index error for JSON field indexing failures (#5150)

* move fieldsStats from RSGlobalConfig to RSGlobalStats

move  dialects stats to global_stats

* Introduce a global counter for indexing failures for each field type.
The counter is update at runtime, once the error occured.
It reflects the total number of indexing errors in all living indices.
The counter should be decreased whenever an index is dropped.

introduce FieldSpec_AddError that adds an error to a specific field.
it also updates the global field error counter.

We expose the global counter value in INFO modules, along with each field type stats.

the name of the fields count for each type was changed from "Field_type_name" to "Total"

* fix test

* skip test_redis_info_errors in cluster

wait for bg index after FT.ALTER to avoid flakyness

* revert change in INFO MODULES field count name

* fix test format

* add field indesing failure when encountered in json

* skip json tests of not json

(cherry picked from commit f045e21)

Co-authored-by: meiravgri <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Nov 13, 2024
…res (#5202)

* [MOD-8035] Add field index error for JSON field indexing failures (#5150)

* move fieldsStats from RSGlobalConfig to RSGlobalStats

move  dialects stats to global_stats

* Introduce a global counter for indexing failures for each field type.
The counter is update at runtime, once the error occured.
It reflects the total number of indexing errors in all living indices.
The counter should be decreased whenever an index is dropped.

introduce FieldSpec_AddError that adds an error to a specific field.
it also updates the global field error counter.

We expose the global counter value in INFO modules, along with each field type stats.

the name of the fields count for each type was changed from "Field_type_name" to "Total"

* fix test

* skip test_redis_info_errors in cluster

wait for bg index after FT.ALTER to avoid flakyness

* revert change in INFO MODULES field count name

* fix test format

* add field indesing failure when encountered in json

* skip json tests of not json

(cherry picked from commit f045e21)

* add inmport common.skip to test_index_error

* remove skip json (not respected and causes the entire test to be skipped)

---------

Co-authored-by: meiravgri <[email protected]>
Co-authored-by: meiravgri <[email protected]>
DvirDukhan pushed a commit that referenced this pull request Nov 13, 2024
…es (#5205)

* [MOD-8035] Add field index error for JSON field indexing failures (#5150)

* move fieldsStats from RSGlobalConfig to RSGlobalStats

move  dialects stats to global_stats

* Introduce a global counter for indexing failures for each field type.
The counter is update at runtime, once the error occured.
It reflects the total number of indexing errors in all living indices.
The counter should be decreased whenever an index is dropped.

introduce FieldSpec_AddError that adds an error to a specific field.
it also updates the global field error counter.

We expose the global counter value in INFO modules, along with each field type stats.

the name of the fields count for each type was changed from "Field_type_name" to "Total"

* fix test

* skip test_redis_info_errors in cluster

wait for bg index after FT.ALTER to avoid flakyness

* revert change in INFO MODULES field count name

* fix test format

* add field indesing failure when encountered in json

* skip json tests of not json

(cherry picked from commit f045e21)

* fix backporting (using IndexError_AddError instead of FieldSpec_AddError that was not backported)

* remove skip json

* convert num_docs to int
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants