[GH-ISSUE #744] Support for generations in the filesystem backend #125

Open
opened 2026-03-03 12:08:32 +03:00 by kerem · 1 comment
Owner

Originally created by @fsouza on GitHub (Apr 8, 2022).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/744

Currently, only the memory backend supports generations, we should implement generations in the filesystem backend too.

One thing to notice is that while we don't have any promises in terms backwards compatibility for the contents of -filesystem-root, maybe we shouldn't break it too badly? Meaning, we'd probably want to introduce a new backend, or some migration script (I doubt users would notice the migration script until too late? idk).

Originally created by @fsouza on GitHub (Apr 8, 2022). Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/744 Currently, only the memory backend supports generations, we should implement generations in the filesystem backend too. One thing to notice is that while we don't have any promises in terms backwards compatibility for the contents of `-filesystem-root`, maybe we shouldn't break it too badly? Meaning, we'd probably want to introduce a new backend, or some migration script (I doubt users would notice the migration script until too late? idk).
Author
Owner

@orsinium commented on GitHub (Apr 8, 2022):

There is a Python script using dimutex that reproduces the issue:

import asyncio
import aiohttp
import dimutex
from http import HTTPStatus
from gcloud.aio.storage.storage import API_ROOT
from random import choice
from string import ascii_letters


async def main():
    # create bucket
    bucket_name = "".join(choice(ascii_letters) for _ in range(10))
    connector = aiohttp.TCPConnector(ssl=False)
    async with aiohttp.ClientSession(connector=connector) as session:
        await session.post(
            url=API_ROOT,
            json=dict(name=bucket_name),

        )

    lock = dimutex.GCS(bucket=bucket_name, name='lock-name', required=False)
    async with lock:
        resp = await lock._create(force=False)
        resp.raise_for_status()
        resp = await lock._create(force=False)
        assert resp.status == HTTPStatus.PRECONDITION_FAILED

asyncio.run(main())

The assertion fails on #735 but passes without it. Using -backend memory fixes the issue.

<!-- gh-comment-id:1092786767 --> @orsinium commented on GitHub (Apr 8, 2022): There is a Python script using [dimutex](https://github.com/orsinium-labs/dimutex) that reproduces the issue: ```python import asyncio import aiohttp import dimutex from http import HTTPStatus from gcloud.aio.storage.storage import API_ROOT from random import choice from string import ascii_letters async def main(): # create bucket bucket_name = "".join(choice(ascii_letters) for _ in range(10)) connector = aiohttp.TCPConnector(ssl=False) async with aiohttp.ClientSession(connector=connector) as session: await session.post( url=API_ROOT, json=dict(name=bucket_name), ) lock = dimutex.GCS(bucket=bucket_name, name='lock-name', required=False) async with lock: resp = await lock._create(force=False) resp.raise_for_status() resp = await lock._create(force=False) assert resp.status == HTTPStatus.PRECONDITION_FAILED asyncio.run(main()) ``` The assertion fails on #735 but passes without it. Using `-backend memory` fixes the issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#125
No description provided.