Skip to content

Investigate same key,value writes to Redis #65

@arturgontijo

Description

@arturgontijo

For some reason add_redis_pattern() is writing the same k,v into Redis.

To reproduce it, add this fprintf() in the function:

static void add_redis_pattern(char **composite_key, unsigned int arity, char *value) {
    char *key = expression_hash(EXPRESSION_HASH, composite_key, arity);
    REDIS_APPEND_COMMAND_MACRO(REDIS, "ZADD %s:%s %ld %s", PATTERNS, key, PATTERNS_SCORE, value);
    PATTERNS_SCORE++;
    PENDING_REDIS_COMMANDS++;

    // DEBUG
    if (strcmp("05bfd9bb16514f9f95784092431896cd", value) == 0) {
        fprintf(stdout, "k: %s:%s | v: %s\n", PATTERNS, key, value);
    }
    // --------

    free(key);
}

Current output is:

root@9fa3317adc4e:/opt/parser# ./bin/db_loader animals.metta
Connecting to Redis at redis:6379
Connecting to MongoDB at mongodb:27017
k: patterns:c40a82a067a55f1d3b427ed1232f0b40 | v: 05bfd9bb16514f9f95784092431896cd
k: patterns:97c5764ac5e47968e3013f5e27dfa4be | v: 05bfd9bb16514f9f95784092431896cd
k: patterns:e875e6de58ec4e95153a89251179d73b | v: 05bfd9bb16514f9f95784092431896cd
k: patterns:97c5764ac5e47968e3013f5e27dfa4be | v: 05bfd9bb16514f9f95784092431896cd
k: patterns:0ae0334eb6960898477c90227b0147bb | v: 05bfd9bb16514f9f95784092431896cd
k: patterns:dabd1f087cf4a9739911c0385fae0819 | v: 05bfd9bb16514f9f95784092431896cd
k: patterns:e875e6de58ec4e95153a89251179d73b | v: 05bfd9bb16514f9f95784092431896cd
k: patterns:dabd1f087cf4a9739911c0385fae0819 | v: 05bfd9bb16514f9f95784092431896cd
k: patterns:52e3953058a58fae99aae203fb666e6e | v: 05bfd9bb16514f9f95784092431896cd

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions