Skip to content

Commit

Permalink
Problem: omni_vfs has some bugs and issues (🚀 omni_vfs 0.1.1) (omnigr…
Browse files Browse the repository at this point in the history
  • Loading branch information
yrashk authored Apr 14, 2024
2 parents 5ccf192 + d69a43b commit 0aef6b0
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
22 changes: 22 additions & 0 deletions extensions/omni_vfs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.1] - 2023-04-14

### Fixed

* A potential crash when operating with deleted local FS mounts [#560](https://github.com/omnigres/omnigres/pull/560)

## [0.1.0] - 2023-03-05

Initial release following a few months of iterative development.

[Unreleased]: https://github.com/omnigres/omnigres/commits/next/omni_httpd

[0.1.0]: [https://github.com/omnigres/omnigres/pull/511]

[0.1.1]: [https://github.com/omnigres/omnigres/pull/559]
4 changes: 4 additions & 0 deletions extensions/omni_vfs/local_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ static char *get_mount_path(Datum fs_id) {
if (rc != SPI_OK_SELECT) {
ereport(ERROR, errmsg("fetching mount failed"), errdetail("%s", SPI_result_code_string(rc)));
}
if (SPI_tuptable->numvals == 0) {
ereport(ERROR, errmsg("fetching mount failed"),
errdetail("missing information in omni_vfs.local_fs_mounts"));
}

TupleDesc tupdesc = SPI_tuptable->tupdesc;
HeapTuple tuple = SPI_tuptable->vals[0];
Expand Down
27 changes: 27 additions & 0 deletions extensions/omni_vfs/tests/deleted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
$schema: "https://raw.githubusercontent.com/omnigres/omnigres/master/pg_yregress/schema.json"
instance:
init:
- create extension omni_vfs cascade

# This particular test is a regression test that ensure if between obtaining the `local_fs`
# and using it, the record of it is gone, we don't crash and properly error out

tests:

- name: create a local filesystem
# We save it so we can avoid recreating it to test this regression
query: create table fs_info as (select omni_vfs.local_fs('.') as fs)
commit: true

- name: destroy the backend information
query: delete
from omni_vfs.local_fs_mounts
commit: true

- name: try accessing the filesystem
query: select *
from omni_vfs.list((select fs from fs_info), '.')
error:
severity: ERROR
message: fetching mount failed
detail: missing information in omni_vfs.local_fs_mounts
4 changes: 4 additions & 0 deletions extensions/omni_vfs/tests/local_fs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ tests:
select * from omni_vfs.list(omni_vfs.local_fs('../../../../extensions/omni_vfs/tests'), '')
order by name
results:
- name: deleted.yml
kind: file
- name: empty
kind: dir
- name: local_fs.yml
Expand All @@ -46,6 +48,8 @@ tests:
select * from omni_vfs.list_recursively(omni_vfs.local_fs('../../../../extensions/omni_vfs/tests'), '.')
order by name
results:
- name: deleted.yml
kind: file
- name: empty
kind: dir
- name: empty/.keepme
Expand Down
2 changes: 1 addition & 1 deletion versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ omni_txn=0.1.0
omni_types=0.1.0
omni_var=0.1.0
omni_vfs_types_v1=0.1.0
omni_vfs=0.1.0
omni_vfs=0.1.1
omni_web=0.1.0
omni_xml=0.1.0

0 comments on commit 0aef6b0

Please sign in to comment.