Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2681

When ModeShape get killed the Index-Counter is '0'

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 5.4.1.Final
    • None
    • Indexing
    • None

      We had some issues with our indices. We could find out, that the problems always appears after the ModeShape-Server was killed by someone.

      In the LocalDuplicateIndex-class you are using a counter for the key-map.
      Sadly the counter will only saved permanently, when the server steps into the shutdown-method. If the server gets killed, then the counter won't be saved and after the restart the Server will start counting at '0'.
      This leads to some issues:

      1. familiar nodes will be replaced if the counter matches (e.g. NodeType A on the counter 2 will be replaced by a diffrent NodeType A if the counter ist at 2 after restart)
      2. some other nodes will never found anymore until you are doing a reindex

      Solution:
      since it's not very harmful, you could just save permanently the counter while adding new nodes too:

       @Override
          public void add( String nodeKey,
                           String propertyName, 
                           T value ) {
              logger.trace("Adding node '{0}' to '{1}' index with value '{2}'", nodeKey, name, value);
              keysByValue.put(new UniqueKey<T>(value, counter.getAndIncrement()), nodeKey);
      // Store the value of the next counter in the options map ...
              options.put(NEXT_COUNTER, counter.get());
          }
      

      Maybe we can provide a pull request later this day

              hchiorean Horia Chiorean (Inactive)
              x-out_jira X-out portal (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: