Uploaded image for project: 'Portal'
  1. Portal
  2. PORTAL-579

Portal keyspace is not created in Cassandra under race condition

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: High High
    • Dublin Release
    • Dublin Release
    • None
    • Integration lab

      After deployed ONAP with staging images, Portal login failed due to missing portal keyspace in Cassandra. 

      The root cause is that there is some race condition in portal-cassandra docker-entrypoint.sh.  

      At the end of docker-entrypoint.sh:

      echo "################################ Let run cql's ##############################"
      for f in /docker-entrypoint-initdb.d/*; do
       
       case "$f" in
       *.cql)
       echo "$0: running $f" && until cqlsh -u cassandra -p cassandra -f "$f"; do >&2 echo "Cassandra is unavailable - sleeping"; sleep 2; done & ;;
       *) echo "$0: ignoring $f" ;;
       esac
       echo
      done

       

      and there are 3 csql files under docker-entrypoint-initdb.d/

      root@dev-portal-portal-cassandra-6447c65c44-pc49l:/# ls -l docker-entrypoint-initdb.d/
      total 12
      -rw-rw-r-- 1 cassandra cassandra 564 May 12 08:20 music_single.cql
      -rw-r--r-- 1 root root 2644 May 12 08:16 zzz_portal.cql
      -rw-r--r-- 1 root root 2653 May 12 08:16 zzz_portalsdk.cql
      

       

      The cassandra password is changed by music_single.cql and music_single.cql is tried first before other two portal cql in this case, even though all cql are run at background and wait for cassandra to be ready. Note that due to the fact that cassandra can become available anytime, there is no deterministic order of when 3 cql files can be executed. 

      Suggest to design a method so that all cql files can be successfully executed despite cassandra password is changed by some of the cql files.  

      Pod portal-cassandra console log is attached, you can find in it that some cql commands were never successfully executed because default password has changed by music_single.cql. 

            xuyang11 xuyang11
            xuyang11 xuyang11
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: