linkedin / linkedin/cassette

Consider removing the "commitFile" logic from CASQueueFile

Open
#31 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C
Stars
95
Forks
18
PR merge metrics
No merged PRs in 30d

Description

`CASQueueFile` writes its header to a [a temporary `commitFile`](https://github.com/linkedin/cassette/blob/fc545125a481dcafa9cde96ed151d811d5855d93/Cassette/CASQueueFile.m#L564) with comments suggesting it should try and recover from failure when updating the metadata header.

This logic [does not exist in the Java implementation of `tape`](https://github.com/square/tape/blob/445cd3fd0a7b3ec48c9ea3e0e86663fe6d3735d8/tape/src/main/java/com/squareup/tape2/QueueFile.java#L265).

Worse yet, the Objective-C implementation does not actually recover from failure; it [silently discards the queue file entirely](https://github.com/linkedin/cassette/blob/fc545125a481dcafa9cde96ed151d811d5855d93/Cassette/CASQueueFile.m#L78) and pretends like the queue was empty.

Probably this logic should just be deleted. Either we assume the OS writes the header atomically (in which case we don't need the temporary `commitFile`), or we need to write the entire queue (header *and* data) to a temporary file, then rename the temporary file over the real file.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read Cassette/CASQueueFile.m at the commitFile logic around line 564 and the failure handling around line 78, then compare the referenced Java QueueFile implementation. Verify what happens when updating the metadata header fails and whether the queue is discarded; done means the commitFile behavior is removed or replaced with a clearly tested recovery approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c
Domain
desktop-dev, mobile-dev
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.