Moving database to a new server
  • Hello everyone,

    After some time of experimenting and getting to know airtime, we have now reached the point when we are moving to a new dedicated server with more storage and better bandwidth capabilities!
    In order to do this, I have setup in the new server airtime from scratch and restored the backed up postgres database with Icecast and of course all the dependencies.
    Although all data seem to be ok, when I try to edit the stream settings (to compensate for the new domain that the new server is using) I am getting a database error:


    Unable to execute UPDATE statement [UPDATE cc_stream_setting SET
    VALUE=:p1 WHERE cc_stream_setting.KEYNAME=:p2] [wrapped:
    SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column
    "value" violates not-null constraint]
    #0 /usr/share/airtime/application/models/airtime/om/BaseCcStreamSettingPeer.php(557): BasePeer::doUpdate(Object(Criteria), Object(Criteria), Object(PropelPDO))
    #1 /usr/share/airtime/application/models/airtime/om/BaseCcStreamSetting.php(373): BaseCcStreamSettingPeer::doUpdate(Object(CcStreamSetting), Object(PropelPDO))
    #2 /usr/share/airtime/application/models/airtime/om/BaseCcStreamSetting.php(328): BaseCcStreamSetting->doSave(Object(PropelPDO))
    #3 /usr/share/airtime/application/models/StreamSetting.php(188): BaseCcStreamSetting->save()
    #4 /usr/share/airtime/application/models/StreamSetting.php(206): Application_Model_StreamSetting::saveStreamSetting('output_sound_de...', NULL)
    #5 /usr/share/airtime/application/controllers/PreferenceController.php(209): Application_Model_StreamSetting::setStreamSetting(Array)
    #6 /usr/share/php/libzend-framework-php/Zend/Controller/Action.php(516): PreferenceController->streamSettingAction()
    #7 /usr/share/php/libzend-framework-php/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('streamSettingAc...')
    #8 /usr/share/php/libzend-framework-php/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
    #9 /usr/share/php/libzend-framework-php/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
    #10 /usr/share/php/libzend-framework-php/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
    #11 /usr/share/airtime/public/index.php(64): Zend_Application->run()
    #12 {main}
    I have checked the database in the server and verified that the values have been altered correctly, yet airtime is unable to connect to icecast at this early stage!

    Any suggestions?

    Best wishes and happy new year!

  • 12 Comments sorted by
  • The answer is in this message:

    "Unable to execute UPDATE statement [UPDATE cc_stream_setting SET 
    VALUE=:p1 WHERE cc_stream_setting.KEYNAME=:p2] [wrapped: 
    SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column 
    "value" violates not-null constraint]"


    Somehow, you have gotten a null value in the "value" column of table cc_stream_setting. Did you use "pg_dump" to export the database, and "psql" to import?
    Airtime Pro Hosting: http://airtime.pro
  • This is what I did to export:
    sudo -u postgres pg_dumpall | gzip -c > airtime-new_backup.gz
    and this is what I did to import
    gunzip -c airtime-new_backup.gz | sudo -u postgres psql airtime
  • That method looks fine. 

    I'm still puzzled how you got a null value in your table. Try 

    sudo -u postgres psql -c "select * from cc_stream_setting where value = null;" airtime

    to see how many rows have this null value.
    Airtime Pro Hosting: http://airtime.pro
  • This is what I get:

    sudo -u postgres psql -c "select * from cc_stream_setting where value = null;" airtime
     keyname | value | type
    ---------+-------+------
    (0 rows)


    Though I still get the same error
  • I am still getting the same error! Maybe if I populate p2 with something the error would disappear?
  • Just out of curiousity, please try setting your Hardware Audio Output, saving, and see what happens (You can revert this change afterwards).

     
    Airtime Pro Hosting: http://airtime.pro
  • I have already done that. When I enable the Hardware Audio Output and click save airtime responds correctly without any error. However, when I disable the Output and save, I get the same error again ;-)
  • This is strange, I've never seen that happen anywhere else. What browser + version are you using?
    Airtime Pro Hosting: http://airtime.pro
  • Xubuntu 12.04 / Firefox 18.0.1 / Airtime 2.2.1
    Latest psql/php/apache in 12.04 on the server
  • Reply to @Aris+Synodinos:

    Thanks will look into this.
    Airtime Pro Hosting: http://airtime.pro
  • I have confirmed that the error happens on the old server as well, it has nothing to do with the migration process!
  • Reply to @Aris+Synodinos:

    What is the output of:

    sudo -u postgres psql -c "\d+ cc_stream_setting" airtime