1 Reply Latest reply on Nov 16, 2005 2:50 PM by john_anderson_ii

    CMP + MySQL + LONGBLOB

    john_anderson_ii

      Hello all. I've come across some interesting behavior when using CMP with MySQL and I'm trying to figure out if it's expected or not.

      I wanted to persist serveral linux kernels and initrd images in a database table. It seems weird, but that's what I did. Basically, I have a few tables that look like this.

      Table OS:
      --------------------------------------------------------------------------------
      OS_ID | VERSION | NAME | C_TIME | K_BIN | I_BIN
      --------------------------------------------------------------------------------
      
      Table kernel:
      --------------------------------------------------------------------------------
      KERNEL_ID | OS_ID | BNRY
      --------------------------------------------------------------------------------
      
      Table initrd
      --------------------------------------------------------------------------------
      INITRD_ID | OS_ID | BNRY
      --------------------------------------------------------------------------------
      
      


      The kernels are linked with a CMR One-to-One bidirectional keyed on K_BIN = KERNEL_ID and the initrd's are the same, keyed on I_BIN = INITRD_ID. The BNRY fields of the kernel and intird table hold the actual binary data of the kernel or initrd.

      I did this because we seldom actually select or update the kernel/initrd binary data. Most often the regular text/number data in the OS table is selected or updated.

      The intird images can be quite large, which is why I opted to put them in a seperate table, so they wouldn't be selected/updated each time the row in OS is selected or updated. That doesn't seem to the case though. When I use code like OsLocal os = osHome.findByPrimaryKey(new Integer(0));, then I look at the mysql processlist I see that the initrd and kernel are being selected as well. What's really wierd is after the select I also see that they updated! Overwritten by the same exact data!

      Is this normal CMP behavior or is a confiuration/code issue?

      Thanks!