Project

General

Profile

Actions

Feature #21703

closed

Controller uses new uuid_locks table to ensure concurrent replace_files requests produce consistent results

Added by Tom Clegg 2 months ago. Updated 7 days ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
API
Story points:
-


Subtasks 1 (0 open1 closed)

Task #21873: Review 21703-collection-update-lockResolvedTom Clegg06/24/2024Actions
Actions #1

Updated by Peter Amstutz 2 months ago

  • Target version set to Development 2024-06-05 sprint
Actions #2

Updated by Peter Amstutz about 1 month ago

  • Target version changed from Development 2024-06-05 sprint to 439
Actions #3

Updated by Peter Amstutz about 1 month ago

  • Target version changed from 439 to Development 2024-06-19 sprint
Actions #4

Updated by Peter Amstutz 27 days ago

  • Assigned To set to Tom Clegg
Actions #5

Updated by Peter Amstutz 14 days ago

  • Target version changed from Development 2024-06-19 sprint to Development 2024-07-03 sprint
Actions #6

Updated by Peter Amstutz 14 days ago

  • Target version changed from Development 2024-07-03 sprint to Development 2024-07-24 sprint
Actions #7

Updated by Peter Amstutz 13 days ago

  • Target version changed from Development 2024-07-24 sprint to Development 2024-07-03 sprint
Actions #8

Updated by Tom Clegg 13 days ago

  • Status changed from New to In Progress
Actions #10

Updated by Tom Clegg 12 days ago

  • All agreed upon points are implemented / addressed.
  • Anything not implemented (discovered or discussed during work) has a follow-up story.
  • Code is tested and passing, both automated and manual, what manual testing was done is described
    • ✅ automated test just does some concurrent updates to check for an easily attained deadlock. As the test comment says, until #21701 it's not possible to check from the outside whether this mechanism is really serializing updates. I figure it makes more sense to test that in #21701 than to go to the trouble of inspecting Rails logs, spying on outgoing calls, etc.
  • Documentation has been updated.
    • N/A
  • Behaves appropriately at the intended scale (describe intended scale).
    • Expect the additional database queries to be much faster than doing the actual collection update via rails.
  • Considered backwards and forwards compatibility issues between client and server.
    • No issues anticipated.
  • Follows our coding standards and GUI style guidelines.
Actions #11

Updated by Brett Smith 11 days ago

My only comment is it would be nice to have trash_sweep tests for both the case where it does delete a row as well as the case where it doesn't (because the row is already locked).

I guess my other only comment is I wish our style guide said something about how to write SQL, particularly how to handle identifiers. I feel like it would be nice if we had some reliable distinction between syntax and identifiers. I don't have a strong preference about whether we might achieve that through capitalization or quoting. But maybe this ship has already sailed too far.

Thanks.

Actions #12

Updated by Tom Clegg 9 days ago

Yes. The rails integration test environment is all about preventing commit from happening at all, sharing database connections, etc., but I eventually realized if the test just uses the postgresql driver directly, it can test both deleting and not-deleting.

Also merged main.

21703-collection-update-lock @ e9e39b5f92ec9a702f2bbdd815dd3a1942820db9 -- developer-run-tests: #4309

Actions #13

Updated by Brett Smith 8 days ago

Tom Clegg wrote in #note-12:

21703-collection-update-lock @ e9e39b5f92ec9a702f2bbdd815dd3a1942820db9 -- developer-run-tests: #4309

My one nit is it would be good to log the exception that causes ready << false, since it's basically guaranteed to cause a test failure. Otherwise this looks good to me. It tests all the cases and is consistent with our existing tests. Thanks.

Admittedly I was imagining a separate test case. This case is kind of illustrative. If you fail the test, then the actual result you get in the last assertion tells you whether the code is under-deleting or over-deleting. A separate test case doesn't provide any additional information.

But, I didn't catch that detail at first, and I suspect it would've taken me a lot longer to figure out if I didn't already have this code in the L1 cache of my brain. If I was working on something "unrelated" in trash_sweep, and this test starts failing unexpectedly, it'll take me time to read the code, understand what it's testing, and why it's failing.

Separate test cases with good names can help explain the problem to the developer more effectively. If I have a passing test of "trash_sweep deletes inactive locks" and a failing test of "trash_sweep retains active locks," that tells me something about the nature of the bug without having to read the nitty-gritty implementation details of establishing a PostgreSQL connection, what the ready queue is, etc.

As a team we often talk about the tests like they're this black box where you must read the code to understand what they expect. I understand why they feel that way now. But I don't think they have to be that way.

Actions #14

Updated by Tom Clegg 8 days ago

Fixed unlogged exception. Split assert into separate asserts with comments.

Actions #15

Updated by Tom Clegg 8 days ago

  • Status changed from In Progress to Resolved
Actions

Also available in: Atom PDF