Jira (PDB-4524) Provide way to stop/start command processing (maybe only internal initially)

0 views
Skip to first unread message

Rob Browning (JIRA)

unread,
Oct 1, 2019, 4:57:04 PM10/1/19
to puppe...@googlegroups.com
Rob Browning created an issue
 
PuppetDB / Improvement PDB-4524
Provide way to stop/start command processing (maybe only internal initially)
Issue Type: Improvement Improvement
Assignee: Unassigned
Created: 2019/10/01 1:56 PM
Priority: Normal Normal
Reporter: Rob Browning

Provide a way to stop and start command processing, perhaps initially only internally, say via a service method. This should help reduce the complexity/fragility of some of the tests.

While we might want to eventually support some public way to control this, that can come later.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Zachary Kent (Jira)

unread,
Jan 11, 2021, 8:21:03 PM1/11/21
to puppe...@googlegroups.com
Zachary Kent updated an issue
Change By: Zachary Kent
Labels: tsr-pdb-backlog
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Zachary Kent (Jira)

unread,
Jan 12, 2021, 2:15:03 PM1/12/21
to puppe...@googlegroups.com

Zachary Kent (Jira)

unread,
Feb 7, 2021, 4:54:02 PM2/7/21
to puppe...@googlegroups.com
Zachary Kent commented on Improvement PDB-4524
 
Re: Provide way to stop/start command processing (maybe only internal initially)

One way to accomplish this would be to pass in a piece of state controlled by an atom to the dochan function in threadpool.clj. This function controls the loop that pulls commands off of the internal queue (command-chan) and then calls the function to process and store those commands. We could have the function check the state of the atom and refuse to pull more commands off of the queue if it was set to false or something along those lines. We'll want to make sure to add some sort of slow down to this check so it doesn't run too quickly if the atom is set to block commands. The docahn func is used here during the start of the command service. We could add a TK service method to the PuppetDBCommandDispatcher service which can flip the atom back and forth to allow/block command processing. 

Acceptance criteria: 
    * A new TK service method which allows the toggling of command processing, this should be possible from both the FOSS pdb repo and from the pdbext repo  
    * A test which shows that command processing can be halted by using this TK service method

Testing notes: 

It's possible that there could be a race between setting the atom and any inflight commands when testing. It's probably fine to block command processing first, submit commands, and then check that they're still waiting to be processed without worrying about testing this for a command queue with in flight commands.  

Bogdan Irimie (Jira)

unread,
Feb 8, 2021, 10:22:03 AM2/8/21
to puppe...@googlegroups.com
Bogdan Irimie updated an issue
 
Change By: Bogdan Irimie
Acceptance Criteria:
    * A new TK service method which allows the toggling of command processing, this should be possible from both the FOSS pdb repo and from the pdbext repo  
    * A test which shows that command processing can be halted by using this TK service method

Bogdan Irimie (Jira)

unread,
Feb 8, 2021, 10:22:21 AM2/8/21
to puppe...@googlegroups.com

Zachary Kent (Jira)

unread,
Feb 8, 2021, 6:17:04 PM2/8/21
to puppe...@googlegroups.com
Zachary Kent commented on Improvement PDB-4524
 
Re: Provide way to stop/start command processing (maybe only internal initially)

After discussing this a bit with Rob Browning there were two other approaches he suggested which would eliminate the need to poll the atom in the dochan loop described above.

1) We could use an empty java object created with the call: (Object.) We would store this object in the app context as a coordination mechanism between the dochan loop and the TK method to stop command processing. In the dochan loop it would attempt to lock the object with: (.lock obj-name) before pulling a command off of the queue. This would allow the TK method that's added to lock the object the dochan loop checks when called. Doing this would cause the dochan loop to block waiting on the TK method to release the lock, blocking commands from being processed.

2) It's possible the that the Executor created in the GatedThreadpool defrecord. Has the ability to pause incoming tasks. We haven't looked through the docs in detail but it would be worth checking out before going with option 1 to see if this is possible.

Bogdan Irimie (Jira)

unread,
Feb 10, 2021, 10:27:03 AM2/10/21
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Feb 24, 2021, 9:13:03 AM2/24/21
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Feb 25, 2021, 2:15:01 AM2/25/21
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Mar 10, 2021, 9:14:02 AM3/10/21
to puppe...@googlegroups.com
Bogdan Irimie updated an issue
Change By: Bogdan Irimie
Sprint: ghost-10.03.2021 , ready for triage 3

Bogdan Irimie (Jira)

unread,
Mar 17, 2021, 3:29:03 AM3/17/21
to puppe...@googlegroups.com
Bogdan Irimie commented on Improvement PDB-4524
 
Re: Provide way to stop/start command processing (maybe only internal initially)

As ExecutorService interface does not support pausing and resuming PDB-5018 , I implemented the first (1) option that Zach and Rob proposed.

Zachary Kent (Jira)

unread,
Apr 9, 2021, 5:12:02 PM4/9/21
to puppe...@googlegroups.com
Zachary Kent updated an issue
 
Change By: Zachary Kent
Fix Version/s: PDB n/a
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages