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

MongoDB replicaset binary store returns corrupt data

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 5.4.0.Final
    • 5.3.0.Final
    • Storage
    • None
    • Hide

      Setup a modeshape installation that connects to a MongoDB replicaset. Import a set of zip files in modeshape through modeshape explorer. Go to the active MongoDB primary node and tell it to step down (rs.stepDown()). This will cause another node to become primary. Read the zip files through modeshape explorer and open them. If you analyze the byte code from the returned zip file you will notice that the order of bytes has swapped.

      Show
      Setup a modeshape installation that connects to a MongoDB replicaset. Import a set of zip files in modeshape through modeshape explorer. Go to the active MongoDB primary node and tell it to step down (rs.stepDown()). This will cause another node to become primary. Read the zip files through modeshape explorer and open them. If you analyze the byte code from the returned zip file you will notice that the order of bytes has swapped.

    Description

      When a MongoDB replicaset is used as binary storage than data can get corrupted when the replicaset changes the primary node. The corruption is caused in the org.modeshape.jcr.value.binary.MongodbBinaryStore file in the ChunkInputStream and ChunkOutputStream classes. The OutputStream creates small chunks from the bigger binary files. These chunks are stored and than read without any given sorting. If you don't give a sort than the order of the returned chunks is undefined. In my tests this was working for the primary node since MongoDB returned the chunks in the way they where written. However when we switched the primary node the former secondary returned the chunks in a different order and the files get corrupted.

      Attachments

        Activity

          People

            hchiorean Horia Chiorean (Inactive)
            pverboom Patrick Verboom (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: