[MOD-8035] Add field index error for JSON field indexing failures#5150
[MOD-8035] Add field index error for JSON field indexing failures#5150
Conversation
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
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
| /** | ||
| * 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. |
| } | ||
|
|
||
| void FieldsGlobalStats_UpdateIndexError(FieldType field_type, int toAdd) { | ||
| FieldIndexErrorCounter[INDEXTYPE_TO_POS(field_type)] += toAdd; |
There was a problem hiding this comment.
we are doing it to allow negative toAdd
src/module-init/module-init.c
Outdated
| // 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); |
There was a problem hiding this comment.
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): |
tests/pytests/test_info_modules.py
Outdated
| 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 ""}' \ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
|
Backport failed for 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 |
) * 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)
|
Successfully created backport PR for |
) * 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)
|
Successfully created backport PR for |
) * 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)
…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]>
…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]>
…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
Introduce tracking field-level indexing error in JSON.