AppController/djinn.rb
# Creates database tables in the underlying datastore to hold information
# about the users that interact with AppScale clouds, and about the
# applications that AppScale hosts (including data that the apps themselves
# read and write).
#
# Raises:
#   SystemExit: If the database could not be primed for use with AppScale,
#     after ten retries.
Creates database tables in the underlying datastore to hold information
about the users that interact with AppScale clouds, and about the
applications that AppScale hosts (including data that the apps themselves
read and write).

If the database could not be primed for use with AppScale,
after ten retries.
Creates database tables in the underlying datastore to hold information about the users that interact with AppScale clouds and about the applications that AppScale hosts ( including data that the apps themselves read and write ) . If the database could not be primed for use with AppScale after ten retries .
def prime_database()
    table = @options['table']
    prime_script = "#{APPSCALE_HOME}/AppDB/#{table}_env/prime_#{table}.py"
    replication = Integer(@options['replication'])
    retries = 10
    Djinn.log_info('Ensuring necessary tables have been created')
    loop {
      prime_cmd = "#{prime_script} --replication #{replication} >> " +
        '/var/log/appscale/prime_db.log 2>&1'
      return if system(prime_cmd)
      retries -= 1
      Djinn.log_warn("Failed to prime database. #{retries} retries left.")
      if retries == 1
        @state = 'Running a Cassandra repair.'
        Djinn.log_warn(@state)
        system("#{NODETOOL} repair")
      end
      break if retries.zero?
      Kernel.sleep(SMALL_WAIT)
    }
    @state = "Failed to prime #{table}."
    HelperFunctions.log_and_crash(@state, WAIT_TO_CRASH)
  end
def prime_database ( ) table = @options [ 'table' ] prime_script = "#{APPSCALE_HOME}/AppDB/#{table}_env/prime_#{table}.py" replication = Integer ( @options [ 'replication' ] ) retries = 10 Djinn . log_info ( 'Ensuring necessary tables have been created' ) loop { prime_cmd = "#{prime_script} --replication #{replication} >> " + '/var/log/appscale/prime_db.log 2>&1' return if system ( prime_cmd ) retries -= 1 Djinn . log_warn ( "Failed to prime database. #{retries} retries left." ) if retries == 1 @state = 'Running a Cassandra repair.' Djinn . log_warn ( @state ) system ( "#{NODETOOL} repair" ) end break if retries . zero? Kernel . sleep ( SMALL_WAIT ) } @state = "Failed to prime #{table}." HelperFunctions . log_and_crash ( @state , WAIT_TO_CRASH ) end
Creates database tables in the underlying datastore to hold information
about the users that interact with AppScale clouds, and about the
applications that AppScale hosts (including data that the apps themselves
read and write).
Creates database tables in the underlying datastore to hold information about the users that interact with AppScale clouds and about the applications that AppScale hosts ( including data that the apps themselves read and write ) .
# If this has failed 10 times in a row, it's probably a # "Column ID mismatch" error that seems to be caused by creating tables # as the cluster is settling. Running a repair may fix the issue.