Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected IllegalArgumentException --schema-name 'TEST1' argument does not match tenant schema: 'TEST1 ' #2352

Closed
prb112 opened this issue May 12, 2021 · 2 comments
Assignees
Labels
bug Something isn't working persistence

Comments

@prb112
Copy link
Contributor

prb112 commented May 12, 2021

Describe the bug
A clear and concise description of what the bug is.

Environment
Which version of IBM FHIR Server?
off of the main branch 4.8.0-SNAPSHOT

To Reproduce
Steps to reproduce the behavior:

  1. Create a Db2 instance
mkdir -p db
docker run -itd --name mydb2_1631 --rm --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=change-password -e DBNAME=fhirdb -v $(pwd)/db:/database ibmcom/db2:11.5.4.0
  1. Configure the Db2 instance.
docker exec -it mydb2_1631 /bin/bash
su - db2inst1
/opt/ibm/db2/V11.5/bin/db2 CREATE DB FHIRDB using codeset UTF-8 territory us PAGESIZE 32768

Optionally, you may need to drop the db /opt/ibm/db2/V11.5/bin/db2 drop db fhirdb.

  1. Build Main mvn clean install -f fhir-parent -DskipTests

  2. Create Schemas

java -jar ~/.m2/repository/com/ibm/fhir/fhir-persistence-schema/4.8.0-SNAPSHOT/fhir-persistence-schema-4.8.0-SNAPSHOT-cli.jar \
    --prop db.host=localhost --prop db.port=50000 --prop db.database=fhirdb --prop user=db2inst1 --prop password=change-password \
    --db-type db2 --schema-name 'TEST1' --create-schemas
  1. Update Schema
java -jar ~/.m2/repository/com/ibm/fhir/fhir-persistence-schema/4.8.0-SNAPSHOT/fhir-persistence-schema-4.8.0-SNAPSHOT-cli.jar \
    --prop db.host=localhost --prop db.port=50000 --prop db.database=fhirdb --prop user=db2inst1 --prop password=change-password \
    --db-type db2 --schema-name 'TEST1' --update-schema
  1. Allocate Tenant1 with TEST1
java -jar ~/.m2/repository/com/ibm/fhir/fhir-persistence-schema/4.8.0-SNAPSHOT/fhir-persistence-schema-4.8.0-SNAPSHOT-cli.jar \
    --prop db.host=localhost --prop db.port=50000 --prop db.database=fhirdb --prop user=db2inst1 --prop password=change-password \
    --db-type db2 --schema-name 'TEST1' --allocate-tenant test1c
  1. Allocate Tenant2 with TEST1
java -jar ~/.m2/repository/com/ibm/fhir/fhir-persistence-schema/4.8.0-SNAPSHOT/fhir-persistence-schema-4.8.0-SNAPSHOT-cli.jar \
    --prop db.host=localhost --prop db.port=50000 --prop db.database=fhirdb --prop user=db2inst1 --prop password=change-password \
    --db-type db2 --schema-name 'TEST1' --allocate-tenant test1d
  1. Drop the second tenant test1d
java -jar ~/.m2/repository/com/ibm/fhir/fhir-persistence-schema/4.8.0-SNAPSHOT/fhir-persistence-schema-4.8.0-SNAPSHOT-cli.jar \
    --prop db.host=localhost --prop db.port=50000 --prop db.database=fhirdb --prop user=db2inst1 --prop password=change-password \
    --db-type db2 --schema-name 'TEST1' --drop-tenant test1d

Results in

2021-05-12 11:30:33.965 00000001  SEVERE   com.ibm.fhir.schema.app.Main bad argument
--schema-name 'TEST1' argument does not match tenant schema: 'TEST1   '
java.lang.IllegalArgumentException: --schema-name 'TEST1' argument does not match tenant schema: 'TEST1   '
        at com.ibm.fhir.schema.app.Main.getTenantInfo(Main.java:1011)
        at com.ibm.fhir.schema.app.Main.freezeTenant(Main.java:1030)
        at com.ibm.fhir.schema.app.Main.dropTenant(Main.java:1094)
        at com.ibm.fhir.schema.app.Main.process(Main.java:1803)
        at com.ibm.fhir.schema.app.Main.main(Main.java:1860)

Expected behavior
The value should be usable to get the tenant, howeve rit comes back padded with extra spaces.

Additional context
Confirming #1631 on db2

@prb112 prb112 added bug Something isn't working persistence labels May 12, 2021
@prb112
Copy link
Contributor Author

prb112 commented May 12, 2021

One additional note, I did start with a lower case test1 that was unquoted.

@tbieste tbieste self-assigned this May 12, 2021
@tbieste tbieste added this to the Sprint 2021-06 milestone May 12, 2021
tbieste added a commit that referenced this issue May 12, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue May 12, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue May 12, 2021
Issue #2352 - Fix list/drop tenants when schema name less than 8 chars
@prb112 prb112 closed this as completed May 13, 2021
@prb112
Copy link
Contributor Author

prb112 commented May 13, 2021

Confirmed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working persistence
Projects
None yet
Development

No branches or pull requests

2 participants