Uploaded image for project: 'Spring Data Redis'
  1. Spring Data Redis
  2. DATAREDIS-744

Secondary indexes not removed if id contains colon

    XMLWordPrintable

    Details

      Description

      Hello,

      I've set ttl for my data using:

      @RedisHash(value = "user_content", timeToLive = 60)
      

      And enabled keyspace events by setting EnableKeyspaceEvents.ON_STARTUP.

      During tests I discovered that secondary indexes are not removed after expiration and I spent couple hours on debugging. What I found was quite shocking:

      • I inserted key "user_content:ipla:some7:vod:0123456789abcdef0123456789abcdef"
      • Phantom key was created as well
      • Key expired after TTL
      • Expiration Message was generated and received by MappingExpirationListener
      • Function isKeyExpirationMessage returned false and event was rejected

      The reason is below:

      byte[][] args = ByteUtils.split(message.getBody(), ':');
      if (args.length != 2) {
        return false;
      }

      Message body is equal to my expiring key, therefore splitting it this way returns 6 rather than 2. Is there a hidden assumption that keys must not contain ":" sign? Or am I completely wrong about it?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mp911de Mark Paluch
              Reporter:
              mbobowsk MichaƂ Bobowski
              Last updater:
              Spring Issues Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: