From 419f3d63237c63fe70f45823c781f4cc2da5521f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 10:41:01 +0000 Subject: [PATCH 1/4] Update actions/deploy-pages digest to decdde0 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a56f5343e..3adf6c139 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1527,4 +1527,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@87c3283f01cd6fe19a0ab93a23b2f6fcba5a8e42 # v4 + uses: actions/deploy-pages@decdde0ac072f6dcbe43649d82d9c635fff5b4e4 # v4 From 7bfe429300b4826e3bb9077c4cfd151d444d0765 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 08:41:23 +0000 Subject: [PATCH 2/4] Update actions/upload-artifact digest to 5d5d22a --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3adf6c139..7588c2601 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -190,7 +190,7 @@ jobs: run: make uberjar - name: Upload Blaze Uberjar - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 with: name: blaze-uberjar path: target/blaze-*-standalone.jar @@ -206,7 +206,7 @@ jobs: outputs: type=docker,dest=/tmp/blaze.tar - name: Upload Blaze Image - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 with: name: blaze-image path: /tmp/blaze.tar From 85d2719bd98f83b05fa1ac4b7949df3c2de1ce59 Mon Sep 17 00:00:00 2001 From: Alexander Kiel Date: Wed, 7 Feb 2024 09:52:51 +0100 Subject: [PATCH 3/4] Fix Error While Reading Non-Existent Resource Closes: #1475 --- .../blaze/db/impl/index/resource_as_of.clj | 37 +++++++++------- modules/db/test/blaze/db/api_test.clj | 43 +++++++++++++++---- modules/kv/src/blaze/db/kv.clj | 4 +- 3 files changed, 58 insertions(+), 26 deletions(-) diff --git a/modules/db/src/blaze/db/impl/index/resource_as_of.clj b/modules/db/src/blaze/db/impl/index/resource_as_of.clj index cce49c52c..b28f36e95 100644 --- a/modules/db/src/blaze/db/impl/index/resource_as_of.clj +++ b/modules/db/src/blaze/db/impl/index/resource_as_of.clj @@ -315,24 +315,29 @@ (bb/flip! target-buf) (kv/seek-buffer! iter target-buf) (when (kv/valid? iter) + ;; it's important to clear key-buf before reading, because otherwise + ;; the limit could be to small + (bb/clear! key-buf) (kv/key! iter key-buf) ;; we have to check that we are still on target, because otherwise we - ;; would find the next resource - ;; focus target buffer on tid and id - (bb/rewind! target-buf) - (bb/set-limit! target-buf tid-id-size) - ;; focus key buffer on tid and id - (bb/set-limit! key-buf tid-id-size) - (when (= target-buf key-buf) - ;; focus key buffer on t - (bb/set-limit! key-buf key-size) - (let [value-buf (bb/allocate value-size)] - (kv/value! iter value-buf) - (rh/resource-handle! - tid - (codec/id-string id) - (codec/descending-long (bb/get-long! key-buf tid-id-size)) - value-buf)))))) + ;; would find the next resource. First the length of the found key has + ;; to equal our key size + (when (= key-size (bb/limit key-buf)) + ;; focus target buffer on tid and id + (bb/rewind! target-buf) + (bb/set-limit! target-buf tid-id-size) + ;; focus key buffer on tid and id + (bb/set-limit! key-buf tid-id-size) + (when (= target-buf key-buf) + ;; focus key buffer on t + (bb/set-limit! key-buf key-size) + (let [value-buf (bb/allocate value-size)] + (kv/value! iter value-buf) + (rh/resource-handle! + tid + (codec/id-string id) + (codec/descending-long (bb/get-long! key-buf tid-id-size)) + value-buf))))))) (defn resource-handle "Returns the resource handle with `tid` and `id` at `t` in `snapshot` when diff --git a/modules/db/test/blaze/db/api_test.clj b/modules/db/test/blaze/db/api_test.clj index b96bd4a83..fde199fb7 100644 --- a/modules/db/test/blaze/db/api_test.clj +++ b/modules/db/test/blaze/db/api_test.clj @@ -28,6 +28,7 @@ [blaze.log] [blaze.module.test-util :refer [with-system]] [blaze.test-util :as tu :refer [satisfies-prop]] + [clojure.spec.alpha :as s] [clojure.spec.test.alpha :as st] [clojure.test :as test :refer [are deftest is testing]] [clojure.test.check.generators :as gen] @@ -550,12 +551,12 @@ [:subject :reference] := "Patient/0" [meta :blaze.db/op] := :create))))) - (testing "creating 100 transactions in parallel" + (testing "creating 1000 transactions in parallel" (with-system [{:blaze.db/keys [node]} slow-resource-store-system] (let [db-futures (mapv #(d/transact node [[:create {:fhir/type :fhir/Patient :id (str %)}]]) - (range 100))] + (range 1000))] (testing "wait for all transactions finishing" @(ac/all-of db-futures)) @@ -568,7 +569,7 @@ true? (map #(= % (d/type-total (d/as-of db %) "Patient")) - (range 100)))))))))) + (range 1000)))))))))) (testing "with failing resource storage" (testing "on put" @@ -631,6 +632,12 @@ (is (d/resource-handle? (d/resource-handle (d/db node) "Patient" "0"))))) + (testing "doesn't find a resource handle mit prefix of it's id" + (with-system-data [{:blaze.db/keys [node]} config] + [[[:create {:fhir/type :fhir/Patient :id "00"}]]] + + (is (nil? (d/resource-handle (d/db node) "Patient" "0"))))) + (testing "a node contains a resource after a create transaction" (with-system-data [{:blaze.db/keys [node]} config] [[[:create {:fhir/type :fhir/Patient :id "0"}]]] @@ -943,9 +950,21 @@ count := 1 [0 :fhir/type] := :fhir/Patient [0 :id] := "0") - (is (= 1 (count-type-query node "Patient" [["active" "true"]])))))) + (is (= 1 (count-type-query node "Patient" [["active" "true"]]))))) + + (testing "works with variable length ids" + (with-system-data [{:blaze.db/keys [node]} config] + [[[:put {:fhir/type :fhir/Patient :id "1" :active true}] + [:put {:fhir/type :fhir/Patient :id "10" :active true}]]] - (testing "search by id" + (given (pull-type-query node "Patient" [["active" "true"]]) + count := 2 + [0 :fhir/type] := :fhir/Patient + [0 :id] := "1" + [1 :fhir/type] := :fhir/Patient + [1 :id] := "10")))) + + (testing "search by _id" (with-system-data [{:blaze.db/keys [node]} config] [[[:put {:fhir/type :fhir/Patient :id "0" :active true}] [:put {:fhir/type :fhir/Patient :id "1" :active false}] @@ -999,8 +1018,8 @@ (testing "sorting by _id" (with-system-data [{:blaze.db/keys [node]} config] - [[[:put {:fhir/type :fhir/Patient :id "0" :active true}] - [:put {:fhir/type :fhir/Patient :id "1" :active false}]]] + [[[:put {:fhir/type :fhir/Patient :id "0"}] + [:put {:fhir/type :fhir/Patient :id "1"}]]] (testing "ascending" (given (pull-type-query node "Patient" [[:sort "_id" :asc]]) @@ -1019,7 +1038,15 @@ (testing "descending" (given (d/type-query (d/db node) "Patient" [[:sort "_id" :desc]]) ::anom/category := ::anom/unsupported - ::anom/message := "Unsupported sort direction `desc` for search param `_id`.")))) + ::anom/message := "Unsupported sort direction `desc` for search param `_id`."))) + + (testing "random id's" + (satisfies-prop 100 + (prop/for-all [ids (gen/set (s/gen :blaze.resource/id) {:min-elements 1})] + (with-system-data [{:blaze.db/keys [node]} config] + [(mapv #(vector :create {:fhir/type :fhir/Patient :id %}) ids)] + + (= (sort ids) (mapv :id (pull-type-query node "Patient" [[:sort "_id" :asc]])))))))) (testing "a node with two patients in two transactions" (with-system-data [{:blaze.db/keys [node]} config] diff --git a/modules/kv/src/blaze/db/kv.clj b/modules/kv/src/blaze/db/kv.clj index 809c0c91e..0bc62da4d 100644 --- a/modules/kv/src/blaze/db/kv.clj +++ b/modules/kv/src/blaze/db/kv.clj @@ -92,8 +92,8 @@ (defn key! "Puts the key of current entry of `iter` in `buf`. - Uses the position of `buf` and sets the limit of `buf` according to the key - size. + Uses the position and limit of `buf` and sets the limit of `buf` according to + the key size. Note: doesn't read bytes over the limit! Returns the size of the actual key. If the key is greater than the length of `buf`, then it indicates that the size of the `buf` is insufficient and a From 9964956829b1987c7952eaa3db878700a004be0f Mon Sep 17 00:00:00 2001 From: Alexander Kiel Date: Wed, 7 Feb 2024 14:15:36 +0100 Subject: [PATCH 4/4] Release v0.24.1 --- CHANGELOG.md | 12 ++++++++++++ Dockerfile | 4 ++-- README.md | 4 ++-- build.clj | 2 +- docs/.vitepress/config.ts | 2 +- docs/deployment/docker-deployment.md | 4 ++-- docs/deployment/manual-deployment.md | 12 ++++++------ modules/frontend/package-lock.json | 4 ++-- modules/frontend/package.json | 2 +- src/blaze/system.clj | 4 ++-- 10 files changed, 31 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4bca7c1b..8de435057 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## v0.24.1 + +### Notes + +Please update from v0.24.0 if you use variable length logical id's. + +### Bugfixes + +* Fix Error While Reading Non-Existent Resource ([#1475](https://github.com/samply/blaze/issues/1475)) + +The full changelog can be found [here](https://github.com/samply/blaze/milestone/84?closed=1). + ## v0.24.0 ### Notes diff --git a/Dockerfile b/Dockerfile index 012aeb752..550da215f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN apt-get update && apt-get upgrade -y && \ rm -rf /var/lib/apt/lists/ RUN mkdir -p /app/data && chown 1001:1001 /app/data -COPY target/blaze-0.24.0-standalone.jar /app/ +COPY target/blaze-0.24.1-standalone.jar /app/ WORKDIR /app USER 1001 @@ -19,4 +19,4 @@ ENV INDEX_DB_DIR="/app/data/index" ENV TRANSACTION_DB_DIR="/app/data/transaction" ENV RESOURCE_DB_DIR="/app/data/resource" -CMD ["java", "-jar", "blaze-0.24.0-standalone.jar"] +CMD ["java", "-jar", "blaze-0.24.1-standalone.jar"] diff --git a/README.md b/README.md index 2ce65654d..a540871c6 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The goal of this project is to provide a FHIR® Store with an internal CQL Evalu Blaze passes all [Touchstone FHIR 4.0.1 Basic Tests][12] and almost all [CQL Tests][3]. Please refer to the [Conformance](docs/conformance.md) section and report any issues you encounter during evaluation. -Latest release: [v0.24.0][5] +Latest release: [v0.24.1][5] ## Quick Start @@ -74,7 +74,7 @@ Unless required by applicable law or agreed to in writing, software distributed [3]: [4]: -[5]: +[5]: [6]: [7]: [8]: diff --git a/build.clj b/build.clj index 3bbaf26f6..05190d7d9 100644 --- a/build.clj +++ b/build.clj @@ -2,7 +2,7 @@ (:require [clojure.tools.build.api :as b])) (def lib 'samply/blaze) -(def version "0.24.0") +(def version "0.24.1") (def class-dir "target/classes") (def basis (b/create-basis {:project "deps.edn"})) (def uber-file (format "target/%s-%s-standalone.jar" (name lib) version)) diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 94bca993a..6a2e09cc9 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -27,7 +27,7 @@ export default defineConfig({ nav: [ {text: 'Home', link: '/'}, { - text: "v0.24.0", + text: "v0.24.1", items: [ { text: 'Changelog', diff --git a/docs/deployment/docker-deployment.md b/docs/deployment/docker-deployment.md index 3caa76223..dff01229b 100644 --- a/docs/deployment/docker-deployment.md +++ b/docs/deployment/docker-deployment.md @@ -27,7 +27,7 @@ Blaze should log something like this: 2023-06-09T08:30:30.126Z b45689460ff3 main INFO [blaze.core:67] - JVM version: 17.0.7 2023-06-09T08:30:30.126Z b45689460ff3 main INFO [blaze.core:68] - Maximum available memory: 1738 MiB 2023-06-09T08:30:30.126Z b45689460ff3 main INFO [blaze.core:69] - Number of available processors: 2 -2023-06-09T08:30:30.126Z b45689460ff3 main INFO [blaze.core:70] - Successfully started 🔥 Blaze version 0.24.0 in 9.0 seconds +2023-06-09T08:30:30.126Z b45689460ff3 main INFO [blaze.core:70] - Successfully started 🔥 Blaze version 0.24.1 in 9.0 seconds ``` In order to test connectivity, query the health endpoint: @@ -47,7 +47,7 @@ that should return: ```json { "name": "Blaze", - "version": "0.24.0" + "version": "0.24.1" } ``` diff --git a/docs/deployment/manual-deployment.md b/docs/deployment/manual-deployment.md index 6150f6927..f2a7d3038 100644 --- a/docs/deployment/manual-deployment.md +++ b/docs/deployment/manual-deployment.md @@ -2,12 +2,12 @@ The installation works under Windows, Linux and macOS. The only dependency is an installed OpenJDK 11 or 17 with 17 recommended. Blaze is tested with [Eclipse Temurin][1]. -Blaze runs on the JVM and comes as single JAR file. Download the most recent version [here](https://github.com/samply/blaze/releases/tag/v0.24.0). Look for `blaze-0.24.0-standalone.jar`. +Blaze runs on the JVM and comes as single JAR file. Download the most recent version [here](https://github.com/samply/blaze/releases/tag/v0.24.1). Look for `blaze-0.24.1-standalone.jar`. After the download, you can start blaze with the following command (Linux, macOS): ```sh -java -jar blaze-0.24.0-standalone.jar +java -jar blaze-0.24.1-standalone.jar ``` Blaze will run with an in-memory, volatile database for testing and demo purposes. @@ -17,14 +17,14 @@ Blaze can be run with durable storage by setting the environment variables `STOR Under Linux/macOS: ```sh -STORAGE=standalone java -jar blaze-0.24.0-standalone.jar +STORAGE=standalone java -jar blaze-0.24.1-standalone.jar ``` Under Windows, you need to set the Environment variables in the PowerShell before starting Blaze: ```powershell $Env:STORAGE="standalone" -java -jar blaze-0.24.0-standalone.jar +java -jar blaze-0.24.1-standalone.jar ``` This will create three directories called `index`, `transaction` and `resource` inside the current working directory, one for each database part used. @@ -42,7 +42,7 @@ The output should look like this: 2021-06-27T11:02:37.834Z ee086ef908c1 main INFO [blaze.core:64] - JVM version: 16.0.2 2021-06-27T11:02:37.834Z ee086ef908c1 main INFO [blaze.core:65] - Maximum available memory: 1738 MiB 2021-06-27T11:02:37.835Z ee086ef908c1 main INFO [blaze.core:66] - Number of available processors: 8 -2021-06-27T11:02:37.836Z ee086ef908c1 main INFO [blaze.core:67] - Successfully started Blaze version 0.24.0 in 8.2 seconds +2021-06-27T11:02:37.836Z ee086ef908c1 main INFO [blaze.core:67] - Successfully started Blaze version 0.24.1 in 8.2 seconds ``` In order to test connectivity, query the health endpoint: @@ -62,7 +62,7 @@ that should return: ```json { "name": "Blaze", - "version": "0.24.0" + "version": "0.24.1" } ``` diff --git a/modules/frontend/package-lock.json b/modules/frontend/package-lock.json index 4fa534aa7..69a32d362 100644 --- a/modules/frontend/package-lock.json +++ b/modules/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "blaze-frontend", - "version": "0.24.0", + "version": "0.24.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "blaze-frontend", - "version": "0.24.0", + "version": "0.24.1", "dependencies": { "@fontsource-variable/inter": "^5.0.8", "@tailwindcss/forms": "^0.5.3" diff --git a/modules/frontend/package.json b/modules/frontend/package.json index 4db3e4aba..9c6a50b7d 100644 --- a/modules/frontend/package.json +++ b/modules/frontend/package.json @@ -1,6 +1,6 @@ { "name": "blaze-frontend", - "version": "0.24.0", + "version": "0.24.1", "private": true, "scripts": { "dev": "vite dev", diff --git a/src/blaze/system.clj b/src/blaze/system.clj index 75c6b4421..ee39d6996 100644 --- a/src/blaze/system.clj +++ b/src/blaze/system.clj @@ -92,9 +92,9 @@ (into {} (map (fn [[k v]] [k (resolvef k v)])) (ig/find-derived config key)))) (def ^:private root-config - {:blaze/version "0.24.0" + {:blaze/version "0.24.1" - :blaze/release-date "2024-02-06" + :blaze/release-date "2024-02-07" :blaze/clock {}