args.zookeeper) datastore_upgrade.wait_for_quorum(args.keyname, args.db_master, len(args.database), args.replication) db_access = DatastoreProxy(hosts=args.database) # Exit early if a data layout upgrade is not needed. if db_access.valid_data_version(): status = { 'status': 'complete', 'message': 'The data layout is valid' } sys.exit() zookeeper = datastore_upgrade.get_zookeeper(args.zookeeper) try: total_entities = datastore_upgrade.estimate_total_entities( db_access.session, args.db_master, args.keyname) except AppScaleDBError: total_entities = None run_datastore_upgrade(db_access, zookeeper, args.log_postfix, total_entities) status = { 'status': 'complete', 'message': 'Data layout upgrade complete' } except Exception as error: logging.exception('Failed to upgrade AppScale') status = {'status': 'error', 'message': error.message} sys.exit() finally: # Always write the result of the upgrade and clean up. write_to_json_file(status, args.log_postfix)
for ip in relevant_ips: utils.ssh(ip, args.keyname, "service monit start") start_cassandra(args.database, args.db_master, args.keyname) start_zookeeper(args.zookeeper, args.keyname) datastore_upgrade.wait_for_quorum(args.keyname, len(args.database), args.replication) db_access = datastore_upgrade.get_datastore() # Exit early if a data layout upgrade is not needed. if db_access.valid_data_version(): status = {"status": "complete", "message": "The data layout is valid"} sys.exit() zookeeper = datastore_upgrade.get_zookeeper(args.zookeeper) try: total_entities = datastore_upgrade.estimate_total_entities(db_access.session, args.db_master, args.keyname) except AppScaleDBError: total_entities = None run_datastore_upgrade(db_access, zookeeper, args.log_postfix, total_entities) status = {"status": "complete", "message": "Data layout upgrade complete"} except Exception as error: status = {"status": "error", "message": error.message} sys.exit() finally: # Always write the result of the upgrade and clean up. write_to_json_file(status, args.log_postfix) if zookeeper is not None: zookeeper.close() if db_access is not None: db_access.close()