Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into HEAD
Browse files Browse the repository at this point in the history
* upstream/main:
  (PDB-5736) 8.6.0 release notes
  (PDB-5732) Prep release notes for 7.18.0
  Version 7.18.1-SNAPSHOT
  Version 7.18.0
  Version 8.5.1-SNAPSHOT
  Version 8.5.0
  (PDB-5735) Prep 8.5.0 release
  (PDB-5731) Prep 7.18.0 release
  Log obsolete cmd message with producer_timestamp
  (maint) Work around java install on older debian
  Set clj-parent=5.6.13
  Set clj-parent=7.3.14
  Set clj-parent=5.6.12
  • Loading branch information
donoghuc committed Apr 11, 2024
2 parents 6d9d254 + cae599d commit 5412b6b
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 16 deletions.
2 changes: 2 additions & 0 deletions acceptance/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,8 @@ def install_puppet_from_package(puppet_collection = "puppet6")
# Take new configuration file on debian to prevent tests from hanging
# when this is used to upgrade puppet
if get_os_family(database) == :debian
# Explicitly install ca-certificates-java before java to avoid error installing java on debian
database.install_package('ca-certificates-java')
database.install_package('puppetserver', '-o Dpkg::Options::="--force-confnew"')
else
install_package(database, 'puppetserver')
Expand Down
16 changes: 16 additions & 0 deletions documentation/release_notes_7.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ canonical: "/puppetdb/latest/release_notes.html"

# PuppetDB: Release notes

## PuppetDB 7.18.0

Released April 11 2024

### Improvements

* Ship with updated dependencies (clojure, and pgjdbc)

### Bug fixes

* Ensure producer_timestamp is logged with legacy commands.

### Contributors

Austin Blatt and Rob Browning.

## PuppetDB 7.17.1

Released February 27 2024
Expand Down
20 changes: 20 additions & 0 deletions documentation/release_notes_8.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,26 @@ canonical: "/puppetdb/latest/release_notes.html"

---

## PuppetDB 8.5.0

Released April 11 2024

### New features and improvements

* Improve query performance on the certnames table

### Improvements

* Ship with updated dependencies (clojure, and pgjdbc)

### Bug fixes

* Ensure producer_timestamp is logged with legacy commands.

### Contributors

Austin Blatt and Rob Browning.

# PuppetDB: Release notes

## PuppetDB 8.4.1
Expand Down
4 changes: 2 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(def pdb-version "8.4.2-SNAPSHOT")
(def pdb-version "8.5.1-SNAPSHOT")

(def clj-parent-version "7.3.13")
(def clj-parent-version "7.3.14")

(defn true-in-env? [x]
(#{"true" "yes" "1"} (System/getenv x)))
Expand Down
32 changes: 19 additions & 13 deletions src/puppetlabs/puppetdb/command.clj
Original file line number Diff line number Diff line change
Expand Up @@ -640,18 +640,19 @@
"Processes a command ref marked for deletion. This is similar to
processing a non-delete cmdref except different metrics need to be
updated to indicate the difference in command"
[cmd {:keys [command version certname id received producer_timestamp] :as cmdref}
[cmd {:keys [command version certname id received] :as cmdref}
q response-chan stats _options-config maybe-send-cmd-event!]
(swap! stats update :executed-commands inc)
((:callback cmd) {:command cmd :result nil})
(async/>!! response-chan (make-cmd-processed-message cmd nil))
(log-command-processed-messsage id received (now) (command-keys command)
certname producer_timestamp
{:status :obsolete})
(queue/ack-command q {:entry (queue/cmdref->entry cmdref)})
(maybe-send-cmd-event! cmdref ::processed)
(update-counter! :depth command version dec!)
(update-counter! :invalidated command version dec!))
(let [producer_timestamp (get-in cmd [:payload :producer_timestamp])]
(swap! stats update :executed-commands inc)
((:callback cmd) {:command cmd :result nil})
(async/>!! response-chan (make-cmd-processed-message cmd nil))
(log-command-processed-messsage id received (now) (command-keys command)
certname producer_timestamp
{:status :obsolete})
(queue/ack-command q {:entry (queue/cmdref->entry cmdref)})
(maybe-send-cmd-event! cmdref ::processed)
(update-counter! :depth command version dec!)
(update-counter! :invalidated command version dec!)))

(defn broadcast-cmd
[{:keys [certname command id callback] :as cmd}
Expand Down Expand Up @@ -811,8 +812,13 @@
(mark! (global-metric :fatal))
(maybe-send-cmd-event! cmdref ::processed))

delete? (process-delete-cmd cmd cmdref q response-chan stats
options-config maybe-send-cmd-event!)
delete? (-> cmd
;; :producer_timestamp is optional in some commands.
;; Normally handled by prep-command, but those operations
;; can be expensive and aren't necessary to drop the cmd.
(update-in [:payload :producer_timestamp] #(or % (now)))
(process-delete-cmd cmdref q response-chan stats
options-config maybe-send-cmd-event!))

:else (-> cmd
(prep-command options-config)
Expand Down
8 changes: 7 additions & 1 deletion test/puppetlabs/puppetdb/command_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
[puppetlabs.trapperkeeper.services
:refer [service-context]]
[puppetlabs.puppetdb.client :as client]
[puppetlabs.stockpile.queue :as stock]
[puppetlabs.puppetdb.threadpool :as pool])
(:import
(clojure.lang ExceptionInfo)
Expand Down Expand Up @@ -1631,6 +1632,8 @@
(svc-utils/with-puppetdb-instance
(let [{pdb-host :host pdb-port :port
:or {pdb-host "127.0.0.1" pdb-port 8080}} (:jetty (get-config))
pdb (get-service svc-utils/*server* :PuppetDBServer)
q (:q (cli-svc/shared-globals pdb))
base-url (utils/pdb-cmd-base-url pdb-host pdb-port :v1)
facts {:certname "foo.com"
:environment "test"
Expand Down Expand Up @@ -1666,7 +1669,10 @@

;; check the first command was "bashed"
(is (= #{{:id 0 :delete? true} {:id 1 :delete? nil}}
(set (map #(select-keys % [:id :delete?]) val))))))))))
(set (map #(select-keys % [:id :delete?]) val))))

;; check that all commands removed from stockpile
(is (= 0 (stock/reduce q (fn [acc _] (inc acc)) 0)))))))))

(deftest command-service-stats
(svc-utils/with-puppetdb-instance
Expand Down

0 comments on commit 5412b6b

Please sign in to comment.