Jackrabbit Content Repository
  1. Jackrabbit Content Repository
  2. JCR-1558

Namespace not registered yet prevent BundleDbPersistenceManager to detect already existing root node and leads to workspace initialization failure in a cluster environment

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: core 1.4.3
    • Fix Version/s: None
    • Component/s: clustering, jackrabbit-core
    • Labels:
      None
    • Environment:
      Jackrabbit 1.4.2 / Jackrabbit core 1.4.3
      MySqlPersistenceManager in clustering with two nodes and MySQL 5.0.45-Debian_1ubuntu3.3-log / InnoDB tables

      Description

      I have two nodes in my cluster.

      When the first node starts for the first time, it creates the root node and
      register a custom namespace (rev 1) and custom node types (rev 2).
      Then it adds a child using the namespace declared before.
      Everything works fine as long as i have only one node.

      But when the second node starts for the first time, it try first to check if a root node already exists (SharedItemStateManager constructor) :
      // create root node state if it doesn't yet exist
      if (!hasNonVirtualItemState(rootNodeId))

      { createRootNodeState(rootNodeId, ntReg); }

      But, the call to hasNonVirtualItemState(rootNodeId) will log an non fatal error but return false:
      ERROR [BundleDbPersistenceManager] failed to read bundle: cafebabe-cafe-babe-cafe-babecafebabe: java.lang.IllegalStateException: URIIndex not valid? javax.jcr.NamespaceException: URI for index 11 not registered.

      The reason is because MySqlPersistenceManager#loadBundle(NodeId id, boolean checkBeforeLoading) will retrieve
      the root node and its first level children:
      BundleBinding#readBundle(DataInputStream in, NodeId id)
      ...
      bundle.addChildNodeEntry(readQName(in), childId) // will fails the second time

      Indeed this child name uses the custom namespace (index 11) not registered
      because the ClusterNode which consumes journal records is not yet started.

      And so on it will create the root node and will fail because the root node already exists:
      ERROR [BundleDbPersistenceManager] failed to write bundle: deadbeef-cafe-babe-cafe-babecafebabe
      com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry 'Þ­¾ïÊþº¾Êþº¾Êþº¾' for key 1
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1011)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
      at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
      at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:995)
      at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmtInternal(ConnectionRecoveryManager.java:365)
      at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmtInternal(ConnectionRecoveryManager.java:292)
      at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:257)
      at org.apache.jackrabbit.core.persistence.bundle.util.ConnectionRecoveryManager.executeStmt(ConnectionRecoveryManager.java:237)
      at org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager.storeBundle(BundleDbPersistenceManager.java:1270)
      at org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.putBundle(AbstractBundlePersistenceManager.java:703)
      at org.apache.jackrabbit.core.persistence.bundle.AbstractBundlePersistenceManager.store(AbstractBundlePersistenceManager.java:643)
      at org.apache.jackrabbit.core.persistence.bundle.BundleDbPersistenceManager.store(BundleDbPersistenceManager.java:529)
      at org.apache.jackrabbit.core.state.SharedItemStateManager.createRootNodeState(SharedItemStateManager.java:1084)
      at org.apache.jackrabbit.core.state.SharedItemStateManager.<init>(SharedItemStateManager.java:194)
      at org.apache.jackrabbit.core.RepositoryImpl.createItemStateManager(RepositoryImpl.java:1201)
      at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doInitialize(RepositoryImpl.java:1753)
      at org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.initialize(RepositoryImpl.java:1724)
      at org.apache.jackrabbit.core.RepositoryImpl.initWorkspace(RepositoryImpl.java:576)
      at org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(RepositoryImpl.java:415)
      at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:305)
      at org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:557)
      at org.apache.jackrabbit.core.TransientRepository$2.getRepository(TransientRepository.java:245)
      at org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:265)
      at org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:333)
      at org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:363)

        Activity

        Jukka Zitting made changes -
        Field Original Value New Value
        Workflow jira [ 12429959 ] no-reopen-closed, patch-avail [ 12467844 ]
        Sébastien Launay created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Sébastien Launay
          • Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:

              Development