mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d5236af36 | ||
|
|
75967b355c | ||
|
|
de470c66fb | ||
|
|
4f90865348 | ||
|
|
15ac3500a3 | ||
|
|
876e98ff15 | ||
|
|
77cc6f3cbc | ||
|
|
9009825fcc | ||
|
|
d1dc0889f3 | ||
|
|
f4f3fa35f6 | ||
|
|
1aa88de0ac | ||
|
|
bdda9d8879 | ||
|
|
5fb41d946e | ||
|
|
57ae6ffce0 | ||
|
|
4dd9cc289d | ||
|
|
6d733cb863 | ||
|
|
bb06389a8c | ||
|
|
c701d57535 |
No files matched your search
+1
-2
@@ -20,5 +20,4 @@ ignore-regex = \b[a-z]+[A-Z]\w*\b|\b[A-Z][a-z]+[A-Z]\w*\b
|
||||
# unknwon: GitHub username / Go module path (`github.com/unknwon/goconfig`)
|
||||
# atleast: CLI mode literal string in test/benchmark/fuse_db/bin/sqlite_verify.py
|
||||
# sme: local variable for a *streamMutateError in mount tests
|
||||
# nin: AWS S3 Vectors "$nin" filter operator literal (API-defined, cannot rename)
|
||||
ignore-words-list = visibles,fo,te,ser,bject,unparseable,keep-alives,tread,anc,ue,auther,thirdparty,unknwon,atleast,sme,nin
|
||||
ignore-words-list = visibles,fo,te,ser,bject,unparseable,keep-alives,tread,anc,ue,auther,thirdparty,unknwon,atleast,sme
|
||||
@@ -1,11 +0,0 @@
|
||||
name: Clean up stale SeaweedFS test mounts
|
||||
description: Detach disconnected FUSE test mounts left by earlier jobs on a shared runner.
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Unmount disconnected SeaweedFS test mounts
|
||||
if: runner.os == 'Linux' && runner.environment == 'self-hosted'
|
||||
shell: bash
|
||||
env:
|
||||
CLEANUP_SCRIPT: ${{ github.action_path }}/cleanup.py
|
||||
run: python3 "$CLEANUP_SCRIPT"
|
||||
@@ -1,89 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Detach disconnected SeaweedFS integration-test mounts without touching live ones."""
|
||||
|
||||
import errno
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
|
||||
def test_mounts(mountinfo):
|
||||
"""Read the kernel table directly: traversing a stale mount may block."""
|
||||
roots = {tempfile.gettempdir(), "/tmp", "/var/tmp"}
|
||||
for line in mountinfo.splitlines():
|
||||
fields, filesystem = line.split(" - ", 1)
|
||||
if filesystem.split()[0].split(".")[0] != "fuse":
|
||||
continue
|
||||
fields = fields.split()
|
||||
# mountinfo escapes whitespace and backslashes with octal sequences.
|
||||
target = re.sub(r"\\([0-7]{3})", lambda m: chr(int(m[1], 8)), fields[4])
|
||||
path = Path(target)
|
||||
# Test mounts are a mount* leaf under a seaweedfs_fuse_* scratch dir
|
||||
# (seaweedfs_fuse_test_*/mount, seaweedfs_fuse_failover_*/mount0, ...)
|
||||
# or the posix-compliance workflow's fixed /tmp/seaweedfs/mount.
|
||||
if (not path.name.startswith("mount")
|
||||
or str(path.parent.parent) not in roots
|
||||
or not (path.parent.name.startswith("seaweedfs_fuse")
|
||||
or path.parent.name == "seaweedfs")):
|
||||
continue
|
||||
yield fields[0], target
|
||||
|
||||
|
||||
def mounted(mount_id, target):
|
||||
return (mount_id, target) in test_mounts(Path("/proc/self/mountinfo").read_text())
|
||||
|
||||
|
||||
def cleanup():
|
||||
failed = False
|
||||
for mount_id, target in test_mounts(Path("/proc/self/mountinfo").read_text()):
|
||||
try:
|
||||
# A separate, bounded probe prevents a wedged FUSE daemon from
|
||||
# hanging cleanup. Only ENOTCONN proves the daemon disconnected;
|
||||
# a timeout or another error is not enough to detach a live mount.
|
||||
probe = subprocess.run(
|
||||
[sys.executable, __file__, "--probe", target], timeout=5,
|
||||
capture_output=True, check=False,
|
||||
)
|
||||
except subprocess.TimeoutExpired:
|
||||
print(f"::warning::FUSE probe timed out; leaving {target} mounted")
|
||||
continue
|
||||
if probe.returncode != errno.ENOTCONN or not mounted(mount_id, target):
|
||||
continue
|
||||
|
||||
print(f"Unmounting disconnected FUSE test mount: {target}", flush=True)
|
||||
# Lazy unmount detaches a dead mount even when an old process still
|
||||
# holds it open. Prefer the unprivileged FUSE helper; sudo is fallback.
|
||||
for command in (
|
||||
["fusermount3", "-uz", "--", target],
|
||||
["fusermount", "-uz", "--", target],
|
||||
["sudo", "-n", "umount", "-l", "--", target],
|
||||
):
|
||||
try:
|
||||
subprocess.run(command, timeout=10, check=False)
|
||||
except (OSError, subprocess.TimeoutExpired) as error:
|
||||
print(f"{command[0]}: {error}", file=sys.stderr)
|
||||
if not mounted(mount_id, target):
|
||||
break
|
||||
else:
|
||||
print(f"::error::Could not unmount disconnected FUSE test mount: {target}")
|
||||
failed = True
|
||||
continue
|
||||
# The detached mount's parent still holds the crashed run's data and
|
||||
# logs; test_mounts only yields targets under a SeaweedFS test dir in
|
||||
# a temp root, so the parent is safe to reclaim here.
|
||||
shutil.rmtree(Path(target).parent, ignore_errors=True)
|
||||
return int(failed)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) == 3 and sys.argv[1] == "--probe":
|
||||
try:
|
||||
os.stat(sys.argv[2])
|
||||
except OSError as error:
|
||||
sys.exit(error.errno)
|
||||
sys.exit(0)
|
||||
sys.exit(cleanup())
|
||||
@@ -1,137 +0,0 @@
|
||||
import errno
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
spec = importlib.util.spec_from_file_location("cleanup", Path(__file__).with_name("cleanup.py"))
|
||||
cleanup = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(cleanup)
|
||||
|
||||
TARGET = "/tmp/seaweedfs_fuse_test_123/mount"
|
||||
MOUNTINFO = f"42 1 0:9 / {TARGET} rw - fuse.seaweedfs seaweedfs rw\n"
|
||||
|
||||
|
||||
class CleanupTests(unittest.TestCase):
|
||||
def run_cleanup(self, results, mounted=True):
|
||||
with patch.object(cleanup.Path, "read_text", return_value=MOUNTINFO), \
|
||||
patch.object(cleanup, "mounted", side_effect=mounted if isinstance(mounted, list) else None,
|
||||
return_value=mounted) as check, \
|
||||
patch.object(cleanup.shutil, "rmtree") as rmtree, \
|
||||
patch.object(cleanup.subprocess, "run", side_effect=results) as run:
|
||||
status = cleanup.cleanup()
|
||||
return status, run, check, rmtree
|
||||
|
||||
def result(self, status):
|
||||
return subprocess.CompletedProcess([], status)
|
||||
|
||||
def test_only_fuse_integration_test_mounts_are_candidates(self):
|
||||
rows = MOUNTINFO
|
||||
rows += MOUNTINFO.replace("fuse.seaweedfs", "ext4")
|
||||
rows += MOUNTINFO.replace(TARGET, "/mnt/production")
|
||||
rows += MOUNTINFO.replace(TARGET, "/tmp/seaweedfs_fuse_test_123/data")
|
||||
rows += MOUNTINFO.replace(TARGET, "/home/user/seaweedfs_fuse_test_123/mount")
|
||||
rows += MOUNTINFO.replace(TARGET, "/tmp/seaweedfs/data")
|
||||
self.assertEqual(list(cleanup.test_mounts(rows)), [("42", TARGET)])
|
||||
|
||||
def test_all_test_mount_layouts_are_candidates(self):
|
||||
targets = (
|
||||
"/tmp/seaweedfs_fuse_test_123/mount",
|
||||
"/tmp/seaweedfs_fuse_failover_456/mount0",
|
||||
"/tmp/seaweedfs_fuse_failover_456/mount1",
|
||||
"/var/tmp/seaweedfs_fuse_p2p_test_789/mount2",
|
||||
"/tmp/seaweedfs/mount",
|
||||
)
|
||||
rows = "".join(
|
||||
MOUNTINFO.replace("42", str(40 + i)).replace(TARGET, target)
|
||||
for i, target in enumerate(targets)
|
||||
)
|
||||
self.assertEqual(
|
||||
list(cleanup.test_mounts(rows)),
|
||||
[(str(40 + i), target) for i, target in enumerate(targets)],
|
||||
)
|
||||
|
||||
def test_mountinfo_paths_are_unescaped_once(self):
|
||||
target = "/tmp/seaweedfs_fuse_test_space and\\slash/mount"
|
||||
encoded = target.replace("\\", r"\134").replace(" ", r"\040")
|
||||
rows = MOUNTINFO.replace(TARGET, encoded)
|
||||
self.assertEqual(list(cleanup.test_mounts(rows)), [("42", target)])
|
||||
|
||||
def test_no_mounts_is_a_noop(self):
|
||||
with patch.object(cleanup.Path, "read_text", return_value=""), \
|
||||
patch.object(cleanup.subprocess, "run") as run:
|
||||
self.assertEqual(cleanup.cleanup(), 0)
|
||||
run.assert_not_called()
|
||||
|
||||
def test_healthy_mount_is_untouched(self):
|
||||
status, run, _, _ = self.run_cleanup([self.result(0)])
|
||||
self.assertEqual(status, 0)
|
||||
self.assertEqual(run.call_count, 1)
|
||||
|
||||
def test_other_probe_errors_are_untouched(self):
|
||||
for error in (errno.EACCES, errno.ENOENT, errno.EIO):
|
||||
with self.subTest(error=error):
|
||||
status, run, _, _ = self.run_cleanup([self.result(error)])
|
||||
self.assertEqual(status, 0)
|
||||
self.assertEqual(run.call_count, 1)
|
||||
|
||||
def test_probe_timeout_does_not_detach_a_possibly_live_mount(self):
|
||||
status, run, _, _ = self.run_cleanup([subprocess.TimeoutExpired("probe", 5)])
|
||||
self.assertEqual(status, 0)
|
||||
self.assertEqual(run.call_count, 1)
|
||||
|
||||
def test_disconnected_mount_is_lazily_unmounted(self):
|
||||
status, run, _, _ = self.run_cleanup([self.result(errno.ENOTCONN), self.result(0)], [True, False])
|
||||
self.assertEqual(status, 0)
|
||||
self.assertEqual(run.call_args_list[1].args[0], ["fusermount3", "-uz", "--", TARGET])
|
||||
self.assertEqual(run.call_args_list[0].kwargs["timeout"], 5)
|
||||
self.assertEqual(run.call_args_list[1].kwargs["timeout"], 10)
|
||||
|
||||
def test_replaced_or_removed_mount_is_untouched(self):
|
||||
status, run, _, _ = self.run_cleanup([self.result(errno.ENOTCONN)], False)
|
||||
self.assertEqual(status, 0)
|
||||
self.assertEqual(run.call_count, 1)
|
||||
|
||||
def test_mount_identity_is_checked_without_stat(self):
|
||||
with patch.object(cleanup.Path, "read_text", return_value=MOUNTINFO):
|
||||
self.assertTrue(cleanup.mounted("42", TARGET))
|
||||
self.assertFalse(cleanup.mounted("43", TARGET))
|
||||
|
||||
def test_missing_or_timed_out_helper_uses_fallback(self):
|
||||
for error in (FileNotFoundError(), subprocess.TimeoutExpired("fusermount3", 10)):
|
||||
with self.subTest(error=error):
|
||||
status, run, _, _ = self.run_cleanup(
|
||||
[self.result(errno.ENOTCONN), error, self.result(0)], [True, True, False])
|
||||
self.assertEqual(status, 0)
|
||||
self.assertEqual(run.call_args.args[0], ["fusermount", "-uz", "--", TARGET])
|
||||
|
||||
def test_failed_helpers_fall_back_to_sudo(self):
|
||||
status, run, _, _ = self.run_cleanup(
|
||||
[self.result(errno.ENOTCONN), self.result(1), self.result(1), self.result(0)],
|
||||
[True, True, True, False])
|
||||
self.assertEqual(status, 0)
|
||||
self.assertEqual(run.call_args.args[0], ["sudo", "-n", "umount", "-l", "--", TARGET])
|
||||
|
||||
def test_cleanup_fails_when_stale_mount_remains(self):
|
||||
status, run, _, rmtree = self.run_cleanup(
|
||||
[self.result(errno.ENOTCONN), self.result(1), self.result(1), self.result(1)])
|
||||
self.assertEqual(status, 1)
|
||||
self.assertEqual(run.call_count, 4)
|
||||
rmtree.assert_not_called()
|
||||
|
||||
def test_unmounted_test_dir_is_reclaimed(self):
|
||||
status, _, _, rmtree = self.run_cleanup(
|
||||
[self.result(errno.ENOTCONN), self.result(0)], [True, False])
|
||||
self.assertEqual(status, 0)
|
||||
rmtree.assert_called_once_with(Path(TARGET).parent, ignore_errors=True)
|
||||
|
||||
def test_probe_process_reports_errno(self):
|
||||
for target, expected in ((str(Path(__file__)), 0), (str(Path(__file__) / "absent"), errno.ENOTDIR)):
|
||||
with self.subTest(target=target):
|
||||
result = subprocess.run([cleanup.sys.executable, cleanup.__file__, "--probe", target], check=False)
|
||||
self.assertEqual(result.returncode, expected)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -23,14 +23,8 @@ runs:
|
||||
|
||||
bin=$(command -v fusermount3 || true)
|
||||
if [ -z "$bin" ]; then
|
||||
# Self-hosted runners are not guaranteed to carry fuse3.
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y fuse3
|
||||
bin=$(command -v fusermount3 || true)
|
||||
if [ -z "$bin" ]; then
|
||||
echo "no fusermount3 in PATH after installing fuse3" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "no fusermount3 in PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
if can_mount "$bin"; then
|
||||
ls -l "$bin"
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
name: "actions: unit tests"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- '.github/actions/**'
|
||||
- '.github/workflows/action-tests.yml'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- '.github/actions/**'
|
||||
- '.github/workflows/action-tests.yml'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.event_name == 'push' && github.ref) || github.run_id }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
cleanup-stale-fuse-mounts:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Run cleanup action unit tests
|
||||
run: python3 .github/actions/cleanup-stale-fuse-mounts/test_cleanup.py
|
||||
@@ -25,15 +25,9 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: ${{ runner.environment == 'github-hosted' }}
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v4.39.1
|
||||
uses: github/codeql-action/init@v4.39.0
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
with:
|
||||
languages: go
|
||||
@@ -41,7 +35,7 @@ jobs:
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below).
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v4.39.1
|
||||
uses: github/codeql-action/autobuild@v4.39.0
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
@@ -55,4 +49,4 @@ jobs:
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v4.39.1
|
||||
uses: github/codeql-action/analyze@v4.39.0
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
|
||||
# ── Pre-build the Rust binaries natively ────────────────────────────
|
||||
build-rust-binaries:
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
@@ -44,12 +44,7 @@ jobs:
|
||||
|
||||
- name: Install musl tools (amd64)
|
||||
if: ${{ !matrix.cross }}
|
||||
run: |
|
||||
sudo apt-get install -y musl-tools
|
||||
# C deps (aws-lc-sys) must compile against musl headers, not the host
|
||||
# gcc's glibc headers — glibc's C23 redirects (__isoc23_sscanf,
|
||||
# __isoc23_strtol) don't exist in musl and fail the link.
|
||||
echo "CC_x86_64_unknown_linux_musl=musl-gcc" >> "$GITHUB_ENV"
|
||||
run: sudo apt-get install -y musl-tools
|
||||
|
||||
- name: Install cross-compilation tools (arm64)
|
||||
if: matrix.cross
|
||||
@@ -58,31 +53,6 @@ jobs:
|
||||
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
|
||||
# Disable glibc fortify source — its __memcpy_chk etc. symbols don't exist in musl
|
||||
echo "CFLAGS_aarch64_unknown_linux_musl=-U_FORTIFY_SOURCE" >> "$GITHUB_ENV"
|
||||
# aws-lc-sys compiles against glibc headers, which redirect
|
||||
# sscanf/strtol to C23 __isoc23_* symbols musl does not provide.
|
||||
# Link a tiny forwarding shim so those references resolve to the
|
||||
# musl implementations. Prototypes are declared manually: including
|
||||
# glibc headers here would re-redirect the calls back to __isoc23_*.
|
||||
cat > /tmp/isoc23-shim.c <<'SHIM'
|
||||
#include <stdarg.h>
|
||||
extern int vsscanf(const char *s, const char *fmt, va_list ap);
|
||||
extern long strtol(const char *nptr, char **endptr, int base);
|
||||
int __isoc23_sscanf(const char *s, const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
int r = vsscanf(s, fmt, ap);
|
||||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
long __isoc23_strtol(const char *nptr, char **endptr, int base) {
|
||||
return strtol(nptr, endptr, base);
|
||||
}
|
||||
SHIM
|
||||
aarch64-linux-gnu-gcc -O2 -c /tmp/isoc23-shim.c -o /tmp/isoc23-shim.o
|
||||
# link-args land after libc on the link line; rescan musl libc so
|
||||
# the shim's own vsscanf/strtol references resolve, and libgcc for
|
||||
# the fp128 builtins musl's vfscanf/floatscan pull in on aarch64.
|
||||
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS=-Clink-arg=/tmp/isoc23-shim.o -Clink-arg=-lc -Clink-arg=-lgcc" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Cache cargo registry and target
|
||||
if: runner.environment == 'github-hosted'
|
||||
@@ -205,14 +175,14 @@ jobs:
|
||||
|
||||
- name: Login to Docker Hub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v4.7.0
|
||||
uses: docker/login-action@v4.6.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Login to GHCR
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v4.7.0
|
||||
uses: docker/login-action@v4.6.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ secrets.GHCR_USERNAME }}
|
||||
|
||||
@@ -141,7 +141,7 @@ jobs:
|
||||
|
||||
- name: Login to Docker Hub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v4.7.0
|
||||
uses: docker/login-action@v4.6.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
@@ -66,7 +66,7 @@ jobs:
|
||||
|
||||
# ── Pre-build the Rust binaries natively ────────────────────────────
|
||||
build-rust-binaries:
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
@@ -88,12 +88,7 @@ jobs:
|
||||
|
||||
- name: Install musl tools (amd64)
|
||||
if: ${{ !matrix.cross }}
|
||||
run: |
|
||||
sudo apt-get install -y musl-tools
|
||||
# C deps (aws-lc-sys) must compile against musl headers, not the host
|
||||
# gcc's glibc headers — glibc's C23 redirects (__isoc23_sscanf,
|
||||
# __isoc23_strtol) don't exist in musl and fail the link.
|
||||
echo "CC_x86_64_unknown_linux_musl=musl-gcc" >> "$GITHUB_ENV"
|
||||
run: sudo apt-get install -y musl-tools
|
||||
|
||||
- name: Install cross-compilation tools (arm64)
|
||||
if: matrix.cross
|
||||
@@ -102,31 +97,6 @@ jobs:
|
||||
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
|
||||
# Disable glibc fortify source — its __memcpy_chk etc. symbols don't exist in musl
|
||||
echo "CFLAGS_aarch64_unknown_linux_musl=-U_FORTIFY_SOURCE" >> "$GITHUB_ENV"
|
||||
# aws-lc-sys compiles against glibc headers, which redirect
|
||||
# sscanf/strtol to C23 __isoc23_* symbols musl does not provide.
|
||||
# Link a tiny forwarding shim so those references resolve to the
|
||||
# musl implementations. Prototypes are declared manually: including
|
||||
# glibc headers here would re-redirect the calls back to __isoc23_*.
|
||||
cat > /tmp/isoc23-shim.c <<'SHIM'
|
||||
#include <stdarg.h>
|
||||
extern int vsscanf(const char *s, const char *fmt, va_list ap);
|
||||
extern long strtol(const char *nptr, char **endptr, int base);
|
||||
int __isoc23_sscanf(const char *s, const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
int r = vsscanf(s, fmt, ap);
|
||||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
long __isoc23_strtol(const char *nptr, char **endptr, int base) {
|
||||
return strtol(nptr, endptr, base);
|
||||
}
|
||||
SHIM
|
||||
aarch64-linux-gnu-gcc -O2 -c /tmp/isoc23-shim.c -o /tmp/isoc23-shim.o
|
||||
# link-args land after libc on the link line; rescan musl libc so
|
||||
# the shim's own vsscanf/strtol references resolve, and libgcc for
|
||||
# the fp128 builtins musl's vfscanf/floatscan pull in on aarch64.
|
||||
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS=-Clink-arg=/tmp/isoc23-shim.o -Clink-arg=-lc -Clink-arg=-lgcc" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Cache cargo registry and target
|
||||
if: runner.environment == 'github-hosted'
|
||||
@@ -200,13 +170,10 @@ jobs:
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.source_ref || github.ref }}
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Free Disk Space
|
||||
run: |
|
||||
echo "Available disk space before cleanup:"
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
# Remove pre-installed tools
|
||||
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
|
||||
# Clean package managers
|
||||
@@ -218,7 +185,7 @@ jobs:
|
||||
[ -d ~/.cache/go-build ] && rm -rf ~/.cache/go-build || true
|
||||
[ -d /go/pkg ] && rm -rf /go/pkg || true
|
||||
echo "Available disk space after cleanup:"
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
|
||||
- name: Configure variant
|
||||
id: config
|
||||
@@ -289,13 +256,13 @@ jobs:
|
||||
buildkitd-config: /tmp/buildkitd.toml
|
||||
- name: Login to Docker Hub
|
||||
if: needs.setup.outputs.publish == 'true'
|
||||
uses: docker/login-action@v4.7.0
|
||||
uses: docker/login-action@v4.6.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Login to GHCR
|
||||
if: needs.setup.outputs.publish == 'true'
|
||||
uses: docker/login-action@v4.7.0
|
||||
uses: docker/login-action@v4.6.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ secrets.GHCR_USERNAME }}
|
||||
@@ -343,7 +310,7 @@ jobs:
|
||||
fi
|
||||
- name: Login to GHCR
|
||||
if: needs.setup.outputs.publish == 'true'
|
||||
uses: docker/login-action@v4.7.0
|
||||
uses: docker/login-action@v4.6.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ secrets.GHCR_USERNAME }}
|
||||
@@ -444,7 +411,7 @@ jobs:
|
||||
output: trivy-results.sarif
|
||||
exit-code: '0'
|
||||
- name: Upload Trivy scan results to GitHub Security
|
||||
uses: github/codeql-action/upload-sarif@v4.39.1
|
||||
uses: github/codeql-action/upload-sarif@v4.39.0
|
||||
if: always()
|
||||
with:
|
||||
sarif_file: trivy-results.sarif
|
||||
@@ -511,12 +478,12 @@ jobs:
|
||||
ghcr.io/chrislusf/seaweedfs
|
||||
tags: type=raw,value=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.image_tag || 'latest' }},suffix=${{ steps.config.outputs.tag_suffix }}
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v4.7.0
|
||||
uses: docker/login-action@v4.6.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v4.7.0
|
||||
uses: docker/login-action@v4.6.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ secrets.GHCR_USERNAME }}
|
||||
|
||||
@@ -58,7 +58,7 @@ jobs:
|
||||
-
|
||||
name: Login to Docker Hub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v4.7.0
|
||||
uses: docker/login-action@v4.6.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
@@ -25,7 +25,7 @@ on:
|
||||
rocksdb_version:
|
||||
description: 'RocksDB git tag to use when variant=rocksdb'
|
||||
required: false
|
||||
default: 'v11.1.2'
|
||||
default: 'v10.10.1'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
# amd64 and arm64 without QEMU, turning a 5-hour emulated cargo build into
|
||||
# ~15 minutes of native compilation.
|
||||
build-rust-binaries:
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
@@ -67,12 +67,7 @@ jobs:
|
||||
|
||||
- name: Install musl tools (amd64)
|
||||
if: ${{ !matrix.cross }}
|
||||
run: |
|
||||
sudo apt-get install -y musl-tools
|
||||
# C deps (aws-lc-sys) must compile against musl headers, not the host
|
||||
# gcc's glibc headers — glibc's C23 redirects (__isoc23_sscanf,
|
||||
# __isoc23_strtol) don't exist in musl and fail the link.
|
||||
echo "CC_x86_64_unknown_linux_musl=musl-gcc" >> "$GITHUB_ENV"
|
||||
run: sudo apt-get install -y musl-tools
|
||||
|
||||
- name: Install cross-compilation tools (arm64)
|
||||
if: matrix.cross
|
||||
@@ -81,31 +76,6 @@ jobs:
|
||||
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
|
||||
# Disable glibc fortify source — its __memcpy_chk etc. symbols don't exist in musl
|
||||
echo "CFLAGS_aarch64_unknown_linux_musl=-U_FORTIFY_SOURCE" >> "$GITHUB_ENV"
|
||||
# aws-lc-sys compiles against glibc headers, which redirect
|
||||
# sscanf/strtol to C23 __isoc23_* symbols musl does not provide.
|
||||
# Link a tiny forwarding shim so those references resolve to the
|
||||
# musl implementations. Prototypes are declared manually: including
|
||||
# glibc headers here would re-redirect the calls back to __isoc23_*.
|
||||
cat > /tmp/isoc23-shim.c <<'SHIM'
|
||||
#include <stdarg.h>
|
||||
extern int vsscanf(const char *s, const char *fmt, va_list ap);
|
||||
extern long strtol(const char *nptr, char **endptr, int base);
|
||||
int __isoc23_sscanf(const char *s, const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
int r = vsscanf(s, fmt, ap);
|
||||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
long __isoc23_strtol(const char *nptr, char **endptr, int base) {
|
||||
return strtol(nptr, endptr, base);
|
||||
}
|
||||
SHIM
|
||||
aarch64-linux-gnu-gcc -O2 -c /tmp/isoc23-shim.c -o /tmp/isoc23-shim.o
|
||||
# link-args land after libc on the link line; rescan musl libc so
|
||||
# the shim's own vsscanf/strtol references resolve, and libgcc for
|
||||
# the fp128 builtins musl's vfscanf/floatscan pull in on aarch64.
|
||||
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS=-Clink-arg=/tmp/isoc23-shim.o -Clink-arg=-lc -Clink-arg=-lgcc" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Cache cargo registry and target
|
||||
if: runner.environment == 'github-hosted'
|
||||
@@ -210,10 +180,6 @@ jobs:
|
||||
if: github.event_name != 'workflow_dispatch' || github.event.inputs.variant == 'all' || github.event.inputs.variant == matrix.variant
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
if: github.event_name != 'workflow_dispatch' || github.event.inputs.variant == 'all' || github.event.inputs.variant == matrix.variant
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Download pre-built Rust binaries
|
||||
if: github.event_name != 'workflow_dispatch' || github.event.inputs.variant == 'all' || github.event.inputs.variant == matrix.variant
|
||||
uses: actions/download-artifact@v8
|
||||
@@ -253,7 +219,7 @@ jobs:
|
||||
sudo docker system prune -af --volumes
|
||||
[ -d ~/.cache/go-build ] && rm -rf ~/.cache/go-build || true
|
||||
[ -d /go/pkg ] && rm -rf /go/pkg || true
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
|
||||
- name: Docker meta
|
||||
if: github.event_name != 'workflow_dispatch' || github.event.inputs.variant == 'all' || github.event.inputs.variant == matrix.variant
|
||||
@@ -288,7 +254,7 @@ jobs:
|
||||
|
||||
- name: Login to GHCR
|
||||
if: github.event_name != 'workflow_dispatch' || github.event.inputs.variant == 'all' || github.event.inputs.variant == matrix.variant
|
||||
uses: docker/login-action@v4.7.0
|
||||
uses: docker/login-action@v4.6.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ secrets.GHCR_USERNAME }}
|
||||
@@ -305,11 +271,8 @@ jobs:
|
||||
file: ${{ matrix.dockerfile }}
|
||||
platforms: ${{ matrix.platform }}
|
||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||
# mode=max keeps resolvedDependencies complete and records the
|
||||
# builder identity; attestations ride inside each pushed index and
|
||||
# survive the imagetools merge into the multi-arch manifest.
|
||||
provenance: mode=max
|
||||
sbom: true
|
||||
# Flat single-platform manifest so imagetools create assembles cleanly.
|
||||
provenance: false
|
||||
outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
||||
cache-from: type=gha,scope=${{ matrix.variant }}-${{ matrix.arch }}
|
||||
# max only for rocksdb: its RocksDB compile is sha-independent and worth
|
||||
@@ -319,7 +282,7 @@ jobs:
|
||||
${{ matrix.build_args }}
|
||||
BUILDKIT_INLINE_CACHE=1
|
||||
BRANCH=${{ github.sha }}
|
||||
${{ matrix.variant == 'rocksdb' && format('ROCKSDB_VERSION={0}', github.event.inputs.rocksdb_version || 'v11.1.2') || '' }}
|
||||
${{ matrix.variant == 'rocksdb' && format('ROCKSDB_VERSION={0}', github.event.inputs.rocksdb_version || 'v10.10.1') || '' }}
|
||||
|
||||
- name: Export digest
|
||||
if: github.event_name != 'workflow_dispatch' || github.event.inputs.variant == 'all' || github.event.inputs.variant == matrix.variant
|
||||
@@ -345,8 +308,6 @@ jobs:
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
attestations: write
|
||||
packages: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -378,7 +339,7 @@ jobs:
|
||||
|
||||
- name: Login to GHCR
|
||||
if: github.event_name != 'workflow_dispatch' || github.event.inputs.variant == 'all' || github.event.inputs.variant == matrix.variant
|
||||
uses: docker/login-action@v4.7.0
|
||||
uses: docker/login-action@v4.6.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ secrets.GHCR_USERNAME }}
|
||||
@@ -400,7 +361,7 @@ jobs:
|
||||
|
||||
- name: Login to Docker Hub
|
||||
if: github.event_name != 'workflow_dispatch' || github.event.inputs.variant == 'all' || github.event.inputs.variant == matrix.variant
|
||||
uses: docker/login-action@v4.7.0
|
||||
uses: docker/login-action@v4.6.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
@@ -454,45 +415,6 @@ jobs:
|
||||
${{ env.IMAGE }}@${{ steps.manifest.outputs.digest }}
|
||||
chrislusf/seaweedfs@${{ steps.manifest.outputs.digest }}
|
||||
|
||||
# Attest the merged multi-arch digest itself, so digest-pinning consumers
|
||||
# can verify provenance against the exact index they pull. Both steps
|
||||
# reuse the GHCR login above and push as OCI referrers.
|
||||
- name: Attest build provenance for ${{ matrix.variant }}
|
||||
if: github.event_name != 'workflow_dispatch' || github.event.inputs.variant == 'all' || github.event.inputs.variant == matrix.variant
|
||||
uses: actions/attest-build-provenance@v4
|
||||
with:
|
||||
subject-name: ${{ env.IMAGE }}
|
||||
subject-digest: ${{ steps.manifest.outputs.digest }}
|
||||
push-to-registry: true
|
||||
|
||||
# SBOMs are generated and attested per platform manifest: an index-wide
|
||||
# scan only describes syft's default platform, while the manifests it
|
||||
# merges differ (some ship the real binary, others placeholders), so the
|
||||
# SBOM has to be bound to the platform digest a consumer actually pulls.
|
||||
- name: Install syft
|
||||
if: github.event_name != 'workflow_dispatch' || github.event.inputs.variant == 'all' || github.event.inputs.variant == matrix.variant
|
||||
uses: anchore/sbom-action/download-syft@v0
|
||||
|
||||
- name: Attest per-platform SBOMs for ${{ matrix.variant }}
|
||||
if: github.event_name != 'workflow_dispatch' || github.event.inputs.variant == 'all' || github.event.inputs.variant == matrix.variant
|
||||
working-directory: /tmp/digests
|
||||
run: |
|
||||
set -euo pipefail
|
||||
for f in *; do
|
||||
# Each saved digest is an OCI index (image + attestation manifests);
|
||||
# scan and attest the image manifest a same-platform pull resolves.
|
||||
ref="${{ env.IMAGE }}@sha256:${f}"
|
||||
image=$(crane manifest "$ref" | jq -r '
|
||||
[.manifests[]? | select((.annotations["vnd.docker.reference.type"] // "") != "attestation-manifest"
|
||||
and (.platform.os // "unknown") != "unknown") | .digest][0] // empty')
|
||||
ref="${{ env.IMAGE }}@${image:-sha256:${f}}"
|
||||
syft "registry:${ref}" -o "spdx-json=/tmp/sbom-${f}.spdx.json"
|
||||
cosign attest --yes \
|
||||
--predicate "/tmp/sbom-${f}.spdx.json" \
|
||||
--type spdxjson \
|
||||
"$ref"
|
||||
done
|
||||
|
||||
# Report-only trivy scan: uploads fixable HIGH/CRITICAL findings to GitHub
|
||||
# Security for visibility, but never blocks the release. Releases (including
|
||||
# `latest`) ship regardless — vulnerabilities are tracked, not gated, since
|
||||
@@ -513,7 +435,7 @@ jobs:
|
||||
variant: large_disk
|
||||
steps:
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v4.7.0
|
||||
uses: docker/login-action@v4.6.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ secrets.GHCR_USERNAME }}
|
||||
@@ -531,9 +453,7 @@ jobs:
|
||||
scanners: vuln
|
||||
vuln-type: os,library
|
||||
severity: HIGH,CRITICAL
|
||||
# Keep unfixed findings in the report so digest-pinning consumers see
|
||||
# the complete picture, not just what a patch could resolve.
|
||||
ignore-unfixed: false
|
||||
ignore-unfixed: true
|
||||
limit-severities-for-sarif: true
|
||||
format: sarif
|
||||
output: trivy-results.sarif
|
||||
@@ -541,7 +461,7 @@ jobs:
|
||||
|
||||
- name: Upload Trivy scan results to GitHub Security
|
||||
if: always()
|
||||
uses: github/codeql-action/upload-sarif@v4.39.1
|
||||
uses: github/codeql-action/upload-sarif@v4.39.0
|
||||
with:
|
||||
sarif_file: trivy-results.sarif
|
||||
category: trivy-${{ matrix.variant }}
|
||||
@@ -565,13 +485,13 @@ jobs:
|
||||
latest_tag: latest_large_disk
|
||||
steps:
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v4.7.0
|
||||
uses: docker/login-action@v4.6.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v4.7.0
|
||||
uses: docker/login-action@v4.6.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ secrets.GHCR_USERNAME }}
|
||||
|
||||
@@ -4,9 +4,9 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
rocksdb_version:
|
||||
description: 'RocksDB git tag or branch to build (e.g. v11.1.2)'
|
||||
description: 'RocksDB git tag or branch to build (e.g. v10.10.1)'
|
||||
required: true
|
||||
default: 'v11.1.2'
|
||||
default: 'v10.10.1'
|
||||
seaweedfs_ref:
|
||||
description: 'SeaweedFS git tag, branch, or commit to build'
|
||||
required: true
|
||||
@@ -90,13 +90,13 @@ jobs:
|
||||
echo "seaweedfs_ref=$seaweed" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
|
||||
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
||||
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v1
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0
|
||||
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
@@ -32,7 +32,7 @@ defaults:
|
||||
jobs:
|
||||
e2e:
|
||||
name: FUSE Mount
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
|
||||
@@ -28,7 +28,7 @@ permissions:
|
||||
jobs:
|
||||
ec-integration-tests:
|
||||
name: EC Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: Set up Go 1.x
|
||||
|
||||
@@ -28,7 +28,7 @@ permissions:
|
||||
jobs:
|
||||
fuse-dlm-integration:
|
||||
name: FUSE DLM Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
|
||||
@@ -33,7 +33,7 @@ permissions:
|
||||
jobs:
|
||||
fuse-failover:
|
||||
name: FUSE Volume Server Failover
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 40
|
||||
|
||||
steps:
|
||||
@@ -42,9 +42,6 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
|
||||
@@ -26,7 +26,7 @@ permissions:
|
||||
jobs:
|
||||
fuse-integration:
|
||||
name: FUSE Integration Testing
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 50
|
||||
|
||||
steps:
|
||||
|
||||
@@ -34,16 +34,13 @@ permissions:
|
||||
jobs:
|
||||
fuse-p2p-integration:
|
||||
name: FUSE P2P Peer Chunk Sharing
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
|
||||
@@ -560,7 +560,7 @@ jobs:
|
||||
print("cluster alias: hook waits on the renamed names and the chart's addresses")
|
||||
|
||||
# Keys kept in a Secret are referenced, not inlined, so the hook
|
||||
# must render valueFrom for map-valued extraEnvironmentVars.
|
||||
# must render valueFrom for non-string extraEnvironmentVars.
|
||||
out = render(dict(jwt, **{
|
||||
"global.seaweedfs.extraEnvironmentVars.WEED_JWT_FILER_SIGNING_KEY.secretKeyRef.name": "signing-keys",
|
||||
"global.seaweedfs.extraEnvironmentVars.WEED_JWT_FILER_SIGNING_KEY.secretKeyRef.key": "filerWrite",
|
||||
@@ -636,47 +636,12 @@ jobs:
|
||||
--set filer.secretExtraEnvironmentVars.WEED_MYSQL_PASSWORD.secretKeyRef.name=db \
|
||||
--set filer.secretExtraEnvironmentVars.WEED_MYSQL_PASSWORD.secretKeyRef.key=password > /tmp/filer-mysql-on-secret.yaml
|
||||
grep -A 4 -- "- name: WEED_MYSQL_PASSWORD$" /tmp/filer-mysql-on-secret.yaml | grep -q "name: db"
|
||||
# It replaces the db secret's entry rather than adding a second one, which
|
||||
# Helm 4's server-side apply rejects as a duplicate.
|
||||
test "$(grep -c -- "- name: WEED_MYSQL_PASSWORD$" /tmp/filer-mysql-on-secret.yaml)" -eq 1
|
||||
test "$(grep -c -- "- name: WEED_MYSQL_USERNAME$" /tmp/filer-mysql-on-secret.yaml)" -eq 1
|
||||
helm template test $CHART_DIR \
|
||||
--set-string filer.extraEnvironmentVars.WEED_MYSQL_ENABLED=true \
|
||||
--set-string filer.extraEnvironmentVars.WEED_MYSQL_USERNAME=app > /tmp/filer-mysql-on-plain.yaml
|
||||
test "$(grep -c -- "- name: WEED_MYSQL_USERNAME$" /tmp/filer-mysql-on-plain.yaml)" -eq 1
|
||||
grep -A 1 -- "- name: WEED_MYSQL_USERNAME$" /tmp/filer-mysql-on-plain.yaml | grep -q 'value: "app"'
|
||||
# Credentials render ahead of the merged vars so a $(...) reference resolves.
|
||||
helm template test $CHART_DIR \
|
||||
--set-string filer.extraEnvironmentVars.WEED_MYSQL_ENABLED=true \
|
||||
--set-string filer.extraEnvironmentVars.WEED_MYSQL_USERNAME=app \
|
||||
--set-string 'filer.extraEnvironmentVars.WEED_MYSQL_DSN=$(WEED_MYSQL_USERNAME)@tcp(h)/db' > /tmp/filer-mysql-dsn.yaml
|
||||
test "$(grep -n -- "- name: WEED_MYSQL_USERNAME$" /tmp/filer-mysql-dsn.yaml | cut -d: -f1)" -lt "$(grep -n -- "- name: WEED_MYSQL_DSN$" /tmp/filer-mysql-dsn.yaml | cut -d: -f1)"
|
||||
# Vars a credential's own $(...) references point at render before it.
|
||||
helm template test $CHART_DIR \
|
||||
--set-string filer.extraEnvironmentVars.WEED_MYSQL_ENABLED=true \
|
||||
--set-string filer.extraEnvironmentVars.DB_USER=app \
|
||||
--set-string 'filer.extraEnvironmentVars.WEED_MYSQL_USERNAME=$(DB_USER)' > /tmp/filer-mysql-ref.yaml
|
||||
test "$(grep -n -- "- name: DB_USER$" /tmp/filer-mysql-ref.yaml | cut -d: -f1)" -lt "$(grep -n -- "- name: WEED_MYSQL_USERNAME$" /tmp/filer-mysql-ref.yaml | cut -d: -f1)"
|
||||
helm template test $CHART_DIR \
|
||||
--set-string filer.extraEnvironmentVars.WEED_MYSQL_ENABLED=true \
|
||||
--set filer.secretExtraEnvironmentVars.DB_USER.secretKeyRef.name=db \
|
||||
--set filer.secretExtraEnvironmentVars.DB_USER.secretKeyRef.key=user \
|
||||
--set-string 'filer.extraEnvironmentVars.WEED_MYSQL_USERNAME=$(DB_USER)' > /tmp/filer-mysql-ref-secret.yaml
|
||||
test "$(grep -c -- "- name: DB_USER$" /tmp/filer-mysql-ref-secret.yaml)" -eq 1
|
||||
test "$(grep -n -- "- name: DB_USER$" /tmp/filer-mysql-ref-secret.yaml | cut -d: -f1)" -lt "$(grep -n -- "- name: WEED_MYSQL_USERNAME$" /tmp/filer-mysql-ref-secret.yaml | cut -d: -f1)"
|
||||
# A flag the chart cannot read counts as selected, not as off.
|
||||
helm template test $CHART_DIR \
|
||||
--set filer.secretExtraEnvironmentVars.WEED_MYSQL_ENABLED.secretKeyRef.name=store \
|
||||
--set filer.secretExtraEnvironmentVars.WEED_MYSQL_ENABLED.secretKeyRef.key=enabled > /tmp/filer-mysql-secret.yaml
|
||||
grep -q "name: test-seaweedfs-db-secret" /tmp/filer-mysql-secret.yaml
|
||||
grep -q "name: WEED_MYSQL_HOSTNAME" /tmp/filer-mysql-secret.yaml
|
||||
# A secret-backed key also replaces the matching plain entry, not adds one.
|
||||
test "$(grep -c -- "- name: WEED_MYSQL_ENABLED$" /tmp/filer-mysql-secret.yaml)" -eq 1
|
||||
helm template test $CHART_DIR \
|
||||
--set-string filer.extraEnvironmentVars.WEED_MYSQL_ENABLED=true \
|
||||
--set filer.secretExtraEnvironmentVars.WEED_MYSQL_HOSTNAME.secretKeyRef.name=db \
|
||||
--set filer.secretExtraEnvironmentVars.WEED_MYSQL_HOSTNAME.secretKeyRef.key=host > /tmp/filer-mysql-hostname-secret.yaml
|
||||
test "$(grep -c -- "- name: WEED_MYSQL_HOSTNAME$" /tmp/filer-mysql-hostname-secret.yaml)" -eq 1
|
||||
helm template test $CHART_DIR \
|
||||
--set-string filer.extraEnvironmentVars.WEED_MYSQL2_HOSTNAME=other > /tmp/filer-mysql2.yaml
|
||||
grep -q "name: WEED_MYSQL2_HOSTNAME" /tmp/filer-mysql2.yaml
|
||||
@@ -1259,43 +1224,6 @@ jobs:
|
||||
print("all-in-one env: shared key renders once, component value wins")
|
||||
PYEOF
|
||||
|
||||
echo "=== Testing extraEnvironmentVars: numbers and booleans render as values ==="
|
||||
# Only a string rendered as value; anything else went to valueFrom, so an
|
||||
# unquoted 3306 or true in a values file (or --set) became "valueFrom: 3306"
|
||||
# and the API server rejected the workload. A map still renders valueFrom,
|
||||
# and a null still renders an empty variable. --set-json decodes numbers as
|
||||
# float64, as values files do, which quote would print as 1e+06.
|
||||
helm template test $CHART_DIR \
|
||||
--set-json global.seaweedfs.extraEnvironmentVars.WEED_GLOBAL_INT=1000000 \
|
||||
--set master.extraEnvironmentVars.WEED_MASTER_VOLUME_GROWTH_COPY_1=7 \
|
||||
--set master.extraEnvironmentVars.WEED_EMPTY=null \
|
||||
--set filer.extraEnvironmentVars.WEED_MYSQL_ENABLED=true \
|
||||
--set filer.extraEnvironmentVars.WEED_MYSQL_PORT=3306 \
|
||||
--set filer.extraEnvironmentVars.WEED_REF.secretKeyRef.name=s \
|
||||
--set filer.extraEnvironmentVars.WEED_REF.secretKeyRef.key=k > /tmp/env-scalars.yaml
|
||||
python3 - /tmp/env-scalars.yaml <<'PYEOF'
|
||||
import sys, yaml
|
||||
docs = [d for d in yaml.safe_load_all(open(sys.argv[1])) if d]
|
||||
def env(suffix):
|
||||
sts = next(d for d in docs if d.get("kind") == "StatefulSet"
|
||||
and d["metadata"]["name"].endswith(suffix))
|
||||
return {e["name"]: e for e in sts["spec"]["template"]["spec"]["containers"][0]["env"]}
|
||||
master, filer = env("-master"), env("-filer")
|
||||
want = [(master, "WEED_MASTER_VOLUME_GROWTH_COPY_1", "7"), (master, "WEED_GLOBAL_INT", "1000000"),
|
||||
(filer, "WEED_MYSQL_ENABLED", "true"), (filer, "WEED_MYSQL_PORT", "3306"),
|
||||
(filer, "WEED_GLOBAL_INT", "1000000")]
|
||||
failed = [f"{name}: {e.get(name)}" for e, name, value in want
|
||||
if e.get(name) != {"name": name, "value": value}]
|
||||
if master.get("WEED_EMPTY") != {"name": "WEED_EMPTY"}:
|
||||
failed.append(f"WEED_EMPTY: {master.get('WEED_EMPTY')}")
|
||||
if filer.get("WEED_REF", {}).get("valueFrom") != {"secretKeyRef": {"name": "s", "key": "k"}}:
|
||||
failed.append(f"WEED_REF: {filer.get('WEED_REF')}")
|
||||
if failed:
|
||||
print("FAIL: extraEnvironmentVars rendered wrong:", *failed, sep="\n ", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
print("extraEnvironmentVars: numbers and booleans render as values, a map as valueFrom, a null as empty")
|
||||
PYEOF
|
||||
|
||||
echo "=== Testing bucket versioning: YAML bool false suspends like string \"false\" ==="
|
||||
# bool false used to be a silent no-op while string "false" suspended.
|
||||
BOOL_FALSE=$(helm template test $CHART_DIR \
|
||||
@@ -2069,38 +1997,6 @@ jobs:
|
||||
kubectl delete namespace "$NS"
|
||||
echo "SFTP host key lifecycle tests passed"
|
||||
|
||||
- name: Verify the filer db secret survives uninstall and install
|
||||
run: |
|
||||
set -e
|
||||
CHART_DIR="k8s/charts/seaweedfs"
|
||||
NS="filer-db-secret"
|
||||
SECRET="db-seaweedfs-db-secret"
|
||||
DB_ARGS="--set image.tag=$IMAGE_TAG --set-string filer.extraEnvironmentVars.WEED_MYSQL_ENABLED=true --set master.enabled=false --set volume.enabled=false"
|
||||
kubectl create namespace "$NS"
|
||||
|
||||
echo "=== install generates the db credentials ==="
|
||||
helm install db $CHART_DIR -n "$NS" $DB_ARGS
|
||||
[ "$(kubectl get secret "$SECRET" -n "$NS" -o jsonpath='{.data.user}' | base64 -d)" = YourSWUser ] \
|
||||
|| { echo "FAIL: install did not create the default user"; exit 1; }
|
||||
[ "$(kubectl get secret "$SECRET" -n "$NS" -o jsonpath='{.data.password}' | base64 -d | wc -c)" -eq 32 ] \
|
||||
|| { echo "FAIL: install did not generate a 32-character password"; exit 1; }
|
||||
|
||||
echo "=== credentials in the kept Secret survive uninstall and install ==="
|
||||
PASSWORD='p"a\ss: #x {{ .Values }}'
|
||||
kubectl patch secret "$SECRET" -n "$NS" --type merge \
|
||||
-p "$(jq -n --arg p "$PASSWORD" '{stringData: {user: "seaweed_app", password: $p}}')"
|
||||
helm uninstall db -n "$NS"
|
||||
kubectl get secret "$SECRET" -n "$NS" >/dev/null || { echo "FAIL: uninstall removed the db secret"; exit 1; }
|
||||
helm install db $CHART_DIR -n "$NS" $DB_ARGS
|
||||
[ "$(kubectl get secret "$SECRET" -n "$NS" -o jsonpath='{.data.user}' | base64 -d)" = seaweed_app ] \
|
||||
|| { echo "FAIL: reinstall reset the db user"; exit 1; }
|
||||
[ "$(kubectl get secret "$SECRET" -n "$NS" -o jsonpath='{.data.password}' | base64 -d)" = "$PASSWORD" ] \
|
||||
|| { echo "FAIL: reinstall replaced the db password"; exit 1; }
|
||||
|
||||
helm uninstall db -n "$NS"
|
||||
kubectl delete namespace "$NS"
|
||||
echo "Filer db secret reinstall test passed"
|
||||
|
||||
- name: Verify JWT signing key persistence across upgrades
|
||||
run: |
|
||||
# chart-testing puts its pip-less venv first on PATH; use setup-python.
|
||||
|
||||
@@ -60,7 +60,6 @@ jobs:
|
||||
# Start SeaweedFS with optimized settings for CI
|
||||
# Include S3 API for s3copier integration tests
|
||||
weed server -dir="$WEED_DATA_DIR" \
|
||||
-ip=127.0.0.1 -ip.bind=127.0.0.1 \
|
||||
-master.raftHashicorp \
|
||||
-master.electionTimeout=1s \
|
||||
-master.volumeSizeLimitMB=100 \
|
||||
|
||||
@@ -32,7 +32,7 @@ defaults:
|
||||
jobs:
|
||||
kms-provider-tests:
|
||||
name: KMS Provider Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
@@ -78,7 +78,7 @@ jobs:
|
||||
|
||||
s3-kms-e2e-tests:
|
||||
name: S3 KMS End-to-End Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 25
|
||||
|
||||
steps:
|
||||
|
||||
@@ -30,7 +30,7 @@ permissions:
|
||||
jobs:
|
||||
master-cold-start-tests:
|
||||
name: Master Cold Start Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Check out code
|
||||
|
||||
@@ -37,7 +37,7 @@ env:
|
||||
jobs:
|
||||
metadata-subscribe-integration:
|
||||
name: Metadata Subscribe Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
|
||||
@@ -30,7 +30,7 @@ permissions:
|
||||
jobs:
|
||||
multi-master-failover-tests:
|
||||
name: Multi-Master Failover Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Check out code
|
||||
|
||||
@@ -27,7 +27,7 @@ permissions:
|
||||
jobs:
|
||||
pjdfstest:
|
||||
name: pjdfstest
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 60
|
||||
|
||||
steps:
|
||||
@@ -41,20 +41,13 @@ jobs:
|
||||
cache: ${{ runner.environment == 'github-hosted' }}
|
||||
|
||||
- name: Start local Docker registry
|
||||
run: |
|
||||
if ! docker start registry 2>/dev/null; then
|
||||
docker rm -f registry >/dev/null 2>&1 || true
|
||||
docker run -d --restart=always -p 5000:5000 --name registry registry:2
|
||||
fi
|
||||
run: docker run -d --restart=always -p 5000:5000 --name registry registry:2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
with:
|
||||
driver-opts: network=host
|
||||
|
||||
- name: Set up Docker Compose
|
||||
uses: docker/setup-compose-action@v2
|
||||
|
||||
- name: Build weed race binary
|
||||
run: |
|
||||
cd docker
|
||||
|
||||
@@ -28,7 +28,7 @@ permissions:
|
||||
jobs:
|
||||
plugin-worker:
|
||||
name: "Plugin Worker: ${{ matrix.worker }}"
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 10
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
||||
@@ -58,9 +58,6 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go ${{ env.GO_VERSION }}
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -396,7 +393,7 @@ jobs:
|
||||
echo "" >> reports/debug/system_info.txt
|
||||
|
||||
echo "Disk Space" >> reports/debug/system_info.txt
|
||||
timeout 15 df -h >> reports/debug/system_info.txt || true
|
||||
df -h >> reports/debug/system_info.txt
|
||||
echo "" >> reports/debug/system_info.txt
|
||||
|
||||
echo "Memory Information" >> reports/debug/system_info.txt
|
||||
@@ -520,7 +517,7 @@ jobs:
|
||||
|
||||
- name: Comment PR with results
|
||||
if: github.event_name == 'pull_request' && always()
|
||||
uses: actions/github-script@v9
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
@@ -755,7 +752,7 @@ jobs:
|
||||
|
||||
- name: Create compliance issue if tests fail
|
||||
if: failure()
|
||||
uses: actions/github-script@v9
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const issue = await github.rest.issues.create({
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
name: "Rust Vector Tests"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- 'seaweed-vector/**'
|
||||
- 'seaweed-worker/**'
|
||||
- 'seaweed-common/**'
|
||||
- 'weed/pb/plugin.proto'
|
||||
- 'weed/pb/vector.proto'
|
||||
- 'weed/pb/vector_pb/**'
|
||||
- 'weed/s3api/**'
|
||||
- 'weed/command/**'
|
||||
- 'test/vectors/**'
|
||||
- '.github/workflows/rust-vector-tests.yml'
|
||||
push:
|
||||
branches: [ master, main ]
|
||||
paths:
|
||||
- 'seaweed-vector/**'
|
||||
- 'seaweed-worker/**'
|
||||
- 'seaweed-common/**'
|
||||
- 'weed/pb/plugin.proto'
|
||||
- 'weed/pb/vector.proto'
|
||||
- 'weed/pb/vector_pb/**'
|
||||
- 'weed/s3api/**'
|
||||
- 'weed/command/**'
|
||||
- 'test/vectors/**'
|
||||
- '.github/workflows/rust-vector-tests.yml'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.event_name == 'push' && github.ref) || github.run_id }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
rust-vector-build:
|
||||
name: Rust Vector Build and Unit Tests
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 45
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Fingerprint build toolchain
|
||||
id: toolchain
|
||||
run: echo "fingerprint=$(getconf GNU_LIBC_VERSION | tr ' ' '-')-rustc-$(rustc -V | awk '{print $2}')" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Cache cargo registry and target
|
||||
if: runner.environment == 'github-hosted'
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
seaweed-vector/target/release
|
||||
key: rust-vector-${{ steps.toolchain.outputs.fingerprint }}-${{ hashFiles('seaweed-vector/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
rust-vector-${{ steps.toolchain.outputs.fingerprint }}-
|
||||
|
||||
# lance's build scripts compile their own protos and look for a protoc.
|
||||
# Point them at the one protoc-bin-vendored ships, so no job depends on a
|
||||
# system package and every build sees the same version.
|
||||
- name: Use the vendored protoc
|
||||
run: |
|
||||
cd seaweed-vector
|
||||
cargo fetch
|
||||
version=$(awk '/^name = "protoc-bin-vendored-linux-x86_64"$/{found=1; next} found && /^version = /{gsub(/"/,"",$3); print $3; exit}' Cargo.lock)
|
||||
test -n "$version" || { echo "protoc-bin-vendored-linux-x86_64 is not in Cargo.lock" >&2; exit 1; }
|
||||
protoc=$(find ~/.cargo/registry/src -path "*protoc-bin-vendored-linux-x86_64-$version/bin/protoc" | head -1)
|
||||
test -x "$protoc" || { echo "no vendored protoc $version in the registry" >&2; exit 1; }
|
||||
echo "PROTOC=$protoc" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build the vector crates
|
||||
run: cd seaweed-vector && cargo build --release
|
||||
|
||||
- name: Run unit tests
|
||||
run: cd seaweed-vector && cargo test --release --workspace
|
||||
|
||||
|
||||
vectors-e2e:
|
||||
name: S3 Vectors End-to-End
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- name: Build weed
|
||||
run: go build -o test/vectors/weed ./weed
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
# Same as the unit-test job: lance's build scripts need a protoc; use
|
||||
# the vendored one so no system package is required.
|
||||
- name: Use the vendored protoc
|
||||
run: |
|
||||
cd seaweed-vector
|
||||
cargo fetch
|
||||
version=$(awk '/^name = "protoc-bin-vendored-linux-x86_64"$/{found=1; next} found && /^version = /{gsub(/"/,"",$3); print $3; exit}' Cargo.lock)
|
||||
test -n "$version" || { echo "protoc-bin-vendored-linux-x86_64 is not in Cargo.lock" >&2; exit 1; }
|
||||
protoc=$(find ~/.cargo/registry/src -path "*protoc-bin-vendored-linux-x86_64-$version/bin/protoc" | head -1)
|
||||
test -x "$protoc" || { echo "no vendored protoc $version in the registry" >&2; exit 1; }
|
||||
echo "PROTOC=$protoc" >> "$GITHUB_ENV"
|
||||
- name: Build weed-vector-server
|
||||
run: cargo build --release --manifest-path seaweed-vector/Cargo.toml -p weed-vector-server
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- name: Install test deps
|
||||
run: pip install boto3 pytest
|
||||
- name: Run the s3vectors conformance subset
|
||||
working-directory: test/vectors
|
||||
run: |
|
||||
cp ../../seaweed-vector/target/release/weed-vector weed-vector
|
||||
./run_test.sh
|
||||
@@ -54,7 +54,7 @@ jobs:
|
||||
|
||||
build-test-binaries:
|
||||
name: Build Test Binaries
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
@@ -113,7 +113,7 @@ jobs:
|
||||
|
||||
rust-unit-tests:
|
||||
name: Rust Unit Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 15
|
||||
|
||||
steps:
|
||||
@@ -213,7 +213,7 @@ jobs:
|
||||
|
||||
rust-integration-tests:
|
||||
name: Rust Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
needs: [build-test-binaries]
|
||||
|
||||
@@ -228,7 +228,7 @@ jobs:
|
||||
cache: ${{ runner.environment == 'github-hosted' }}
|
||||
|
||||
- name: Download test binaries
|
||||
uses: actions/download-artifact@v8
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: rust-test-binaries
|
||||
|
||||
@@ -270,7 +270,7 @@ jobs:
|
||||
|
||||
rust-volume-go-tests:
|
||||
name: Go Tests with Rust Volume (${{ matrix.test-type }} - Shard ${{ matrix.shard }})
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 45
|
||||
needs: [build-test-binaries]
|
||||
env:
|
||||
@@ -293,7 +293,7 @@ jobs:
|
||||
cache: ${{ runner.environment == 'github-hosted' }}
|
||||
|
||||
- name: Download test binaries
|
||||
uses: actions/download-artifact@v8
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: rust-test-binaries
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ permissions:
|
||||
jobs:
|
||||
rust-worker-build:
|
||||
name: Rust Plugin Worker Build and Unit Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 45
|
||||
|
||||
steps:
|
||||
|
||||
@@ -32,7 +32,7 @@ jobs:
|
||||
permissions:
|
||||
contents: write
|
||||
needs: cleanup
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
build-rust-volume-linux:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
@@ -37,13 +37,9 @@ jobs:
|
||||
if: matrix.cross
|
||||
run: |
|
||||
sudo dpkg --add-architecture arm64
|
||||
# noble keeps apt sources in deb822 ubuntu.sources, not sources.list —
|
||||
# pin them to amd64 so apt does not probe arm64 indexes on
|
||||
# archive/security.ubuntu.com (they 404).
|
||||
sudo sed -i '/^Types: deb$/a Architectures: amd64' /etc/apt/sources.list.d/ubuntu.sources
|
||||
for suite in noble noble-updates noble-security; do
|
||||
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports $suite main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/arm64.list
|
||||
done
|
||||
sudo sed -i 's/^deb /deb [arch=amd64] /' /etc/apt/sources.list
|
||||
echo "deb [arch=arm64] http://ports.ubuntu.com/ jammy main restricted universe multiverse" | sudo tee /etc/apt/sources.list.d/arm64.list
|
||||
echo "deb [arch=arm64] http://ports.ubuntu.com/ jammy-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/arm64.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-aarch64-linux-gnu libssl-dev:arm64
|
||||
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
|
||||
@@ -124,7 +120,7 @@ jobs:
|
||||
build-rust-worker-linux:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
@@ -150,13 +146,9 @@ jobs:
|
||||
if: matrix.cross
|
||||
run: |
|
||||
sudo dpkg --add-architecture arm64
|
||||
# noble keeps apt sources in deb822 ubuntu.sources, not sources.list —
|
||||
# pin them to amd64 so apt does not probe arm64 indexes on
|
||||
# archive/security.ubuntu.com (they 404).
|
||||
sudo sed -i '/^Types: deb$/a Architectures: amd64' /etc/apt/sources.list.d/ubuntu.sources
|
||||
for suite in noble noble-updates noble-security; do
|
||||
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports $suite main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/arm64.list
|
||||
done
|
||||
sudo sed -i 's/^deb /deb [arch=amd64] /' /etc/apt/sources.list
|
||||
echo "deb [arch=arm64] http://ports.ubuntu.com/ jammy main restricted universe multiverse" | sudo tee /etc/apt/sources.list.d/arm64.list
|
||||
echo "deb [arch=arm64] http://ports.ubuntu.com/ jammy-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/arm64.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-aarch64-linux-gnu
|
||||
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
|
||||
|
||||
@@ -30,7 +30,7 @@ permissions:
|
||||
jobs:
|
||||
s3-etag-acl-tests:
|
||||
name: S3 ETag + ACL Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Check out code
|
||||
|
||||
@@ -22,7 +22,7 @@ permissions:
|
||||
jobs:
|
||||
tests:
|
||||
name: S3 Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
|
||||
@@ -25,16 +25,13 @@ defaults:
|
||||
jobs:
|
||||
s3-filer-group-tests:
|
||||
name: S3 Filer Group Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -54,7 +51,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting Filer Group Tests ==="
|
||||
|
||||
# Run tests with automatic server management
|
||||
|
||||
@@ -4,7 +4,6 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'weed/s3api/**'
|
||||
- 'weed/remote_storage/**'
|
||||
- 'weed/filer/**'
|
||||
- 'weed/server/**'
|
||||
- 'test/s3/**'
|
||||
@@ -26,7 +25,7 @@ defaults:
|
||||
jobs:
|
||||
s3-versioning-tests:
|
||||
name: S3 Versioning Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -36,9 +35,6 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -58,7 +54,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting Tests ==="
|
||||
|
||||
# Run tests with automatic server management
|
||||
@@ -97,7 +93,7 @@ jobs:
|
||||
|
||||
s3-versioning-compatibility:
|
||||
name: S3 Versioning Compatibility Test
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
@@ -146,7 +142,7 @@ jobs:
|
||||
|
||||
s3-cors-compatibility:
|
||||
name: S3 CORS Compatibility Test
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
@@ -195,7 +191,7 @@ jobs:
|
||||
|
||||
s3-retention-tests:
|
||||
name: S3 Retention Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -205,9 +201,6 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -227,7 +220,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting Tests ==="
|
||||
|
||||
# Run tests with automatic server management
|
||||
@@ -266,7 +259,7 @@ jobs:
|
||||
|
||||
s3-lifecycle-tests:
|
||||
name: S3 Lifecycle Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 10
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -339,16 +332,13 @@ jobs:
|
||||
|
||||
s3-checksum-tests:
|
||||
name: S3 Checksum Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -368,7 +358,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting Tests ==="
|
||||
make test-with-server
|
||||
|
||||
@@ -398,7 +388,7 @@ jobs:
|
||||
|
||||
s3-cors-tests:
|
||||
name: S3 CORS Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -408,9 +398,6 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -430,7 +417,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting Tests ==="
|
||||
|
||||
# Run tests with automatic server management
|
||||
@@ -469,7 +456,7 @@ jobs:
|
||||
|
||||
s3-retention-worm:
|
||||
name: S3 Retention WORM Integration Test
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
@@ -519,7 +506,7 @@ jobs:
|
||||
|
||||
s3-versioning-stress:
|
||||
name: S3 Versioning Stress Test
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 35
|
||||
|
||||
steps:
|
||||
@@ -588,7 +575,7 @@ jobs:
|
||||
s3-tagging-tests:
|
||||
# CI job for S3 object tagging tests
|
||||
name: S3 Tagging Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
@@ -644,7 +631,7 @@ jobs:
|
||||
|
||||
s3-remote-cache-tests:
|
||||
name: S3 Remote Cache Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
# Unit tests for IAM components
|
||||
iam-unit-tests:
|
||||
name: IAM Unit Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 15
|
||||
|
||||
steps:
|
||||
@@ -81,7 +81,7 @@ jobs:
|
||||
# S3 IAM integration tests with SeaweedFS services
|
||||
s3-iam-integration-tests:
|
||||
name: S3 IAM Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 25
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -91,9 +91,6 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -114,7 +111,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting S3 IAM Integration Tests (${{ matrix.test-type }}) ==="
|
||||
|
||||
# Set WEED_BINARY to use the installed version
|
||||
@@ -202,7 +199,7 @@ jobs:
|
||||
# Distributed IAM tests
|
||||
s3-iam-distributed-tests:
|
||||
name: S3 IAM Distributed Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 25
|
||||
|
||||
steps:
|
||||
@@ -263,7 +260,7 @@ jobs:
|
||||
# Performance and stress tests
|
||||
s3-iam-performance-tests:
|
||||
name: S3 IAM Performance Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
|
||||
@@ -30,16 +30,13 @@ jobs:
|
||||
# Dedicated job for Keycloak integration tests
|
||||
s3-keycloak-integration-tests:
|
||||
name: S3 Keycloak Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -60,7 +57,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting S3 Keycloak Integration Tests ==="
|
||||
|
||||
# Set WEED_BINARY to use the installed version
|
||||
|
||||
@@ -21,7 +21,7 @@ permissions:
|
||||
jobs:
|
||||
s3-versioning-regressions:
|
||||
name: S3 Versioning Regression Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 25
|
||||
|
||||
steps:
|
||||
@@ -75,7 +75,7 @@ jobs:
|
||||
|
||||
s3-delete-regressions:
|
||||
name: S3 Delete Regression Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
@@ -114,7 +114,7 @@ jobs:
|
||||
|
||||
s3-distributed-lock-regressions:
|
||||
name: S3 Distributed Lock Regression Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
# Unit tests for policy components
|
||||
policy-unit-tests:
|
||||
name: S3 Policy Unit Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 15
|
||||
|
||||
steps:
|
||||
@@ -82,16 +82,13 @@ jobs:
|
||||
# S3 Policy Variables Integration Tests
|
||||
s3-policy-variables-tests:
|
||||
name: S3 Policy Variables Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 25
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -111,7 +108,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
|
||||
echo "=== Starting S3 Policy Variables Integration Tests ==="
|
||||
|
||||
@@ -192,7 +189,7 @@ jobs:
|
||||
# S3 Policy Enforcement Integration Tests
|
||||
s3-policy-enforcement-tests:
|
||||
name: S3 Policy Enforcement Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -202,9 +199,6 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -224,7 +218,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
|
||||
echo "=== Starting S3 Policy Enforcement Tests (${{ matrix.test-case }}) ==="
|
||||
|
||||
@@ -317,7 +311,7 @@ jobs:
|
||||
# Trusted Proxy Detection Tests
|
||||
trusted-proxy-tests:
|
||||
name: Trusted Proxy Detection Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
@@ -405,7 +399,7 @@ jobs:
|
||||
# S3 Policy Shell Integration Tests
|
||||
s3-policy-shell-tests:
|
||||
name: S3 Policy Shell Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 15
|
||||
|
||||
steps:
|
||||
|
||||
@@ -30,7 +30,7 @@ permissions:
|
||||
jobs:
|
||||
proxy-signature-tests:
|
||||
name: S3 Proxy Signature Verification Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
|
||||
@@ -24,7 +24,7 @@ permissions:
|
||||
jobs:
|
||||
s3-sdk-v2-routing-tests:
|
||||
name: S3 SDK V2 Routing Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Check out code
|
||||
|
||||
@@ -46,7 +46,7 @@ permissions:
|
||||
jobs:
|
||||
snowflake-s3compat-tests:
|
||||
name: Snowflake S3Compat API tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
WORK_DIR: /tmp/seaweedfs-snowflake-tests
|
||||
|
||||
@@ -20,16 +20,13 @@ permissions:
|
||||
jobs:
|
||||
s3-spark-issue-repro-tests:
|
||||
name: S3 Spark Issue Reproduction Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 45
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -60,7 +57,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting S3 Spark Integration Tests ==="
|
||||
|
||||
go test -v -timeout 30m . 2>&1 | tee test-output.log || {
|
||||
|
||||
@@ -36,7 +36,7 @@ defaults:
|
||||
jobs:
|
||||
s3-sse-integration-tests:
|
||||
name: S3 SSE Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -46,9 +46,6 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -68,7 +65,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting SSE Tests ==="
|
||||
|
||||
# Run tests with automatic server management
|
||||
@@ -111,7 +108,7 @@ jobs:
|
||||
|
||||
s3-sse-compatibility:
|
||||
name: S3 SSE Compatibility Test
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
@@ -160,7 +157,7 @@ jobs:
|
||||
|
||||
s3-sse-metadata-persistence:
|
||||
name: S3 SSE Metadata Persistence Test
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
@@ -210,7 +207,7 @@ jobs:
|
||||
|
||||
s3-sse-copy-operations:
|
||||
name: S3 SSE Copy Operations Test
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 25
|
||||
|
||||
steps:
|
||||
@@ -260,7 +257,7 @@ jobs:
|
||||
|
||||
s3-sse-multipart:
|
||||
name: S3 SSE Multipart Upload Test
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 25
|
||||
|
||||
steps:
|
||||
@@ -310,7 +307,7 @@ jobs:
|
||||
|
||||
s3-sse-performance:
|
||||
name: S3 SSE Performance Test
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 35
|
||||
# Only run performance tests on master branch pushes to avoid overloading PR testing
|
||||
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
|
||||
@@ -361,7 +358,7 @@ jobs:
|
||||
|
||||
s3-volume-encryption:
|
||||
name: S3 Volume Encryption Test
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
|
||||
@@ -23,16 +23,13 @@ permissions:
|
||||
jobs:
|
||||
s3-tables-tests:
|
||||
name: S3 Tables Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -56,8 +53,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
# A stale FUSE mount can hang or fail df; keep diagnostics best effort.
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting S3 Tables Tests ==="
|
||||
|
||||
# Run S3 Tables integration tests
|
||||
@@ -88,16 +84,13 @@ jobs:
|
||||
|
||||
iceberg-catalog-tests:
|
||||
name: Iceberg Catalog Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -122,7 +115,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting Iceberg Catalog Tests ==="
|
||||
|
||||
# Run Iceberg catalog integration tests using Makefile (handles build)
|
||||
@@ -153,16 +146,13 @@ jobs:
|
||||
|
||||
trino-iceberg-catalog-tests:
|
||||
name: Trino Iceberg Catalog Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -196,7 +186,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting Trino Iceberg Catalog Tests ==="
|
||||
|
||||
# Run Trino + Iceberg catalog integration tests
|
||||
@@ -227,16 +217,13 @@ jobs:
|
||||
|
||||
dremio-iceberg-catalog-tests:
|
||||
name: Dremio Iceberg Catalog Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -271,7 +258,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
docker info
|
||||
echo "=== Starting Dremio Iceberg Catalog Tests ==="
|
||||
|
||||
@@ -304,16 +291,13 @@ jobs:
|
||||
|
||||
doris-iceberg-catalog-tests:
|
||||
name: Doris Iceberg Catalog Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 35
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -348,7 +332,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
docker info
|
||||
echo "=== Starting Doris Iceberg Catalog Tests ==="
|
||||
|
||||
@@ -381,7 +365,7 @@ jobs:
|
||||
|
||||
clickhouse-iceberg-catalog-tests:
|
||||
name: ClickHouse Iceberg Catalog Integration Tests (${{ matrix.tag }})
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -398,9 +382,6 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -437,7 +418,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
docker info
|
||||
echo "=== Starting ClickHouse Iceberg Catalog Tests ==="
|
||||
|
||||
@@ -470,7 +451,7 @@ jobs:
|
||||
|
||||
olake-iceberg-catalog-tests:
|
||||
name: OLake Iceberg Catalog Integration Tests (${{ matrix.tag }})
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -489,9 +470,6 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -529,7 +507,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
docker info
|
||||
echo "=== Starting OLake Iceberg Catalog Tests ==="
|
||||
|
||||
@@ -585,16 +563,13 @@ jobs:
|
||||
|
||||
polaris-integration-tests:
|
||||
name: Polaris Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -627,7 +602,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting Polaris Tests ==="
|
||||
|
||||
go test -v -timeout 20m ./test/s3tables/polaris 2>&1 | tee test/s3tables/polaris/test-output.log || {
|
||||
@@ -657,16 +632,13 @@ jobs:
|
||||
|
||||
spark-iceberg-catalog-tests:
|
||||
name: Spark Iceberg Catalog Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -700,7 +672,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting Spark Iceberg Catalog Tests ==="
|
||||
|
||||
# Run Spark + Iceberg catalog integration tests
|
||||
@@ -731,16 +703,13 @@ jobs:
|
||||
|
||||
risingwave-catalog-tests:
|
||||
name: RisingWave Catalog Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -775,7 +744,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting RisingWave Catalog Tests ==="
|
||||
|
||||
# Run RisingWave catalog integration tests
|
||||
@@ -806,16 +775,13 @@ jobs:
|
||||
|
||||
sts-integration-tests:
|
||||
name: STS Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -874,7 +840,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting STS Integration Tests ==="
|
||||
|
||||
# Run STS integration tests
|
||||
@@ -905,16 +871,13 @@ jobs:
|
||||
|
||||
lakekeeper-integration-tests:
|
||||
name: Lakekeeper Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -938,7 +901,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting Lakekeeper Integration Tests ==="
|
||||
|
||||
# Run Lakekeeper integration tests
|
||||
@@ -969,16 +932,13 @@ jobs:
|
||||
|
||||
unity-catalog-integration-tests:
|
||||
name: Unity Catalog Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -1013,7 +973,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
docker info
|
||||
echo "=== Starting Unity Catalog Tests ==="
|
||||
|
||||
@@ -1046,16 +1006,13 @@ jobs:
|
||||
|
||||
lancedb-namespace-tests:
|
||||
name: LanceDB Namespace Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -1089,7 +1046,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
docker info
|
||||
echo "=== Starting LanceDB Namespace Tests ==="
|
||||
|
||||
@@ -1120,7 +1077,7 @@ jobs:
|
||||
|
||||
table-lifecycle-tests:
|
||||
name: Table Lifecycle Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 40
|
||||
|
||||
steps:
|
||||
@@ -1189,7 +1146,7 @@ jobs:
|
||||
|
||||
duckdb-lance-tests:
|
||||
name: DuckDB Lance Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
|
||||
steps:
|
||||
@@ -1200,9 +1157,6 @@ jobs:
|
||||
# so do not leave a token in the checkout for it to pick up.
|
||||
persist-credentials: false
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -1237,7 +1191,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
docker info
|
||||
echo "=== Starting DuckDB Lance Tests ==="
|
||||
|
||||
@@ -1268,7 +1222,7 @@ jobs:
|
||||
|
||||
spark-lance-namespace-tests:
|
||||
name: Spark Lance Namespace Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 40
|
||||
|
||||
steps:
|
||||
@@ -1279,9 +1233,6 @@ jobs:
|
||||
# so do not leave a token in the checkout for it to pick up.
|
||||
persist-credentials: false
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -1315,7 +1266,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
docker info
|
||||
echo "=== Starting Spark Lance Namespace Tests ==="
|
||||
|
||||
@@ -1346,7 +1297,7 @@ jobs:
|
||||
|
||||
s3-tables-build-verification:
|
||||
name: S3 Tables Build Verification
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 15
|
||||
|
||||
steps:
|
||||
@@ -1412,7 +1363,7 @@ jobs:
|
||||
|
||||
s3-tables-fmt-check:
|
||||
name: S3 Tables Format Check
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
@@ -1464,7 +1415,7 @@ jobs:
|
||||
|
||||
s3-tables-vet:
|
||||
name: S3 Tables Go Vet Check
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
|
||||
@@ -34,7 +34,7 @@ permissions:
|
||||
jobs:
|
||||
basic-s3-tests:
|
||||
name: Basic S3 tests (KV store)
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
@@ -58,9 +58,9 @@ jobs:
|
||||
cd s3-tests
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq libxml2-dev libxslt1-dev zlib1g-dev
|
||||
python3 -m pip install -r requirements.txt
|
||||
python3 -m pip install tox
|
||||
python3 -m pip install -e .
|
||||
pip install -r requirements.txt
|
||||
pip install tox
|
||||
pip install -e .
|
||||
|
||||
- name: Fix S3 tests bucket creation conflicts
|
||||
run: |
|
||||
@@ -380,21 +380,14 @@ jobs:
|
||||
s3tests/functional/test_s3.py::test_copy_object_ifnonematch_good \
|
||||
s3tests/functional/test_s3.py::test_lifecycle_set \
|
||||
s3tests/functional/test_s3.py::test_lifecycle_get \
|
||||
s3tests/functional/test_s3.py::test_lifecycle_set_filter
|
||||
|
||||
# The expiration tests race the lifecycle worker's meta-log replay;
|
||||
# under the suite's write flood a shard can trail an object's PUT
|
||||
# event past the test's fixed sleep window. One retry absorbs it.
|
||||
lifecycle_expiration() {
|
||||
tox -- s3tests/functional/test_s3.py::test_lifecycle_expiration \
|
||||
s3tests/functional/test_s3.py::test_lifecyclev2_expiration
|
||||
}
|
||||
lifecycle_expiration || { echo "lifecycle expiration tests flaked; retry 1"; lifecycle_expiration; } || { echo "lifecycle expiration tests flaked; retry 2"; lifecycle_expiration; }
|
||||
s3tests/functional/test_s3.py::test_lifecycle_set_filter \
|
||||
s3tests/functional/test_s3.py::test_lifecycle_expiration \
|
||||
s3tests/functional/test_s3.py::test_lifecyclev2_expiration
|
||||
# cleanup() trap handles worker/server kill + data dir wipe.
|
||||
|
||||
versioning-tests:
|
||||
name: S3 Versioning & Object Lock tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
@@ -418,9 +411,9 @@ jobs:
|
||||
cd s3-tests
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq libxml2-dev libxslt1-dev zlib1g-dev
|
||||
python3 -m pip install -r requirements.txt
|
||||
python3 -m pip install tox
|
||||
python3 -m pip install -e .
|
||||
pip install -r requirements.txt
|
||||
pip install tox
|
||||
pip install -e .
|
||||
|
||||
- name: Fix S3 tests bucket creation conflicts
|
||||
run: |
|
||||
@@ -565,7 +558,7 @@ jobs:
|
||||
|
||||
cors-tests:
|
||||
name: S3 CORS tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
@@ -589,9 +582,9 @@ jobs:
|
||||
cd s3-tests
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq libxml2-dev libxslt1-dev zlib1g-dev
|
||||
python3 -m pip install -r requirements.txt
|
||||
python3 -m pip install tox
|
||||
python3 -m pip install -e .
|
||||
pip install -r requirements.txt
|
||||
pip install tox
|
||||
pip install -e .
|
||||
|
||||
- name: Run S3 CORS tests
|
||||
timeout-minutes: 10
|
||||
@@ -691,7 +684,7 @@ jobs:
|
||||
|
||||
copy-tests:
|
||||
name: SeaweedFS Custom S3 Copy tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
@@ -794,7 +787,7 @@ jobs:
|
||||
|
||||
sql-store-tests:
|
||||
name: Basic S3 tests (SQL store)
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
@@ -818,9 +811,9 @@ jobs:
|
||||
cd s3-tests
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq libxml2-dev libxslt1-dev zlib1g-dev
|
||||
python3 -m pip install -r requirements.txt
|
||||
python3 -m pip install tox
|
||||
python3 -m pip install -e .
|
||||
pip install -r requirements.txt
|
||||
pip install tox
|
||||
pip install -e .
|
||||
|
||||
- name: Run Ceph S3 tests with SQL store
|
||||
timeout-minutes: 15
|
||||
@@ -1257,16 +1250,9 @@ jobs:
|
||||
s3tests/functional/test_s3.py::test_copy_object_ifnonematch_good \
|
||||
s3tests/functional/test_s3.py::test_lifecycle_set \
|
||||
s3tests/functional/test_s3.py::test_lifecycle_get \
|
||||
s3tests/functional/test_s3.py::test_lifecycle_set_filter
|
||||
|
||||
# The expiration tests race the lifecycle worker's meta-log replay;
|
||||
# under the suite's write flood a shard can trail an object's PUT
|
||||
# event past the test's fixed sleep window. One retry absorbs it.
|
||||
lifecycle_expiration() {
|
||||
tox -- s3tests/functional/test_s3.py::test_lifecycle_expiration \
|
||||
s3tests/functional/test_s3.py::test_lifecyclev2_expiration
|
||||
}
|
||||
lifecycle_expiration || { echo "lifecycle expiration tests flaked; retry 1"; lifecycle_expiration; } || { echo "lifecycle expiration tests flaked; retry 2"; lifecycle_expiration; }
|
||||
s3tests/functional/test_s3.py::test_lifecycle_set_filter \
|
||||
s3tests/functional/test_s3.py::test_lifecycle_expiration \
|
||||
s3tests/functional/test_s3.py::test_lifecyclev2_expiration
|
||||
# cleanup() trap handles worker/server kill + data dir wipe.
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ permissions:
|
||||
jobs:
|
||||
samba-integration:
|
||||
name: samba-integration
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 45
|
||||
|
||||
steps:
|
||||
@@ -43,20 +43,13 @@ jobs:
|
||||
cache: ${{ runner.environment == 'github-hosted' }}
|
||||
|
||||
- name: Start local Docker registry
|
||||
run: |
|
||||
if ! docker start registry 2>/dev/null; then
|
||||
docker rm -f registry >/dev/null 2>&1 || true
|
||||
docker run -d --restart=always -p 5000:5000 --name registry registry:2
|
||||
fi
|
||||
run: docker run -d --restart=always -p 5000:5000 --name registry registry:2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
with:
|
||||
driver-opts: network=host
|
||||
|
||||
- name: Set up Docker Compose
|
||||
uses: docker/setup-compose-action@v2
|
||||
|
||||
- name: Build weed race binary
|
||||
run: |
|
||||
cd docker
|
||||
|
||||
@@ -29,7 +29,7 @@ env:
|
||||
jobs:
|
||||
sftp-integration:
|
||||
name: SFTP Integration Testing
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
|
||||
@@ -28,7 +28,7 @@ permissions:
|
||||
jobs:
|
||||
tls-rotation-tests:
|
||||
name: TLS Rotation Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Set up Go 1.x
|
||||
|
||||
@@ -24,16 +24,13 @@ defaults:
|
||||
jobs:
|
||||
tus-integration-tests:
|
||||
name: TUS Protocol Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Clean up stale FUSE mounts
|
||||
uses: ./.github/actions/cleanup-stale-fuse-mounts
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v7
|
||||
with:
|
||||
@@ -53,7 +50,7 @@ jobs:
|
||||
echo "=== System Information ==="
|
||||
uname -a
|
||||
free -h
|
||||
timeout 15 df -h || true
|
||||
df -h
|
||||
echo "=== Starting TUS Tests ==="
|
||||
|
||||
# Run tests with automatic server management
|
||||
|
||||
@@ -28,7 +28,7 @@ permissions:
|
||||
jobs:
|
||||
vacuum-integration-tests:
|
||||
name: Vacuum Integration Tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Set up Go 1.x
|
||||
|
||||
@@ -35,7 +35,7 @@ env:
|
||||
jobs:
|
||||
build-weed:
|
||||
name: Build SeaweedFS Binary
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 15
|
||||
|
||||
steps:
|
||||
@@ -68,7 +68,7 @@ jobs:
|
||||
|
||||
volume-server-integration-tests:
|
||||
name: Volume Server Integration Tests (${{ matrix.test-type }} - Shard ${{ matrix.shard }})
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 45
|
||||
needs: [build-weed]
|
||||
strategy:
|
||||
@@ -88,7 +88,7 @@ jobs:
|
||||
cache: ${{ runner.environment == 'github-hosted' }}
|
||||
|
||||
- name: Download binary
|
||||
uses: actions/download-artifact@v8
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: weed-binary
|
||||
|
||||
|
||||
@@ -144,4 +144,3 @@ weed_bin
|
||||
telemetry/server/telemetry-server
|
||||
.aider*
|
||||
/seaweed-volume/docs
|
||||
__pycache__/
|
||||
@@ -3,7 +3,7 @@ FROM golang:1.26 AS builder
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y build-essential libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev liblz4-dev libzstd-dev
|
||||
|
||||
ARG ROCKSDB_VERSION=v11.1.2
|
||||
ARG ROCKSDB_VERSION=v10.10.1
|
||||
ENV ROCKSDB_VERSION=${ROCKSDB_VERSION}
|
||||
|
||||
# build RocksDB
|
||||
|
||||
@@ -3,7 +3,7 @@ FROM golang:1.26 AS builder
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y build-essential libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev liblz4-dev libzstd-dev
|
||||
|
||||
ARG ROCKSDB_VERSION=v11.1.2
|
||||
ARG ROCKSDB_VERSION=v10.10.1
|
||||
ENV ROCKSDB_VERSION=${ROCKSDB_VERSION}
|
||||
|
||||
# build RocksDB
|
||||
|
||||
@@ -101,7 +101,7 @@ require (
|
||||
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
|
||||
google.golang.org/api v0.297.0
|
||||
google.golang.org/genproto v0.0.0-20260904194346-d0f1323225a4 // indirect
|
||||
google.golang.org/grpc v1.86.0-dev.0.20261027044109-d619b5d02089
|
||||
google.golang.org/grpc v1.85.0-dev.0.20260915183914-4e49413dcab7
|
||||
google.golang.org/protobuf v1.36.12
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
modernc.org/b v1.0.0 // indirect
|
||||
@@ -115,8 +115,8 @@ require (
|
||||
github.com/Azure/azure-sdk-for-go/sdk/keyvault/azkeys v0.10.0
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.2
|
||||
github.com/Jille/raft-grpc-transport v1.6.1
|
||||
github.com/ThreeDotsLabs/watermill v1.5.3
|
||||
github.com/a-h/templ v0.3.1100
|
||||
github.com/ThreeDotsLabs/watermill v1.5.2
|
||||
github.com/a-h/templ v0.3.1070
|
||||
github.com/apache/cassandra-gocql-driver/v2 v2.1.2
|
||||
github.com/apache/iceberg-go v0.7.0
|
||||
github.com/apple/foundationdb/bindings/go v0.0.0-20250911184653-27f7192f47c3
|
||||
@@ -129,7 +129,7 @@ require (
|
||||
github.com/cespare/xxhash/v2 v2.3.0
|
||||
github.com/cognusion/imaging v1.0.4
|
||||
github.com/fluent/fluent-logger-golang v1.10.1
|
||||
github.com/getsentry/sentry-go v0.50.0
|
||||
github.com/getsentry/sentry-go v0.49.0
|
||||
github.com/go-ldap/ldap/v3 v3.4.14
|
||||
github.com/golang-jwt/jwt/v5 v5.3.1
|
||||
github.com/google/flatbuffers/go v0.0.0-20230108230133-3b8644d32c50
|
||||
@@ -142,11 +142,11 @@ require (
|
||||
github.com/minio/crc64nvme v1.1.1
|
||||
github.com/orcaman/concurrent-map/v2 v2.0.1
|
||||
github.com/parquet-go/parquet-go v0.32.0
|
||||
github.com/pkg/sftp v1.13.12
|
||||
github.com/pkg/sftp v1.13.11
|
||||
github.com/rabbitmq/amqp091-go v1.15.0
|
||||
github.com/rclone/rclone v1.75.1
|
||||
github.com/rdleal/intervalst v1.5.0
|
||||
github.com/redis/go-redis/v9 v9.23.0
|
||||
github.com/redis/go-redis/v9 v9.22.0
|
||||
github.com/schollz/progressbar/v3 v3.19.1
|
||||
github.com/seaweedfs/go-fuse/v2 v2.9.4
|
||||
github.com/shirou/gopsutil/v4 v4.26.7
|
||||
@@ -290,19 +290,19 @@ require (
|
||||
cel.dev/expr v0.25.3 // indirect
|
||||
cloud.google.com/go/auth v0.23.2 // indirect
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.10.0 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.9.0 // indirect
|
||||
cloud.google.com/go/iam v1.13.0 // indirect
|
||||
cloud.google.com/go/monitoring v1.30.0 // indirect
|
||||
filippo.io/edwards25519 v1.2.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.3
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.2
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.1
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.13.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.8.2
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azfile v1.7.0 // indirect
|
||||
github.com/Azure/go-ntlmssp v0.1.1 // indirect
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.9.0 // indirect
|
||||
github.com/Files-com/files-sdk-go/v3 v3.3.194 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.38.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.37.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.61.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.61.0 // indirect
|
||||
github.com/IBM/go-sdk-core/v5 v5.23.1 // indirect
|
||||
@@ -314,7 +314,7 @@ require (
|
||||
github.com/ProtonMail/go-srp v0.0.7 // indirect
|
||||
github.com/PuerkitoBio/goquery v1.12.0 // indirect
|
||||
github.com/abbot/go-http-auth v0.4.0 // indirect
|
||||
github.com/andybalholm/brotli v1.2.7 // indirect
|
||||
github.com/andybalholm/brotli v1.2.6 // indirect
|
||||
github.com/andybalholm/cascadia v1.3.4 // indirect
|
||||
github.com/appscode/go-querystring v0.0.0-20170504095604-0126cfb3f1dc // indirect
|
||||
github.com/arangodb/go-velocypack v0.0.0-20200318135517-5af53c29c67e // indirect
|
||||
@@ -355,16 +355,16 @@ require (
|
||||
github.com/elastic/gosigar v0.14.3 // indirect
|
||||
github.com/emersion/go-message v0.18.2 // indirect
|
||||
github.com/emersion/go-vcard v0.0.0-20260618161152-d854b7e0e2d3 // indirect
|
||||
github.com/envoyproxy/go-control-plane/envoy v1.40.1-0.20261014170222-9c4befd3c419 // indirect
|
||||
github.com/envoyproxy/go-control-plane/envoy v1.39.1-0.20260819172001-e6e3fd93e4be // indirect
|
||||
github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect
|
||||
github.com/fatih/color v1.19.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.1.0 // indirect
|
||||
github.com/flynn/noise v1.1.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.13 // indirect
|
||||
github.com/geoffgarside/ber v1.2.0 // indirect
|
||||
github.com/go-chi/chi/v5 v5.4.0 // indirect
|
||||
github.com/go-chi/chi/v5 v5.3.1 // indirect
|
||||
github.com/go-darwin/apfs v0.0.0-20211011131704-f84b94dbf348 // indirect
|
||||
github.com/go-jose/go-jose/v4 v4.1.6 // indirect
|
||||
github.com/go-jose/go-jose/v4 v4.1.5 // indirect
|
||||
github.com/go-logr/logr v1.4.4 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||
@@ -455,7 +455,7 @@ require (
|
||||
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
|
||||
github.com/spacemonkeygo/monkit/v3 v3.0.25-0.20251022131615-eb24eb109368 // indirect
|
||||
github.com/spf13/pflag v1.0.10 // indirect
|
||||
github.com/spiffe/go-spiffe/v2 v2.8.2 // indirect
|
||||
github.com/spiffe/go-spiffe/v2 v2.8.1 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/t3rm1n4l/go-mega v0.0.0-20260717075258-c6acd6a5bd04 // indirect
|
||||
github.com/tarantool/go-iproto v1.1.0 // indirect
|
||||
@@ -493,8 +493,8 @@ require (
|
||||
go.uber.org/zap v1.28.0 // indirect
|
||||
golang.org/x/term v0.47.0
|
||||
golang.org/x/time v0.16.0
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260921155816-b14227669459 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260921155816-b14227669459 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260904194346-d0f1323225a4 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260904194346-d0f1323225a4 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/validator.v2 v2.0.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
|
||||
@@ -8,8 +8,8 @@ cloud.google.com/go/auth v0.23.2 h1:pxSCpfiji41hpzpPdMCftEUCezpgpqmmDdYiAjCKXxo=
|
||||
cloud.google.com/go/auth v0.23.2/go.mod h1:4DhBRcqvtljQN3dJ57qtqbib5ZGCYE5f2crfiiC2EM0=
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc=
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c=
|
||||
cloud.google.com/go/compute/metadata v0.10.0 h1:pyKMUQSwchgkIBBJGdILqQbs/BNJXqwSA7Ej6LAvvtY=
|
||||
cloud.google.com/go/compute/metadata v0.10.0/go.mod h1:rGFHRrIif570kSibjFTMbt6/4/tzgJWFGI/HVol4GIk=
|
||||
cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs=
|
||||
cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10=
|
||||
cloud.google.com/go/iam v1.13.0 h1:ufT3FPT5rFFXu6UtLkNoxaOaV5EuA1dsSkmemCSTo6U=
|
||||
cloud.google.com/go/iam v1.13.0/go.mod h1:gHXdDEiPDvqd1q1KwBDGQlgZY/BwY760zU2LhOZS5w0=
|
||||
cloud.google.com/go/kms v1.35.0 h1:nJ/ktaqspx1nPM9vIcO0SHbhqCAm8nvAxL1siuVgKm0=
|
||||
@@ -34,14 +34,14 @@ filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
|
||||
filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
|
||||
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 h1:He8afgbRMd7mFxO99hRNu+6tazq8nFF9lIwo9JFroBk=
|
||||
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.3 h1:qgnWTiWs1G7AqcKZegFvkJD1bmXJcaDU3uC0ELSgZ5U=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.3/go.mod h1:XtxD48QPInqoj+GMlcRlXHEYsoOxFnP6w2JgIZ9rDS4=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.2 h1:utpeoEeZjd+A8J41zvoLsOOrqXHhX1Kx/X/tCW9dEYQ=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.2/go.mod h1:iptorS+VYKFL2N6PnebpS91dubG35eAOEERnT4PJbQU=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.1 h1:u93s+zU2JD62im61Bm5CZIc1ZrOJaIAWEg0WOrMVkEo=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.1/go.mod h1:oXtinPO4OLj9d1DOTrqrL1oRwGhcqadvAmrl6wTeGlk=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.4.0 h1:xFaZZ+IubdftrDHnGGwZ6QvQ3KHTtWl2MCK+GMt2vxs=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.4.0/go.mod h1:mCBhUhlMjLLJKr5aqw2TNS/VqJOie8MzWq3DAMJeKso=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.13.0 h1:Terj1CMW4+NY5CpWjSRkqLoxh2DkYDdv/FH2z0897Uc=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.13.0/go.mod h1:7Ut2Qw9vcwpLW5Q4MBy43uSxXS7tK2yjs94OJ6j5thE=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 h1:fhqpLE3UEXi9lPaBRpQ6XuRW0nU7hgg4zlmZZa+a9q4=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0/go.mod h1:7dCRMLwisfRH3dBupKeNCioWYUZ4SS09Z14H+7i8ZoY=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/keyvault/azkeys v0.10.0 h1:m/sWOGCREuSBqg2htVQTBY8nOZpyajYztF0vUvSZTuM=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/keyvault/azkeys v0.10.0/go.mod h1:Pu5Zksi2KrU7LPbZbNINx6fuVrUp/ffvpxdDj+i8LeE=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.1 h1:FbH3BbSb4bvGluTesZZ+ttN/MDsnMmQP36OSnDuSXqw=
|
||||
@@ -75,8 +75,8 @@ github.com/FilenCloudDienste/filen-sdk-go v0.0.39 h1:tgV5jYL6dsXop9TpDTIQU6UwJjw
|
||||
github.com/FilenCloudDienste/filen-sdk-go v0.0.39/go.mod h1:0cBhKXQg49XbKZZfk5TCDa3sVLP+xMxZTWL+7KY0XR0=
|
||||
github.com/Files-com/files-sdk-go/v3 v3.3.194 h1:dtOFxSTWWRpkmvXa6ycNiw8dVDu1wkgzcXyVV1VafNc=
|
||||
github.com/Files-com/files-sdk-go/v3 v3.3.194/go.mod h1:rl0WumSN9gSo775DgvQv+wMQ8rlb0ES/1hU5jkMtLXg=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.38.0 h1:rmzbFS2CkHq0y2L5LkMVWm+QXjjNEXxjmhrJqga/QGk=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.38.0/go.mod h1:iIyrdhveU5Ow84ipRlxtjCOQnIM0DiqSMxuxm50xwZY=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.37.0 h1:edOuLWehuDlQ68roBF900Y09jvBoJP5W5d/wusz9nWY=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.37.0/go.mod h1:iIyrdhveU5Ow84ipRlxtjCOQnIM0DiqSMxuxm50xwZY=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.61.0 h1:BeC1Bub7Ttk33TF8v3ZeQ2L8acvz4ZLqtQuLyJAZquc=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.61.0/go.mod h1:UgG/Xn9+NXb1/ueSczIFxyuya3hs3srFDiZG2JrpJwY=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.61.0 h1:eSgSuKdcpY7RTN1oXSzC6S39rPBImn03ubLMsWK4RRg=
|
||||
@@ -116,12 +116,12 @@ github.com/Shopify/sarama v1.38.1 h1:lqqPUPQZ7zPqYlWpTh+LQ9bhYNu2xJL6k1SJN4WVe2A
|
||||
github.com/Shopify/sarama v1.38.1/go.mod h1:iwv9a67Ha8VNa+TifujYoWGxWnu2kNVAQdSdZ4X2o5g=
|
||||
github.com/Shopify/toxiproxy/v2 v2.5.0 h1:i4LPT+qrSlKNtQf5QliVjdP08GyAH8+BUIc9gT0eahc=
|
||||
github.com/Shopify/toxiproxy/v2 v2.5.0/go.mod h1:yhM2epWtAmel9CB8r2+L+PCmhH6yH2pITaPAo7jxJl0=
|
||||
github.com/ThreeDotsLabs/watermill v1.5.3 h1:GoTR7fW1ZT+itzUv/w3VB6Um1B7oTBrOWjJ8sOA9XqU=
|
||||
github.com/ThreeDotsLabs/watermill v1.5.3/go.mod h1:i9/968UriGphWfEbfMuYSD1qFbYRjb0mE0r+rV0FPp4=
|
||||
github.com/ThreeDotsLabs/watermill v1.5.2 h1:0ES33Eq1jEsP/pWvtE4n8bE0bs+9Jq7boT7wGBCVY6Q=
|
||||
github.com/ThreeDotsLabs/watermill v1.5.2/go.mod h1:i9/968UriGphWfEbfMuYSD1qFbYRjb0mE0r+rV0FPp4=
|
||||
github.com/TomiHiltunen/geohash-golang v0.0.0-20150112065804-b3e4e625abfb h1:wumPkzt4zaxO4rHPBrjDK8iZMR41C1qs7njNqlacwQg=
|
||||
github.com/TomiHiltunen/geohash-golang v0.0.0-20150112065804-b3e4e625abfb/go.mod h1:QiYsIBRQEO+Z4Rz7GoI+dsHVneZNONvhczuA+llOZNM=
|
||||
github.com/a-h/templ v0.3.1100 h1:lQhjVs1IL+M6QWUvojaFBd21+kzwATppSyWkWB9oHoM=
|
||||
github.com/a-h/templ v0.3.1100/go.mod h1:j1WAOR7749mlo1AxFLQ7qbDFW5VwyoqszRTlKqEHN9M=
|
||||
github.com/a-h/templ v0.3.1070 h1:3iCOXHXqFXa99OQzgkUOLJbNzv/QjFGLwKZkBAg+ADA=
|
||||
github.com/a-h/templ v0.3.1070/go.mod h1:iIqB3g2RHBe/WlnPwa+Bvhh1TKXHWLRnBD9NWHOLm78=
|
||||
github.com/a1ex3/zstd-seekable-format-go/pkg v0.10.0 h1:iLDOF0rdGTrol/q8OfPIIs5kLD8XvA2q75o6Uq/tgak=
|
||||
github.com/a1ex3/zstd-seekable-format-go/pkg v0.10.0/go.mod h1:DrEWcQJjz7t5iF2duaiyhg4jyoF0kxOD6LtECNGkZ/Q=
|
||||
github.com/aalpar/deheap v1.1.2 h1:MABHLcnjqsffb8GLkUFDigqpBBxOMz0DoKM9QfELeTw=
|
||||
@@ -144,8 +144,8 @@ github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e h1:4dAU9FXIyQktp
|
||||
github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
|
||||
github.com/anchore/go-lzo v0.1.1 h1:IwL/fvkdtlIrYIXck6WxZ3nb8WjjHziYYmGxlooyOnM=
|
||||
github.com/anchore/go-lzo v0.1.1/go.mod h1:3kLx0bve2oN1iDwgM1U5zGku1Tfbdb0No5qp1eL1fIk=
|
||||
github.com/andybalholm/brotli v1.2.7 h1:UgafRPGMam5ySHfRkhthMqOFA6IFoeF3D7mWIDLjG5A=
|
||||
github.com/andybalholm/brotli v1.2.7/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
|
||||
github.com/andybalholm/brotli v1.2.6 h1:ftYnfj6usCp+UGV5kSJ3+chpMQgU+gJf/AxsUQ52REI=
|
||||
github.com/andybalholm/brotli v1.2.6/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
|
||||
github.com/andybalholm/cascadia v1.3.4 h1:vM2lgh0Vru9Vwyfm4cQqWP2HHMW0u0+2PAW7Q38Qufg=
|
||||
github.com/andybalholm/cascadia v1.3.4/go.mod h1:BLRmbRjpEtNKieZOCCvYj4RqN+KRA41GBe/5O+G93kM=
|
||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||
@@ -428,8 +428,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m
|
||||
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
|
||||
github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA=
|
||||
github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU=
|
||||
github.com/envoyproxy/go-control-plane/envoy v1.40.1-0.20261014170222-9c4befd3c419 h1:DybMDTfb3z9UZasQ2vRKnt7VmhjR7HDaOdflhJt7SDI=
|
||||
github.com/envoyproxy/go-control-plane/envoy v1.40.1-0.20261014170222-9c4befd3c419/go.mod h1:UZVGjwWu2QV8PkGSlXmqWiSgqCGZe16TgIu4jDl3T5w=
|
||||
github.com/envoyproxy/go-control-plane/envoy v1.39.1-0.20260819172001-e6e3fd93e4be h1:SWe0x6yfglnxuvOiYgTTnNq7QD/yvqthOh1RBI8Bj8w=
|
||||
github.com/envoyproxy/go-control-plane/envoy v1.39.1-0.20260819172001-e6e3fd93e4be/go.mod h1:PYEOlng9XcrulfyWpm49jECTPV0LT4q8cO7fLW/xwgk=
|
||||
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI=
|
||||
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
@@ -474,8 +474,8 @@ github.com/geoarrow/geoarrow-go v0.0.0-20260403143023-f54751c3e3a1 h1:8VcjuP5pKZ
|
||||
github.com/geoarrow/geoarrow-go v0.0.0-20260403143023-f54751c3e3a1/go.mod h1:XMOIOA5J96jEzAOpBROPyz0n14sHsooeF+y2FtGdrCY=
|
||||
github.com/geoffgarside/ber v1.2.0 h1:/loowoRcs/MWLYmGX9QtIAbA+V/FrnVLsMMPhwiRm64=
|
||||
github.com/geoffgarside/ber v1.2.0/go.mod h1:jVPKeCbj6MvQZhwLYsGwaGI52oUorHoHKNecGT85ZCc=
|
||||
github.com/getsentry/sentry-go v0.50.0 h1:gkO59rn/i0RCAXUUTflC5QVbTQGPXbaFabs2olVzc9g=
|
||||
github.com/getsentry/sentry-go v0.50.0/go.mod h1:+xsDuN+SoRN/xfs1hdq78wnrE3omIZf+FCuh9FOW1C8=
|
||||
github.com/getsentry/sentry-go v0.49.0 h1:Ehejknu1l023Ub7QoRBVLAI7g3Jnhqku4oWx4B4Sh5s=
|
||||
github.com/getsentry/sentry-go v0.49.0/go.mod h1:nuMJAoCfe1u0Bts2ocyNI+TW8HT84vRMqwA5Qq/SKUI=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
|
||||
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
|
||||
@@ -483,16 +483,16 @@ github.com/gin-gonic/gin v1.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk=
|
||||
github.com/gin-gonic/gin v1.11.0/go.mod h1:+iq/FyxlGzII0KHiBGjuNn4UNENUlKbGlNmc+W50Dls=
|
||||
github.com/go-asn1-ber/asn1-ber v1.5.8 h1:H9AZkK22UOmfX8J84ubyaZxKJZ3FMHVwn8swoMML7iQ=
|
||||
github.com/go-asn1-ber/asn1-ber v1.5.8/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
|
||||
github.com/go-chi/chi/v5 v5.4.0 h1:+ufzvFTGKyin26Or5DLrlIDq4ygIDBVcj7oVNeeaYFE=
|
||||
github.com/go-chi/chi/v5 v5.4.0/go.mod h1:d1IG7GtKPSjPyBP365PH8sAGVHk3qfB/IhjFNRH1wWM=
|
||||
github.com/go-chi/chi/v5 v5.3.1 h1:3j4HZLGZQ3JpMCrPJF/Jl3mYJfWLKBfNJ6quurUGCf8=
|
||||
github.com/go-chi/chi/v5 v5.3.1/go.mod h1:R+tYY2hNuVUUjxoPtqUdgBqevM9s9njzkTLutVsOCto=
|
||||
github.com/go-darwin/apfs v0.0.0-20211011131704-f84b94dbf348 h1:JnrjqG5iR07/8k7NqrLNilRsl3s1EPRQEGvbPyOce68=
|
||||
github.com/go-darwin/apfs v0.0.0-20211011131704-f84b94dbf348/go.mod h1:Czxo/d1g948LtrALAZdL04TL/HnkopquAjxYUuI02bo=
|
||||
github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk=
|
||||
github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||
github.com/go-git/go-billy/v5 v5.9.0 h1:jItGXszUDRtR/AlferWPTMN4j38BQ88XnXKbilmmBPA=
|
||||
github.com/go-git/go-billy/v5 v5.9.0/go.mod h1:jCnQMLj9eUgGU7+ludSTYoZL/GGmii14RxKFj7ROgHw=
|
||||
github.com/go-jose/go-jose/v4 v4.1.6 h1:sNRkftxFJxwsILiQukqp5z83QBSmntVwmgRY7AqBDO4=
|
||||
github.com/go-jose/go-jose/v4 v4.1.6/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
|
||||
github.com/go-jose/go-jose/v4 v4.1.5 h1:RjgjO2LOtWOJKUC5wpwY9LR3B3vwVAz6JS2YHfYU6eA=
|
||||
github.com/go-jose/go-jose/v4 v4.1.5/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
||||
@@ -1005,8 +1005,8 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/sftp v1.13.12 h1:Myhzy/ZzLPnCtE2F2WtDHsgs8RfgMnH2gfbHuCJhkMU=
|
||||
github.com/pkg/sftp v1.13.12/go.mod h1:uNkH9roSXglNJqM+glJJi+TQXQUm0fXFWqCFmT8hsN0=
|
||||
github.com/pkg/sftp v1.13.11 h1:0N92SLTB8JqASJB14ZLHHzFnBV8mG9zw4K7jghEFWuE=
|
||||
github.com/pkg/sftp v1.13.11/go.mod h1:uNkH9roSXglNJqM+glJJi+TQXQUm0fXFWqCFmT8hsN0=
|
||||
github.com/pkg/xattr v0.4.12 h1:rRTkSyFNTRElv6pkA3zpjHpQ90p/OdHQC1GmGh1aTjM=
|
||||
github.com/pkg/xattr v0.4.12/go.mod h1:di8WF84zAKk8jzR1UBTEWh9AUlIZZ7M/JNt8e9B6ktU=
|
||||
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo=
|
||||
@@ -1063,8 +1063,8 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5X
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/rdleal/intervalst v1.5.0 h1:SEB9bCFz5IqD1yhfH1Wv8IBnY/JQxDplwkxHjT6hamU=
|
||||
github.com/rdleal/intervalst v1.5.0/go.mod h1:xO89Z6BC+LQDH+IPQQw/OESt5UADgFD41tYMUINGpxQ=
|
||||
github.com/redis/go-redis/v9 v9.23.0 h1:/TTVdJa8BRNsybwwGGnmiYktHNlUXtbOQxlWpHBPL3s=
|
||||
github.com/redis/go-redis/v9 v9.23.0/go.mod h1:EWP2UUk+XDaI1s5nQB5mablZN6vccXlmBQTyfnF87D0=
|
||||
github.com/redis/go-redis/v9 v9.22.0 h1:laDvpYXTJtZLloinw1fA5Kqd6HAEH2XKxOkG/PDq2F0=
|
||||
github.com/redis/go-redis/v9 v9.22.0/go.mod h1:y2g0Wj8rQvuK0ELM+oxSudcLtC09JScs98I/X9gRWY4=
|
||||
github.com/redis/rueidis v1.0.77 h1:ZR41bgJcm7oRFb3aSDPrRhC0eonDSrPzjvvZvHIlNjM=
|
||||
github.com/redis/rueidis v1.0.77/go.mod h1:L8mnCQJJaSNL6I4pIR6Rz732HTGS9vmuXm0yT9dRvjo=
|
||||
github.com/redis/rueidis/rueidiscompat v1.0.77 h1:S1xiLQsFv8XQ46e0LelC8ihGqbDzVRocXXZLzVAeh64=
|
||||
@@ -1155,8 +1155,8 @@ github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
|
||||
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
|
||||
github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY=
|
||||
github.com/spiffe/go-spiffe/v2 v2.8.2 h1:jUEsvCMD6fH25J8K/w3q/XnIx8W1lb8+YLaEEHIjHmc=
|
||||
github.com/spiffe/go-spiffe/v2 v2.8.2/go.mod h1:w2CLWKLMTX/PPYUEUPv3ltH0RXsw5S8suwNF46w9/Aw=
|
||||
github.com/spiffe/go-spiffe/v2 v2.8.1 h1:eXZMLsu+3MLEPJyGJkolqtVrteZfQdUpOWj6LTiDl/E=
|
||||
github.com/spiffe/go-spiffe/v2 v2.8.1/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
@@ -1633,10 +1633,10 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY
|
||||
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
|
||||
google.golang.org/genproto v0.0.0-20260904194346-d0f1323225a4 h1:6QRNo34FxJcE1LG6XfnmaQ17m6w21oXaKlKoBaF+UqE=
|
||||
google.golang.org/genproto v0.0.0-20260904194346-d0f1323225a4/go.mod h1:eifJ91nefXnfP/bMkZsACVGm14ZtEL4eUXRLTryfbY4=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260921155816-b14227669459 h1:GS9OIt/j7c8bvBjYNgnKQysVfmV7e4jM0H8ZK95G4t8=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260921155816-b14227669459/go.mod h1:PX5/4vemwVoXtwEcRDWwcR1/r0qrosfx3qoVADMwnVE=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260921155816-b14227669459 h1:b0xCahf3FK2m2Cv0p4vTozGPWncCvLfwV86UNg8xWU8=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260921155816-b14227669459/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260904194346-d0f1323225a4 h1:NCe/UiklGd/9xjT+ROBVhJ1kf6TRQaFedsR+z7u1gvo=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260904194346-d0f1323225a4/go.mod h1:fJ2lYaWjqNknJyQBOCd0fA3HnEElJqGplH71a2txi+g=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260904194346-d0f1323225a4 h1:5t+ZydAFj5kGVLrgCvLmpmCf9ylGRd64hpEronfRaws=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260904194346-d0f1323225a4/go.mod h1:DjtHYE8FKJLivXcBEjGwndXfIC23G0VpXiXKqG179uA=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
@@ -1647,8 +1647,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv
|
||||
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
||||
google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
||||
google.golang.org/grpc v1.86.0-dev.0.20261027044109-d619b5d02089 h1:8300TIaXaOq+IoVmVzsZKUP3z4PpTsxu0ArPkPV/4Ts=
|
||||
google.golang.org/grpc v1.86.0-dev.0.20261027044109-d619b5d02089/go.mod h1:Zr6uoNHvZlKOMmDEULT/cdZrN8qcSkXRXPkw4ybjoxI=
|
||||
google.golang.org/grpc v1.85.0-dev.0.20260915183914-4e49413dcab7 h1:5+EEM1fC0yjOZID0NUZVrE2+8M/+1TclNrSz/l1xMYs=
|
||||
google.golang.org/grpc v1.85.0-dev.0.20260915183914-4e49413dcab7/go.mod h1:Ovl0ECo4xx5r4kn/6d4BPSNB7OIFuu6EAjOzjtVAKaM=
|
||||
google.golang.org/grpc/examples v0.0.0-20250407062114-b368379ef8f6 h1:ExN12ndbJ608cboPYflpTny6mXSzPrDLh0iTaVrRrds=
|
||||
google.golang.org/grpc/examples v0.0.0-20250407062114-b368379ef8f6/go.mod h1:6ytKWczdvnpnO+m+JiG9NjEDzR1FJfsnmJdG7B8QVZ8=
|
||||
google.golang.org/grpc/security/advancedtls v1.0.0 h1:/KQ7VP/1bs53/aopk9QhuPyFAp9Dm9Ejix3lzYkCrDA=
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
apiVersion: v1
|
||||
description: SeaweedFS
|
||||
name: seaweedfs
|
||||
appVersion: "4.51"
|
||||
appVersion: "4.49"
|
||||
# Dev note: Trigger a helm chart release by `git tag -a helm-<version>`
|
||||
version: 4.51.0
|
||||
version: 4.49.0
|
||||
@@ -23,7 +23,7 @@ helm install --values=values.yaml seaweedfs seaweedfs/seaweedfs
|
||||
* master/filer/volume are stateful sets with anti-affinity on the hostname,
|
||||
so your deployment will be spread/HA.
|
||||
* leveldb2 is the default filer backend; a mysql-compatible database (memsql, ...) enables HA (multiple filer instances) and the backup/HA it can provide.
|
||||
* with `filer.extraEnvironmentVars.WEED_MYSQL_ENABLED` set to `"true"`, mysql user/password are created in a k8s secret (default: `<release>-seaweedfs-db-secret`) and injected to the filer with ENV. The secret is kept on `helm uninstall`, and a later install reuses the user and password in it, including ones you edited in. On any other store neither the secret nor the `WEED_MYSQL_*` env, plain or secret-backed, is rendered.
|
||||
* with `filer.extraEnvironmentVars.WEED_MYSQL_ENABLED` set to `"true"`, mysql user/password are created in a k8s secret (default: `<release>-seaweedfs-db-secret`) and injected to the filer with ENV. On any other store neither the secret nor the `WEED_MYSQL_*` env, plain or secret-backed, is rendered.
|
||||
* cert config exists and can be enabled, but not been tested, requires cert-manager to be installed.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@@ -138,11 +138,9 @@ spec:
|
||||
- name: {{ $key }}
|
||||
{{- if kindIs "string" $value }}
|
||||
value: {{ tpl $value $ | quote }}
|
||||
{{- else if kindIs "map" $value }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
{{ toYaml $value | nindent 16 | trim }}
|
||||
{{- else if not (kindIs "invalid" $value) }}
|
||||
value: {{ toJson $value | quote }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
{{- $secretExtraEnvironmentVars := .Values.admin.secretExtraEnvironmentVars }}
|
||||
|
||||
@@ -118,11 +118,9 @@ spec:
|
||||
- name: {{ $key }}
|
||||
{{- if kindIs "string" $value }}
|
||||
value: {{ tpl $value $ | quote }}
|
||||
{{- else if kindIs "map" $value }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
{{ toYaml $value | nindent 16 }}
|
||||
{{- else if not (kindIs "invalid" $value) }}
|
||||
value: {{ toJson $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -107,11 +107,9 @@ spec:
|
||||
- name: {{ $key }}
|
||||
{{- if kindIs "string" $value }}
|
||||
value: {{ tpl $value $ | quote }}
|
||||
{{- else if kindIs "map" $value }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
{{ toYaml $value | nindent 16 | trim }}
|
||||
{{- else if not (kindIs "invalid" $value) }}
|
||||
value: {{ toJson $value | quote }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
|
||||
@@ -101,77 +101,27 @@ spec:
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
{{- $mergedExtraEnvironmentVars := dict }}
|
||||
{{- include "seaweedfs.mergeExtraEnvironmentVars" (dict "global" .Values.global.seaweedfs "component" .Values.filer "target" $mergedExtraEnvironmentVars) }}
|
||||
{{- $secretExtraEnvironmentVars := .Values.filer.secretExtraEnvironmentVars | default dict }}
|
||||
{{- $emittedEarly := dict }}
|
||||
{{- if $mysqlEnabled }}
|
||||
- name: WEED_MYSQL_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "seaweedfs.fullname" . }}-db-secret
|
||||
key: user
|
||||
optional: true
|
||||
- name: WEED_MYSQL_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "seaweedfs.fullname" . }}-db-secret
|
||||
key: password
|
||||
optional: true
|
||||
{{- end }}
|
||||
- name: SEAWEEDFS_FULLNAME
|
||||
value: "{{ include "seaweedfs.fullname" . }}"
|
||||
{{- if and .Values.filer.s3.enabled .Values.filer.s3.enableAuth }}
|
||||
{{- include "seaweedfs.s3.credentialEnv" . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if $mysqlEnabled }}
|
||||
{{- /* Emit the mysql credentials and every var they reach through $(...)
|
||||
in dependency order, after the chart's own vars so references to
|
||||
them resolve too: Kubernetes only resolves a reference to a var
|
||||
declared earlier. A credential the user sets wins over the db
|
||||
secret's, secret-backed over plain. */}}
|
||||
{{- $early := dict "WEED_MYSQL_USERNAME" true "WEED_MYSQL_PASSWORD" true }}
|
||||
{{- $maxDiscover := int (add (len $mergedExtraEnvironmentVars) (len $secretExtraEnvironmentVars)) }}
|
||||
{{- range $round := until $maxDiscover }}
|
||||
{{- range $key := keys $early }}
|
||||
{{- $v := index $mergedExtraEnvironmentVars $key }}
|
||||
{{- if and (not (hasKey $secretExtraEnvironmentVars $key)) (kindIs "string" $v) }}
|
||||
{{- range $ref := regexFindAll `\$\([A-Za-z_][A-Za-z0-9_]*\)` (tpl $v $) -1 }}
|
||||
{{- $name := $ref | trimPrefix "$(" | trimSuffix ")" }}
|
||||
{{- if and (or (hasKey $mergedExtraEnvironmentVars $name) (hasKey $secretExtraEnvironmentVars $name)) (not (hasKey $early $name)) }}
|
||||
{{- $_ := set $early $name true }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $ordered := list "WEED_MYSQL_USERNAME" "WEED_MYSQL_PASSWORD" }}
|
||||
{{- range $key := keys $early | sortAlpha }}
|
||||
{{- if not (has $key $ordered) }}{{ $ordered = append $ordered $key }}{{ end }}
|
||||
{{- end }}
|
||||
{{- $maxRounds := int (len $ordered) }}
|
||||
{{- range $round := until $maxRounds }}
|
||||
{{- range $key := $ordered }}
|
||||
{{- if not (hasKey $emittedEarly $key) }}
|
||||
{{- $ready := true }}
|
||||
{{- $v := index $mergedExtraEnvironmentVars $key }}
|
||||
{{- if and (not (hasKey $secretExtraEnvironmentVars $key)) (kindIs "string" $v) }}
|
||||
{{- range $ref := regexFindAll `\$\([A-Za-z_][A-Za-z0-9_]*\)` (tpl $v $) -1 }}
|
||||
{{- $name := $ref | trimPrefix "$(" | trimSuffix ")" }}
|
||||
{{- if and (hasKey $early $name) (not (hasKey $emittedEarly $name)) }}{{- $ready = false }}{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or $ready (eq $round (sub $maxRounds 1)) }}
|
||||
- name: {{ $key }}
|
||||
{{- if hasKey $secretExtraEnvironmentVars $key }}
|
||||
valueFrom: {{ toYaml (index $secretExtraEnvironmentVars $key) | nindent 16 }}
|
||||
{{- else if hasKey $mergedExtraEnvironmentVars $key }}
|
||||
{{- if kindIs "string" $v }}
|
||||
value: {{ tpl $v $ | quote }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
{{ toYaml $v | nindent 16 | trim }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "seaweedfs.fullname" $ }}-db-secret
|
||||
key: {{ ternary "password" "user" (eq $key "WEED_MYSQL_PASSWORD") }}
|
||||
optional: true
|
||||
{{- end }}
|
||||
{{- $_ := set $emittedEarly $key true }}
|
||||
{{- $_ := unset $mergedExtraEnvironmentVars $key }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $mergedExtraEnvironmentVars := dict }}
|
||||
{{- include "seaweedfs.mergeExtraEnvironmentVars" (dict "global" .Values.global.seaweedfs "component" .Values.filer "target" $mergedExtraEnvironmentVars) }}
|
||||
{{- if not $mysqlEnabled }}
|
||||
{{- range $key := keys $mergedExtraEnvironmentVars }}
|
||||
{{- if hasPrefix "WEED_MYSQL_" $key }}
|
||||
@@ -180,25 +130,18 @@ spec:
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- range $key := keys $mergedExtraEnvironmentVars | sortAlpha }}
|
||||
{{- if hasKey $secretExtraEnvironmentVars $key }}
|
||||
- name: {{ $key }}
|
||||
valueFrom: {{ toYaml (index $secretExtraEnvironmentVars $key) | nindent 16 }}
|
||||
{{- else }}
|
||||
{{- $value := index $mergedExtraEnvironmentVars $key }}
|
||||
- name: {{ $key }}
|
||||
{{- if kindIs "string" $value }}
|
||||
value: {{ tpl $value $ | quote }}
|
||||
{{- else if kindIs "map" $value }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
{{ toYaml $value | nindent 16 | trim }}
|
||||
{{- else if not (kindIs "invalid" $value) }}
|
||||
value: {{ toJson $value | quote }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.filer.secretExtraEnvironmentVars }}
|
||||
{{- range $key, $value := .Values.filer.secretExtraEnvironmentVars }}
|
||||
{{- if and (or $mysqlEnabled (not (hasPrefix "WEED_MYSQL_" $key))) (not (hasKey $emittedEarly $key)) (not (hasKey $mergedExtraEnvironmentVars $key)) }}
|
||||
{{- if or $mysqlEnabled (not (hasPrefix "WEED_MYSQL_" $key)) }}
|
||||
- name: {{ $key }}
|
||||
valueFrom: {{ toYaml $value | nindent 16 }}
|
||||
{{- end }}
|
||||
@@ -227,6 +170,9 @@ spec:
|
||||
{{- if .Values.filer.metricsIp }}
|
||||
-metricsIp={{ .Values.filer.metricsIp }} \
|
||||
{{- end }}
|
||||
{{- if .Values.filer.redirectOnRead }}
|
||||
-redirectOnRead \
|
||||
{{- end }}
|
||||
{{- if .Values.filer.disableHttp }}
|
||||
-disableHttp \
|
||||
{{- end }}
|
||||
|
||||
@@ -105,11 +105,9 @@ spec:
|
||||
- name: {{ $key }}
|
||||
{{- if kindIs "string" $value }}
|
||||
value: {{ tpl $value $ | quote }}
|
||||
{{- else if kindIs "map" $value }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
{{ toYaml $value | nindent 16 | trim }}
|
||||
{{- else if not (kindIs "invalid" $value) }}
|
||||
value: {{ toJson $value | quote }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
command:
|
||||
|
||||
@@ -110,11 +110,9 @@ spec:
|
||||
- name: {{ $key }}
|
||||
{{- if kindIs "string" $value }}
|
||||
value: {{ tpl $value $ | quote }}
|
||||
{{- else if kindIs "map" $value }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
{{ toYaml $value | nindent 16 | trim }}
|
||||
{{- else if not (kindIs "invalid" $value) }}
|
||||
value: {{ toJson $value | quote }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
command:
|
||||
|
||||
@@ -101,11 +101,9 @@ spec:
|
||||
- name: {{ $key }}
|
||||
{{- if kindIs "string" $value }}
|
||||
value: {{ tpl $value $ | quote }}
|
||||
{{- else if kindIs "map" $value }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
{{ toYaml $value | nindent 16 | trim }}
|
||||
{{- else if not (kindIs "invalid" $value) }}
|
||||
value: {{ toJson $value | quote }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
command:
|
||||
|
||||
@@ -124,11 +124,9 @@ spec:
|
||||
- name: {{ $key }}
|
||||
{{- if kindIs "string" $value }}
|
||||
value: {{ tpl $value $ | quote }}
|
||||
{{- else if kindIs "map" $value }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
{{ toYaml $value | nindent 14 | trim }}
|
||||
{{- else if not (kindIs "invalid" $value) }}
|
||||
value: {{ toJson $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
{{- if and .Values.filer.enabled (include "seaweedfs.filer.mysqlEnabled" .) }}
|
||||
{{- /* Kept on uninstall, but the pre-install hook recreates it on the next install:
|
||||
reuse the stored user and password so the filer can still log in. */}}
|
||||
{{- $existing := lookup "v1" "Secret" .Release.Namespace (printf "%s-db-secret" (include "seaweedfs.fullname" .)) }}
|
||||
{{- $data := ($existing | default dict).data | default dict }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
type: Opaque
|
||||
@@ -12,14 +8,13 @@ metadata:
|
||||
annotations:
|
||||
"helm.sh/resource-policy": keep
|
||||
"helm.sh/hook": "pre-install"
|
||||
"helm.sh/hook-delete-policy": "before-hook-creation"
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "seaweedfs.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
stringData:
|
||||
user: {{ if $data.user }}{{ b64dec $data.user | quote }}{{ else }}"YourSWUser"{{ end }}
|
||||
# generated on first install, reused afterwards
|
||||
password: {{ if $data.password }}{{ b64dec $data.password | quote }}{{ else }}{{ randAlphaNum 10 | sha256sum | b64enc | trunc 32 }}{{ end }}
|
||||
user: "YourSWUser"
|
||||
# auto-generated password
|
||||
password: {{ randAlphaNum 10 | sha256sum | b64enc | trunc 32 }}
|
||||
{{- end }}
|
||||
@@ -152,11 +152,9 @@ spec:
|
||||
- name: {{ $key }}
|
||||
{{- if kindIs "string" $value }}
|
||||
value: {{ tpl $value $ | quote }}
|
||||
{{- else if kindIs "map" $value }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
{{ toYaml $value | nindent 16 | trim }}
|
||||
{{- else if not (kindIs "invalid" $value) }}
|
||||
value: {{ toJson $value | quote }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
command:
|
||||
|
||||
@@ -104,11 +104,9 @@ spec:
|
||||
- name: {{ $key }}
|
||||
{{- if kindIs "string" $value }}
|
||||
value: {{ tpl $value $ | quote }}
|
||||
{{- else if kindIs "map" $value }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
{{ toYaml $value | nindent 16 | trim }}
|
||||
{{- else if not (kindIs "invalid" $value) }}
|
||||
value: {{ toJson $value | quote }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
command:
|
||||
|
||||
@@ -740,6 +740,9 @@ filer:
|
||||
# encrypt data on volume servers
|
||||
encryptVolumeData: false
|
||||
|
||||
# Whether proxy or redirect to volume server during file GET request
|
||||
redirectOnRead: false
|
||||
|
||||
# Limit sub dir listing size (default 100000)
|
||||
dirListLimit: 100000
|
||||
|
||||
|
||||
+1094
-1003
File diff suppressed because it is too large.
Load diff
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 55 KiB |
@@ -34,7 +34,7 @@
|
||||
<protobuf.version>3.25.5</protobuf.version>
|
||||
<!-- follow https://github.com/grpc/grpc-java -->
|
||||
<grpc.version>1.77.0</grpc.version>
|
||||
<guava.version>33.7.2-jre</guava.version>
|
||||
<guava.version>32.0.0-jre</guava.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -166,10 +166,6 @@ message Entry {
|
||||
repeated FileChunk chunks = 3;
|
||||
FuseAttributes attributes = 4;
|
||||
map<string, bytes> extended = 5;
|
||||
// filer-local commit timestamp of the version stored here: the meta log
|
||||
// event's ts_ns for the mutation that produced this entry, or 0 for
|
||||
// entries written before the field existed
|
||||
int64 commit_ts_ns = 6;
|
||||
bytes hard_link_id = 7;
|
||||
int32 hard_link_counter = 8; // only exists in hard link meta data
|
||||
bytes content = 9; // if not empty, the file content
|
||||
@@ -285,7 +281,6 @@ message WriteCondition {
|
||||
IF_EXTENDED_NOT_EQUAL = 7; // fail if present and extended[ext_key] == ext_value
|
||||
IF_EXTENDED_TIME_ELAPSED = 8; // fail if present and extended[ext_key] (unix seconds) is in the future
|
||||
IF_CHUNKS_EQUAL = 9; // fail unless the stored chunk fid multiset equals fids (absent entry = no chunks)
|
||||
IF_ENTRY_EQUAL = 10; // fail unless the stored entry equals expected_entry
|
||||
}
|
||||
// Clause is one primitive comparison. IF_ETAG_MATCH holds when the current
|
||||
// entry's ETag equals any value in etags; IF_ETAG_NOT_MATCH holds when it
|
||||
@@ -314,7 +309,6 @@ message WriteCondition {
|
||||
string gate_key = 7; // IF_EXTENDED_TIME_ELAPSED: only enforce when extended[gate_key] == gate_value
|
||||
string gate_value = 8; // gate value (e.g. retention mode COMPLIANCE for governance bypass)
|
||||
repeated string fids = 9; // chunk fid strings for IF_CHUNKS_EQUAL
|
||||
Entry expected_entry = 10; // whole-entry comparison for IF_ENTRY_EQUAL
|
||||
}
|
||||
repeated Clause clauses = 1; // all must hold (logical AND)
|
||||
}
|
||||
@@ -329,7 +323,6 @@ enum FilerError {
|
||||
EXISTING_IS_FILE = 4; // cannot overwrite file with directory
|
||||
ENTRY_ALREADY_EXISTS = 5; // O_EXCL and entry already exists
|
||||
PRECONDITION_FAILED = 6; // WriteCondition not satisfied
|
||||
READ_ONLY = 7; // path matches a read-only storage rule (e.g. bucket over quota)
|
||||
}
|
||||
|
||||
// ObjectMutation is one entry-level change applied by ObjectTransaction. All
|
||||
@@ -358,7 +351,6 @@ message ObjectMutation {
|
||||
bytes content = 11; // PATCH_EXTENDED: new Entry.content when set_content
|
||||
bool touch_mtime = 12; // PATCH_EXTENDED: set the entry's Mtime to now (e.g. a metadata-replace copy)
|
||||
bool remove_empty_parent = 13; // DELETE: also remove the parent directory when the delete leaves it empty (best-effort)
|
||||
bool keep_remote_object = 14; // DELETE: leave the object on the mounted remote storage
|
||||
}
|
||||
|
||||
// Recompute re-derives a pointer entry (directory/name on the mutation) from the
|
||||
@@ -396,8 +388,6 @@ message ObjectTransactionRequest {
|
||||
string condition_key = 6; // if set, evaluate the condition against this entry instead of lock_key (still locking lock_key)
|
||||
string route_key = 7; // ring key identifying the owner filer; a non-owner forwards the whole transaction to it
|
||||
bool is_moved = 8; // set on a forwarded transaction so the receiver applies it locally instead of forwarding again
|
||||
string request_id = 9; // idempotency token: the owner records the outcome and replays it on a retried request instead of re-applying
|
||||
string condition_alt_key = 10; // if the condition's entry is absent, evaluate it against this entry instead (e.g. null slot, else latest version)
|
||||
}
|
||||
|
||||
message ObjectTransactionResponse {
|
||||
@@ -487,7 +477,6 @@ message UpdateEntryRequest {
|
||||
// the write, under the filer's per-path lock. The caller must route the
|
||||
// key's writes to this entry's owner filer for the check to be authoritative.
|
||||
WriteCondition condition = 6;
|
||||
bool is_moved = 7; // set on a forwarded request so the owner applies it locally
|
||||
}
|
||||
message UpdateEntryResponse {
|
||||
SubscribeMetadataResponse metadata_event = 1;
|
||||
@@ -524,14 +513,7 @@ message DeleteEntryRequest {
|
||||
bool ignore_recursive_error = 6;
|
||||
bool is_from_other_cluster = 7;
|
||||
repeated int32 signatures = 8;
|
||||
int64 if_not_modified_after = 9; // unix time in seconds
|
||||
bool keep_remote_object = 10;
|
||||
int64 if_not_modified_after_ns = 11; // unix time in nanoseconds; overrides if_not_modified_after when set
|
||||
// Optional precondition evaluated against the entry atomically with the
|
||||
// delete, under the filer's per-path lock. The request is routed to the
|
||||
// entry's owner filer for the check to be authoritative.
|
||||
map<string, bytes> expected_extended = 12;
|
||||
bool is_moved = 13; // set on a forwarded request so the owner applies it locally
|
||||
int64 if_not_modified_after = 9;
|
||||
}
|
||||
|
||||
message DeleteEntryResponse {
|
||||
@@ -591,9 +573,6 @@ message AssignVolumeResponse {
|
||||
// fsync is the storage rule's fsync decision for the assigned path, so the
|
||||
// client can carry it onto the volume server upload request.
|
||||
bool fsync = 11;
|
||||
// error_code classifies error for callers that must branch on it; error
|
||||
// keeps the human-readable text for clients that predate the field.
|
||||
FilerError error_code = 12;
|
||||
}
|
||||
|
||||
message LookupVolumeRequest {
|
||||
@@ -730,10 +709,6 @@ message TraverseBfsMetadataRequest {
|
||||
message TraverseBfsMetadataResponse {
|
||||
string directory = 1;
|
||||
Entry entry = 2;
|
||||
// The sender's per-path commit timestamp (see meta_path_ts.go): the newest
|
||||
// event time this filer committed for the path, 0 when unrecorded so
|
||||
// subscribers fall back to the entry's mtime.
|
||||
int64 entry_ts_ns = 3;
|
||||
}
|
||||
|
||||
message LogEntry {
|
||||
@@ -796,8 +771,7 @@ message FilerConf {
|
||||
string replication = 3;
|
||||
string ttl = 4;
|
||||
string disk_type = 5;
|
||||
// unset inherits from the enclosing path rule, set overrides it
|
||||
optional bool fsync = 6;
|
||||
bool fsync = 6;
|
||||
uint32 volume_growth_count = 7;
|
||||
bool read_only = 8;
|
||||
string data_center = 9;
|
||||
@@ -872,7 +846,6 @@ message Lock {
|
||||
int64 generation = 5;
|
||||
bool is_backup = 6;
|
||||
int64 seq = 7;
|
||||
string prev_renew_token = 8;
|
||||
}
|
||||
message TransferLocksRequest {
|
||||
repeated Lock locks = 1;
|
||||
@@ -887,7 +860,6 @@ message ReplicateLockRequest {
|
||||
int64 generation = 5;
|
||||
bool is_unlock = 6;
|
||||
int64 seq = 7;
|
||||
string prev_renew_token = 8;
|
||||
}
|
||||
message ReplicateLockResponse {
|
||||
}
|
||||
|
||||
Generated
-6836
File diff suppressed because it is too large.
Load diff
@@ -1,29 +0,0 @@
|
||||
# Vector query engine for SeaweedFS Lance table buckets.
|
||||
#
|
||||
# `core` is the engine: open a table through the Lance namespace and run
|
||||
# top-K over it. The crate layout follows vector_buckets.md; a `server`
|
||||
# crate with the VectorService gRPC endpoint lands with the S3 Vectors
|
||||
# milestone.
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = ["crates/core", "crates/server"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
# The edition needs 1.85; the lance dependency tree needs more. Same floor as
|
||||
# seaweed-worker, which this workspace path-depends on.
|
||||
rust-version = "1.94.1"
|
||||
|
||||
# No common root manifest links this tree to seaweed-worker or
|
||||
# seaweed-common; keep the lint policy identical to theirs.
|
||||
[workspace.lints.clippy]
|
||||
needless_update = "allow"
|
||||
undocumented_unsafe_blocks = "warn"
|
||||
|
||||
[workspace.dependencies]
|
||||
anyhow = "1"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tokio-stream = "0.1"
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
@@ -1,43 +0,0 @@
|
||||
[package]
|
||||
name = "weed-vector-core"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
description = "Vector query engine over SeaweedFS Lance table buckets"
|
||||
|
||||
[lib]
|
||||
name = "weed_vector_core"
|
||||
|
||||
[[bin]]
|
||||
name = "weed-vector-cli"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
# The catalog client and dataset-opening helper the maintenance worker uses.
|
||||
# A path dependency because the two trees are separate cargo workspaces with
|
||||
# no common root manifest.
|
||||
weed-lance-worker = { path = "../../../seaweed-worker/crates/lance" }
|
||||
lance = { version = "10", default-features = false, features = ["aws"] }
|
||||
object_store = "0.13"
|
||||
lance-index = "10"
|
||||
lance-linalg = "10"
|
||||
lance-table = "10"
|
||||
arrow-array = "58"
|
||||
arrow-cast = "58"
|
||||
arrow-schema = "58"
|
||||
roaring = "0.11"
|
||||
anyhow.workspace = true
|
||||
clap = { version = "4", features = ["derive", "env"] }
|
||||
futures = "0.3"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
tokio.workspace = true
|
||||
tracing.workspace = true
|
||||
uuid = { version = "1", features = ["v4"] }
|
||||
tracing-subscriber.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -1,207 +0,0 @@
|
||||
//! Which fragments the vector index covers, and which it has not reached yet.
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use lance::Dataset;
|
||||
use lance::index::DatasetIndexExt;
|
||||
use roaring::RoaringBitmap;
|
||||
|
||||
/// How much of the dataset one named index covers at this version.
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
pub struct IndexCoverage {
|
||||
pub index_name: String,
|
||||
/// Physical index segments: the IndexMetadata deltas sharing the name.
|
||||
pub segments: usize,
|
||||
/// False when any delta of this index lacks a fragment bitmap: the index
|
||||
/// exists but which fragments it covers is unknown.
|
||||
pub coverage_known: bool,
|
||||
pub indexed_fragments: Vec<u64>,
|
||||
pub unindexed_fragments: Vec<u64>,
|
||||
pub unindexed_rows: usize,
|
||||
}
|
||||
|
||||
/// Coverage for every index built on `vector_column` at this version.
|
||||
pub async fn coverage(dataset: &Dataset, vector_column: &str) -> Result<Vec<IndexCoverage>> {
|
||||
let field = dataset
|
||||
.schema()
|
||||
.field(vector_column)
|
||||
.with_context(|| format!("no such column {vector_column}"))?;
|
||||
let mut by_name: BTreeMap<String, Vec<Option<RoaringBitmap>>> = BTreeMap::new();
|
||||
for index in dataset.load_indices().await?.iter() {
|
||||
if index.fields != [field.id] {
|
||||
continue;
|
||||
}
|
||||
by_name
|
||||
.entry(index.name.clone())
|
||||
.or_default()
|
||||
.push(index.fragment_bitmap.clone());
|
||||
}
|
||||
let all: RoaringBitmap = dataset.fragments().iter().map(|f| f.id as u32).collect();
|
||||
let mut out = Vec::new();
|
||||
for (name, bitmaps) in by_name {
|
||||
let coverage_known = bitmaps.iter().all(|b| b.is_some());
|
||||
let mut indexed = RoaringBitmap::new();
|
||||
for bitmap in bitmaps.iter().flatten() {
|
||||
indexed |= bitmap;
|
||||
}
|
||||
// The bitmap records what the index covered when built; fragments
|
||||
// the manifest has since dropped are not part of this version.
|
||||
let indexed = indexed & &all;
|
||||
let unindexed = &all - &indexed;
|
||||
let mut unindexed_rows = 0;
|
||||
for fragment in dataset.get_fragments() {
|
||||
// physical_rows counts deleted rows too, and may be absent in the
|
||||
// manifest; count live rows instead.
|
||||
if unindexed.contains(fragment.id() as u32) {
|
||||
unindexed_rows += fragment.count_rows(None).await?;
|
||||
}
|
||||
}
|
||||
out.push(IndexCoverage {
|
||||
index_name: name,
|
||||
segments: bitmaps.len(),
|
||||
coverage_known,
|
||||
indexed_fragments: indexed.iter().map(|id| id as u64).collect(),
|
||||
unindexed_rows,
|
||||
unindexed_fragments: unindexed.iter().map(|id| id as u64).collect(),
|
||||
});
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::query::{Query, ann, flat};
|
||||
use crate::table::VectorTable;
|
||||
use crate::testing::{DIM, append_dataset, vectors, write_dataset};
|
||||
use lance::index::vector::VectorIndexParams;
|
||||
use lance_index::IndexType;
|
||||
use lance_linalg::distance::DistanceType;
|
||||
use tempfile::TempDir;
|
||||
|
||||
async fn indexed_dataset(dir: &TempDir, tags: &[&str]) -> Dataset {
|
||||
let mut dataset = write_dataset(dir, &vectors(tags.len(), DIM), tags).await;
|
||||
let params = VectorIndexParams::ivf_flat(4, DistanceType::L2);
|
||||
dataset
|
||||
.create_index(
|
||||
&["vector"],
|
||||
IndexType::Vector,
|
||||
Some("vidx".to_string()),
|
||||
¶ms,
|
||||
true,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
dataset.checkout_latest().await.unwrap();
|
||||
dataset
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn coverage_reports_the_unindexed_fragment() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let mut dataset = indexed_dataset(&dir, &["a"; 64]).await;
|
||||
append_dataset(&mut dataset, &vectors(4, DIM), &["b"; 4]).await;
|
||||
|
||||
let coverages = coverage(&dataset, "vector").await.unwrap();
|
||||
assert_eq!(coverages.len(), 1);
|
||||
let cov = &coverages[0];
|
||||
assert_eq!(cov.index_name, "vidx");
|
||||
assert_eq!(cov.segments, 1);
|
||||
assert_eq!(cov.indexed_fragments, vec![0]);
|
||||
assert_eq!(cov.unindexed_fragments.len(), 1);
|
||||
assert_eq!(cov.unindexed_rows, 4);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn ann_searches_unindexed_fragments() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let mut dataset = indexed_dataset(&dir, &["a"; 64]).await;
|
||||
append_dataset(&mut dataset, &[vec![9.0; DIM]], &["b"]).await;
|
||||
let table = VectorTable::resolve(&dataset, None, None).unwrap();
|
||||
|
||||
let hits = ann(
|
||||
&dataset,
|
||||
&table,
|
||||
&Query {
|
||||
vector: vec![9.0; DIM],
|
||||
k: 1,
|
||||
filter: None,
|
||||
postfilter: false,
|
||||
distance: DistanceType::L2,
|
||||
nprobes: Some(4),
|
||||
index_segments: None,
|
||||
fragments: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(hits.len(), 1);
|
||||
assert_eq!(hits[0].key, "k64");
|
||||
assert!(hits[0].distance < 1e-6);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn prefiltered_ann_matches_filtered_flat() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let tags: Vec<&str> = (0..64)
|
||||
.map(|i| if i % 2 == 0 { "a" } else { "b" })
|
||||
.collect();
|
||||
let mut dataset = indexed_dataset(&dir, &tags).await;
|
||||
append_dataset(&mut dataset, &vectors(4, DIM), &["a"; 4]).await;
|
||||
let table = VectorTable::resolve(&dataset, None, None).unwrap();
|
||||
|
||||
let query = Query {
|
||||
vector: vectors(1, DIM).remove(0),
|
||||
k: 10,
|
||||
filter: Some("tag = 'a'".to_string()),
|
||||
postfilter: false,
|
||||
distance: DistanceType::L2,
|
||||
nprobes: Some(4),
|
||||
index_segments: None,
|
||||
fragments: None,
|
||||
};
|
||||
let filtered = ann(&dataset, &table, &query).await.unwrap();
|
||||
let exact = flat(&dataset, &table, &query).await.unwrap();
|
||||
// equal-distance hits have no specified order between the two scans
|
||||
let mut filtered_keys = filtered.iter().map(|h| &h.key).collect::<Vec<_>>();
|
||||
let mut exact_keys = exact.iter().map(|h| &h.key).collect::<Vec<_>>();
|
||||
filtered_keys.sort();
|
||||
exact_keys.sort();
|
||||
assert_eq!(filtered_keys, exact_keys);
|
||||
assert!(filtered.len() <= 10);
|
||||
assert!(filtered.iter().all(|h| h.key != "k1"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn pinned_version_ignores_newer_commits() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let mut dataset = write_dataset(&dir, &vectors(4, DIM), &["a"; 4]).await;
|
||||
let pinned = dataset
|
||||
.checkout_version(dataset.version().version)
|
||||
.await
|
||||
.unwrap();
|
||||
append_dataset(&mut dataset, &vectors(4, DIM), &["b"; 4]).await;
|
||||
|
||||
assert_eq!(pinned.count_rows(None).await.unwrap(), 4);
|
||||
let table = VectorTable::resolve(&pinned, None, None).unwrap();
|
||||
let hits = flat(
|
||||
&pinned,
|
||||
&table,
|
||||
&Query {
|
||||
vector: vectors(1, DIM).remove(0),
|
||||
k: 10,
|
||||
filter: None,
|
||||
postfilter: false,
|
||||
distance: DistanceType::L2,
|
||||
nprobes: None,
|
||||
index_segments: None,
|
||||
fragments: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(hits.len(), 4);
|
||||
assert!(hits.iter().all(|h| h.row_id < 4));
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
//! Vector queries over the Lance tables the SeaweedFS namespace registers.
|
||||
//!
|
||||
//! A table bucket's rows carry a key column, a fixed-size float vector column,
|
||||
//! and metadata columns. This crate resolves that layout and runs top-K over
|
||||
//! the whole dataset: index-accelerated where an ANN index exists, exact where
|
||||
//! it does not, always covering the fragments no index has reached yet.
|
||||
|
||||
pub mod coverage;
|
||||
pub mod maintenance;
|
||||
pub mod query;
|
||||
pub mod segments;
|
||||
pub mod table;
|
||||
#[cfg(test)]
|
||||
mod testing;
|
||||
#[cfg(test)]
|
||||
mod verify;
|
||||
|
||||
pub use coverage::IndexCoverage;
|
||||
pub use query::{Hit, Query};
|
||||
pub use table::VectorTable;
|
||||
@@ -1,307 +0,0 @@
|
||||
use anyhow::{Context, Result, bail};
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
use weed_lance_worker::catalog::{NamespaceClient, parse_id};
|
||||
use weed_lance_worker::dataset::{self, FallbackOptions};
|
||||
use weed_vector_core::coverage;
|
||||
use weed_vector_core::query::{self, Query};
|
||||
use weed_vector_core::table::VectorTable;
|
||||
|
||||
/// Mirrors `weed-worker`'s flags where the two touch the same thing: the
|
||||
/// namespace is WEED_LANCE_NAMESPACE and the fallback storage credentials are
|
||||
/// the same env vars.
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(name = "weed-vector", about = "SeaweedFS vector query spike")]
|
||||
struct Args {
|
||||
/// Lance namespace the tables live in.
|
||||
#[arg(
|
||||
long,
|
||||
default_value = "http://localhost:9101",
|
||||
env = "WEED_LANCE_NAMESPACE"
|
||||
)]
|
||||
namespace: String,
|
||||
|
||||
/// Storage credentials to use where the namespace vends none.
|
||||
#[arg(long, env = "WEED_S3_ACCESS_KEY")]
|
||||
access_key: Option<String>,
|
||||
|
||||
#[arg(long, env = "WEED_S3_SECRET_KEY")]
|
||||
secret_key: Option<String>,
|
||||
|
||||
#[command(subcommand)]
|
||||
command: Command,
|
||||
}
|
||||
|
||||
#[derive(Subcommand, Debug)]
|
||||
enum Command {
|
||||
/// A table's location, version, vector layout and index coverage.
|
||||
Describe {
|
||||
/// Delimiter-joined table id, e.g. bucket$table.
|
||||
id: String,
|
||||
#[arg(long)]
|
||||
vector_column: Option<String>,
|
||||
#[arg(long)]
|
||||
key_column: Option<String>,
|
||||
},
|
||||
/// Which fragments each vector index covers.
|
||||
Coverage {
|
||||
id: String,
|
||||
#[arg(long)]
|
||||
vector_column: Option<String>,
|
||||
#[arg(long)]
|
||||
key_column: Option<String>,
|
||||
},
|
||||
/// A top-K query over the whole dataset.
|
||||
Query {
|
||||
id: String,
|
||||
/// Comma-separated floats, e.g. --vector 0.1,0.2,0.3,0.4
|
||||
#[arg(long, allow_hyphen_values = true)]
|
||||
vector: String,
|
||||
#[arg(long, default_value = "10")]
|
||||
k: usize,
|
||||
/// Lance SQL filter over the metadata columns.
|
||||
#[arg(long)]
|
||||
filter: Option<String>,
|
||||
/// l2, cosine or dot.
|
||||
#[arg(long, default_value = "l2")]
|
||||
metric: String,
|
||||
/// Exact scan, no index.
|
||||
#[arg(long)]
|
||||
flat: bool,
|
||||
/// Filter the top-K rows after ranking (Lance's default); off keeps
|
||||
/// the filter before the ANN search.
|
||||
#[arg(long)]
|
||||
postfilter: bool,
|
||||
/// Pin the query to this committed version.
|
||||
#[arg(long)]
|
||||
version: Option<u64>,
|
||||
#[arg(long)]
|
||||
vector_column: Option<String>,
|
||||
#[arg(long)]
|
||||
key_column: Option<String>,
|
||||
#[arg(long)]
|
||||
nprobes: Option<usize>,
|
||||
},
|
||||
/// Fetch rows by key.
|
||||
Get {
|
||||
id: String,
|
||||
keys: Vec<String>,
|
||||
#[arg(long)]
|
||||
vector_column: Option<String>,
|
||||
#[arg(long)]
|
||||
key_column: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
/// `id` is a delimiter-joined table id; when it looks like a URI (`s3://...`,
|
||||
/// `/path/...`, `file://...`) the dataset is opened directly, skipping the
|
||||
/// namespace — useful for a spike run against a local dataset.
|
||||
async fn open_dataset(
|
||||
client: &NamespaceClient,
|
||||
id: &str,
|
||||
fallback: &FallbackOptions,
|
||||
) -> Result<lance::Dataset> {
|
||||
if id.contains("://") || id.starts_with('/') {
|
||||
let mut builder = lance::dataset::builder::DatasetBuilder::from_uri(id);
|
||||
if !fallback.is_empty() {
|
||||
builder = builder.with_storage_options(fallback.clone());
|
||||
}
|
||||
return builder.load().await.with_context(|| format!("open {id}"));
|
||||
}
|
||||
let table = dataset::open(client, &parse_id(id), fallback).await?;
|
||||
Ok(table.dataset)
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
weed_lance_worker::tls::install_default_crypto_provider();
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(
|
||||
tracing_subscriber::EnvFilter::try_from_default_env()
|
||||
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info")),
|
||||
)
|
||||
.init();
|
||||
let args = Args::parse();
|
||||
|
||||
let mut fallback = FallbackOptions::new();
|
||||
if let (Some(access), Some(secret)) = (args.access_key, args.secret_key) {
|
||||
fallback.insert("aws_access_key_id".to_string(), access);
|
||||
fallback.insert("aws_secret_access_key".to_string(), secret);
|
||||
}
|
||||
let client = NamespaceClient::new(args.namespace).with_fallback(&fallback);
|
||||
|
||||
match args.command {
|
||||
Command::Describe {
|
||||
id,
|
||||
vector_column,
|
||||
key_column,
|
||||
} => {
|
||||
let dataset = open_dataset(&client, &id, &fallback).await?;
|
||||
let schema: arrow_schema::Schema = dataset.schema().into();
|
||||
let resolved =
|
||||
VectorTable::resolve(&dataset, vector_column.as_deref(), key_column.as_deref());
|
||||
let vector = match resolved {
|
||||
Err(e) if vector_column.is_some() || key_column.is_some() => return Err(e),
|
||||
r => r.ok(),
|
||||
};
|
||||
let coverages = match &vector {
|
||||
Some(v) => coverage::coverage(&dataset, &v.vector_column).await?,
|
||||
None => Vec::new(),
|
||||
};
|
||||
println!(
|
||||
"{}",
|
||||
serde_json::json!({
|
||||
"id": id,
|
||||
"uri": dataset.uri(),
|
||||
"version": dataset.version().version,
|
||||
"fragments": dataset.get_fragments().len(),
|
||||
"rows": dataset.count_rows(None).await?,
|
||||
"schema": schema.fields().iter().map(|f| serde_json::json!({
|
||||
"name": f.name(),
|
||||
"type": f.data_type().to_string(),
|
||||
"nullable": f.is_nullable(),
|
||||
})).collect::<Vec<_>>(),
|
||||
"vector": vector.map(|v| serde_json::json!({
|
||||
"vector_column": v.vector_column,
|
||||
"dimension": v.dimension,
|
||||
"key_column": v.key_column,
|
||||
"metadata_columns": v.metadata_columns,
|
||||
})),
|
||||
"coverage": coverages,
|
||||
})
|
||||
);
|
||||
}
|
||||
Command::Coverage {
|
||||
id,
|
||||
vector_column,
|
||||
key_column,
|
||||
} => {
|
||||
let dataset = open_dataset(&client, &id, &fallback).await?;
|
||||
let vector =
|
||||
VectorTable::resolve(&dataset, vector_column.as_deref(), key_column.as_deref())?;
|
||||
let coverages = coverage::coverage(&dataset, &vector.vector_column).await?;
|
||||
println!("{}", serde_json::to_string_pretty(&coverages)?);
|
||||
}
|
||||
Command::Get {
|
||||
id,
|
||||
keys,
|
||||
vector_column,
|
||||
key_column,
|
||||
} => {
|
||||
let dataset = open_dataset(&client, &id, &fallback).await?;
|
||||
let vector =
|
||||
VectorTable::resolve(&dataset, vector_column.as_deref(), key_column.as_deref())?;
|
||||
for batch in query::get(&dataset, &vector, &keys).await? {
|
||||
println!("{}", arrow_cast::pretty::pretty_format_batches(&[batch])?);
|
||||
}
|
||||
}
|
||||
Command::Query {
|
||||
id,
|
||||
vector,
|
||||
k,
|
||||
filter,
|
||||
metric,
|
||||
flat,
|
||||
postfilter,
|
||||
version,
|
||||
vector_column,
|
||||
key_column,
|
||||
nprobes,
|
||||
} => {
|
||||
let opened = open_dataset(&client, &id, &fallback).await?;
|
||||
let dataset = match version {
|
||||
Some(v) => opened.checkout_version(v).await?,
|
||||
None => opened,
|
||||
};
|
||||
let vector_table =
|
||||
VectorTable::resolve(&dataset, vector_column.as_deref(), key_column.as_deref())?;
|
||||
let vector: Vec<f32> = vector
|
||||
.split(',')
|
||||
.map(|part| part.trim().parse::<f32>())
|
||||
.collect::<std::result::Result<_, _>>()
|
||||
.context("--vector takes comma-separated floats")?;
|
||||
let distance = match metric.as_str() {
|
||||
"l2" | "euclidean" => lance_linalg::distance::DistanceType::L2,
|
||||
"cosine" => lance_linalg::distance::DistanceType::Cosine,
|
||||
"dot" | "dotproduct" => lance_linalg::distance::DistanceType::Dot,
|
||||
other => bail!("unknown metric {other}: l2, cosine or dot"),
|
||||
};
|
||||
let query = Query {
|
||||
vector,
|
||||
k,
|
||||
filter,
|
||||
postfilter,
|
||||
distance,
|
||||
nprobes,
|
||||
index_segments: None,
|
||||
fragments: None,
|
||||
};
|
||||
let hits = if flat {
|
||||
query::flat(&dataset, &vector_table, &query).await?
|
||||
} else {
|
||||
query::ann(&dataset, &vector_table, &query).await?
|
||||
};
|
||||
println!("{}", serde_json::to_string_pretty(&hits)?);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn vector_flag_takes_hyphenated_floats() {
|
||||
let args = Args::try_parse_from([
|
||||
"weed-vector",
|
||||
"query",
|
||||
"t",
|
||||
"--vector",
|
||||
"-1,-1,-1,-1",
|
||||
"--k",
|
||||
"3",
|
||||
])
|
||||
.unwrap();
|
||||
match args.command {
|
||||
Command::Query { vector, k, .. } => {
|
||||
assert_eq!(vector, "-1,-1,-1,-1");
|
||||
assert_eq!(k, 3);
|
||||
}
|
||||
_ => panic!("expected query"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn column_flags_on_get_describe_coverage() {
|
||||
for argv in [
|
||||
vec!["weed-vector", "get", "t", "k1"],
|
||||
vec!["weed-vector", "describe", "t"],
|
||||
vec!["weed-vector", "coverage", "t"],
|
||||
] {
|
||||
let mut argv = argv;
|
||||
argv.extend(["--vector-column", "v", "--key-column", "kk"]);
|
||||
let args = Args::try_parse_from(argv).unwrap();
|
||||
let (v, k) = match args.command {
|
||||
Command::Get {
|
||||
vector_column,
|
||||
key_column,
|
||||
..
|
||||
}
|
||||
| Command::Describe {
|
||||
vector_column,
|
||||
key_column,
|
||||
..
|
||||
}
|
||||
| Command::Coverage {
|
||||
vector_column,
|
||||
key_column,
|
||||
..
|
||||
} => (vector_column, key_column),
|
||||
_ => panic!("unexpected subcommand"),
|
||||
};
|
||||
assert_eq!(v.as_deref(), Some("v"));
|
||||
assert_eq!(k.as_deref(), Some("kk"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,498 +0,0 @@
|
||||
//! Snapshot discipline under Lance maintenance: queries pin a dataset version,
|
||||
//! and version tags act as the lease maintenance must respect.
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::sync::{LazyLock, Mutex};
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
|
||||
use anyhow::Result;
|
||||
use lance::Dataset;
|
||||
use lance::dataset::refs::Ref;
|
||||
use uuid::Uuid;
|
||||
|
||||
const QUERY_TAG_PREFIX: &str = "weed-vector-query-";
|
||||
/// A lease outliving this is treated as abandoned by a dead or cancelled
|
||||
/// request and reaped by the next [`pin`].
|
||||
const LEASE_TTL: Duration = Duration::from_secs(3600);
|
||||
/// Foreign leases — another server's live queries or a dead process's
|
||||
/// leftovers — get this much longer backstop; a live query on a different
|
||||
/// server keeps its pin.
|
||||
const FOREIGN_TTL: Duration = Duration::from_secs(24 * 3600);
|
||||
/// Expired-lease scans run at most once per interval per dataset, not per
|
||||
/// request.
|
||||
const REAP_INTERVAL: Duration = Duration::from_secs(60);
|
||||
/// A process-unique owner id embedded in lease tags so a reaper only applies
|
||||
/// the short TTL to its own leases.
|
||||
static INSTANCE: LazyLock<String> = LazyLock::new(|| Uuid::new_v4().simple().to_string());
|
||||
/// Nanos since the Unix epoch when each dataset last had its tags scanned,
|
||||
/// keyed by dataset uri.
|
||||
static LAST_REAP: LazyLock<Mutex<HashMap<String, u128>>> = LazyLock::new(Mutex::default);
|
||||
/// Tags this process still holds. An expired tag is only reaped once no live
|
||||
/// lease here owns it, so a long-running query keeps its pin.
|
||||
static LIVE_TAGS: LazyLock<Mutex<HashSet<String>>> = LazyLock::new(Mutex::default);
|
||||
|
||||
/// A pinned dataset version. The lease tag is removed on drop; call
|
||||
/// [`Lease::release`] to await removal and observe failures.
|
||||
pub struct Lease {
|
||||
dataset: Dataset,
|
||||
tag: String,
|
||||
}
|
||||
|
||||
impl Lease {
|
||||
/// Remove the lease tag now instead of on drop.
|
||||
pub async fn release(mut self) -> Result<()> {
|
||||
let tag = std::mem::take(&mut self.tag);
|
||||
untrack(&tag);
|
||||
release(&self.dataset, &tag).await
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Lease {
|
||||
fn drop(&mut self) {
|
||||
if self.tag.is_empty() {
|
||||
return;
|
||||
}
|
||||
let tag = std::mem::take(&mut self.tag);
|
||||
untrack(&tag);
|
||||
if let Ok(handle) = tokio::runtime::Handle::try_current() {
|
||||
let dataset = self.dataset.clone();
|
||||
handle.spawn(async move {
|
||||
if let Err(err) = release(&dataset, &tag).await {
|
||||
tracing::warn!("releasing query lease {tag}: {err:#}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Lease-pin `dataset`'s current version with a tag so cleanup skips it.
|
||||
pub async fn pin(dataset: &Dataset) -> Result<Lease> {
|
||||
let now = SystemTime::now().duration_since(UNIX_EPOCH)?.as_nanos();
|
||||
reap_expired(dataset, now).await;
|
||||
let tag = format!(
|
||||
"{QUERY_TAG_PREFIX}{instance}-{now}-{}",
|
||||
Uuid::new_v4().simple(),
|
||||
instance = &*INSTANCE,
|
||||
);
|
||||
let version = dataset.version().version;
|
||||
dataset
|
||||
.tags()
|
||||
.create(&tag, Ref::Version(None, Some(version)))
|
||||
.await?;
|
||||
// A cleanup that listed tags before this create can still reclaim the
|
||||
// version; fail the read now rather than mid-query.
|
||||
if dataset.checkout_version(version).await.is_err() {
|
||||
let _ = dataset.tags().delete(&tag).await;
|
||||
anyhow::bail!("dataset version {version} was removed before it could be leased");
|
||||
}
|
||||
if let Ok(mut live) = LIVE_TAGS.lock() {
|
||||
live.insert(tag.clone());
|
||||
}
|
||||
Ok(Lease {
|
||||
dataset: dataset.clone(),
|
||||
tag,
|
||||
})
|
||||
}
|
||||
|
||||
/// [`pin`] that answers the query anyway when the storage identity may read
|
||||
/// but not write: a denied tag write degrades to an unleased query rather
|
||||
/// than an error.
|
||||
pub async fn try_pin(dataset: &Dataset) -> Result<Option<Lease>> {
|
||||
match pin(dataset).await {
|
||||
Ok(lease) => Ok(Some(lease)),
|
||||
Err(err) if denied(&err) => {
|
||||
tracing::warn!("query runs without a version lease: {err:#}");
|
||||
Ok(None)
|
||||
}
|
||||
Err(err) => Err(err),
|
||||
}
|
||||
}
|
||||
|
||||
fn denied(err: &anyhow::Error) -> bool {
|
||||
err.chain().any(|cause| {
|
||||
matches!(
|
||||
cause.downcast_ref::<object_store::Error>(),
|
||||
Some(object_store::Error::PermissionDenied { .. })
|
||||
| Some(object_store::Error::Unauthenticated { .. })
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
async fn release(dataset: &Dataset, tag: &str) -> Result<()> {
|
||||
Ok(dataset.tags().delete(tag).await?)
|
||||
}
|
||||
|
||||
fn untrack(tag: &str) {
|
||||
if let Ok(mut live) = LIVE_TAGS.lock() {
|
||||
live.remove(tag);
|
||||
}
|
||||
}
|
||||
|
||||
/// Drop lease tags whose owner never released them, so an abandoned lease
|
||||
/// cannot keep a version out of cleanup forever.
|
||||
async fn reap_expired(dataset: &Dataset, now: u128) {
|
||||
{
|
||||
let Ok(mut scanned) = LAST_REAP.lock() else {
|
||||
return;
|
||||
};
|
||||
if now.saturating_sub(*scanned.get(dataset.uri()).unwrap_or(&0)) <= REAP_INTERVAL.as_nanos()
|
||||
{
|
||||
return;
|
||||
}
|
||||
if scanned.len() >= 4096 {
|
||||
scanned.clear();
|
||||
}
|
||||
scanned.insert(dataset.uri().to_string(), now);
|
||||
}
|
||||
let Ok(tags) = dataset.tags().list().await else {
|
||||
return;
|
||||
};
|
||||
for name in tags.keys() {
|
||||
let held = LIVE_TAGS
|
||||
.lock()
|
||||
.map(|live| live.contains(name))
|
||||
.unwrap_or(false);
|
||||
// {instance}-{ts}-{uuid} is the owned format; {ts}-{uuid} is a
|
||||
// legacy foreign tag. Segment count picks the format — an all-digit
|
||||
// owner parses as a number too. Own leases use the short TTL;
|
||||
// foreign ones only the long backstop.
|
||||
let expired = name
|
||||
.strip_prefix(QUERY_TAG_PREFIX)
|
||||
.and_then(|rest| {
|
||||
let mut it = rest.splitn(3, '-');
|
||||
let a = it.next()?;
|
||||
let b = it.next()?;
|
||||
match it.next() {
|
||||
Some(_) => Some((a == *INSTANCE, b.parse::<u128>().ok()?)),
|
||||
None => Some((false, a.parse::<u128>().ok()?)),
|
||||
}
|
||||
})
|
||||
.is_some_and(|(own, stamp)| {
|
||||
now.saturating_sub(stamp)
|
||||
> if own { LEASE_TTL } else { FOREIGN_TTL }.as_nanos()
|
||||
});
|
||||
if expired && !held {
|
||||
let _ = dataset.tags().delete(name).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{Query, VectorTable, query, testing};
|
||||
use lance::dataset::cleanup::{CleanupPolicy, cleanup_old_versions};
|
||||
use lance::dataset::optimize::{CompactionOptions, compact_files};
|
||||
use lance_linalg::distance::DistanceType;
|
||||
use tempfile::TempDir;
|
||||
|
||||
async fn pinned_hits(dataset: &Dataset, version: u64, query_vector: &[f32]) -> Vec<u64> {
|
||||
let pinned = dataset.checkout_version(version).await.unwrap();
|
||||
let resolved = VectorTable::resolve(&pinned, None, None).unwrap();
|
||||
let q = Query {
|
||||
vector: query_vector.to_vec(),
|
||||
k: 3,
|
||||
filter: None,
|
||||
postfilter: false,
|
||||
distance: DistanceType::L2,
|
||||
nprobes: None,
|
||||
index_segments: None,
|
||||
fragments: None,
|
||||
};
|
||||
let mut ids: Vec<u64> = query::flat(&pinned, &resolved, &q)
|
||||
.await
|
||||
.unwrap()
|
||||
.iter()
|
||||
.map(|h| h.row_id)
|
||||
.collect();
|
||||
ids.sort_unstable();
|
||||
ids
|
||||
}
|
||||
|
||||
/// Compaction commits a new version and rewrites fragments; a query pinned
|
||||
/// at the old version still reads it.
|
||||
#[tokio::test]
|
||||
async fn pinned_query_survives_compaction() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let mut dataset =
|
||||
testing::write_dataset(&dir, &testing::vectors(4, 4), &["a", "b", "c", "d"]).await;
|
||||
testing::append_dataset(&mut dataset, &testing::vectors(4, 4), &["e", "f", "g", "h"]).await;
|
||||
let v1 = dataset.version().version;
|
||||
let before = pinned_hits(&dataset, v1, &[0.0, 0.0, 0.0, 1.0]).await;
|
||||
|
||||
compact_files(
|
||||
&mut dataset,
|
||||
CompactionOptions {
|
||||
target_rows_per_fragment: 64,
|
||||
..Default::default()
|
||||
},
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(dataset.version().version > v1);
|
||||
assert_eq!(
|
||||
pinned_hits(&dataset, v1, &[0.0, 0.0, 0.0, 1.0]).await,
|
||||
before
|
||||
);
|
||||
}
|
||||
|
||||
/// A pinned version carrying a query tag is skipped by cleanup; removing
|
||||
/// the lease first lets cleanup delete it.
|
||||
#[tokio::test]
|
||||
async fn tagged_version_survives_cleanup() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let mut dataset =
|
||||
testing::write_dataset(&dir, &testing::vectors(4, 4), &["a", "b", "c", "d"]).await;
|
||||
let v1 = dataset.version().version;
|
||||
let before = pinned_hits(&dataset, v1, &[0.0, 0.0, 0.0, 1.0]).await;
|
||||
let lease = pin(&dataset).await.unwrap();
|
||||
|
||||
testing::append_dataset(&mut dataset, &testing::vectors(4, 4), &["e", "f", "g", "h"]).await;
|
||||
let v2 = dataset.version().version;
|
||||
|
||||
// Tagged old versions refuse to clean by default.
|
||||
let policy = CleanupPolicy {
|
||||
before_version: Some(v2),
|
||||
delete_unverified: true,
|
||||
error_if_tagged_old_versions: true,
|
||||
clean_referenced_branches: false,
|
||||
delete_rate_limit: None,
|
||||
..Default::default()
|
||||
};
|
||||
cleanup_old_versions(&dataset, policy.clone())
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
||||
let policy = CleanupPolicy {
|
||||
error_if_tagged_old_versions: false,
|
||||
..policy
|
||||
};
|
||||
cleanup_old_versions(&dataset, policy).await.unwrap();
|
||||
assert_eq!(
|
||||
pinned_hits(&dataset, v1, &[0.0, 0.0, 0.0, 1.0]).await,
|
||||
before
|
||||
);
|
||||
|
||||
// Lease released: the old version is now fair game.
|
||||
lease.release().await.unwrap();
|
||||
assert!(
|
||||
dataset
|
||||
.tags()
|
||||
.list()
|
||||
.await
|
||||
.unwrap()
|
||||
.keys()
|
||||
.all(|t| !t.starts_with(QUERY_TAG_PREFIX))
|
||||
);
|
||||
cleanup_old_versions(
|
||||
&dataset,
|
||||
CleanupPolicy {
|
||||
before_version: Some(v2),
|
||||
delete_unverified: true,
|
||||
error_if_tagged_old_versions: true,
|
||||
clean_referenced_branches: false,
|
||||
delete_rate_limit: None,
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(dataset.checkout_version(v1).await.is_err());
|
||||
}
|
||||
|
||||
/// Concurrent pins never collide on a tag name.
|
||||
#[tokio::test]
|
||||
async fn pins_get_distinct_tags() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let dataset =
|
||||
testing::write_dataset(&dir, &testing::vectors(4, 4), &["a", "b", "c", "d"]).await;
|
||||
let a = pin(&dataset).await.unwrap();
|
||||
let b = pin(&dataset).await.unwrap();
|
||||
assert_ne!(a.tag, b.tag);
|
||||
assert_eq!(dataset.tags().list().await.unwrap().len(), 2);
|
||||
a.release().await.unwrap();
|
||||
b.release().await.unwrap();
|
||||
}
|
||||
|
||||
/// A stale lease tag left behind is reaped by the next pin; a stale-named
|
||||
/// tag this process still holds is not.
|
||||
#[tokio::test]
|
||||
async fn pin_reaps_abandoned_leases() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let dataset =
|
||||
testing::write_dataset(&dir, &testing::vectors(4, 4), &["a", "b", "c", "d"]).await;
|
||||
let stale = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_nanos()
|
||||
- LEASE_TTL.as_nanos()
|
||||
- 1;
|
||||
dataset
|
||||
.tags()
|
||||
.create(
|
||||
&format!("{QUERY_TAG_PREFIX}{}-{stale}-deadbeef", &*INSTANCE),
|
||||
Ref::Version(None, Some(dataset.version().version)),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let held = format!("{QUERY_TAG_PREFIX}{}-{stale}-livebeef", &*INSTANCE);
|
||||
dataset
|
||||
.tags()
|
||||
.create(&held, Ref::Version(None, Some(dataset.version().version)))
|
||||
.await
|
||||
.unwrap();
|
||||
LIVE_TAGS.lock().unwrap().insert(held.clone());
|
||||
|
||||
let lease = pin(&dataset).await.unwrap();
|
||||
let tags = dataset.tags().list().await.unwrap();
|
||||
assert_eq!(tags.len(), 2);
|
||||
assert!(tags.contains_key(&held));
|
||||
assert!(tags.contains_key(&lease.tag));
|
||||
LIVE_TAGS.lock().unwrap().remove(&held);
|
||||
lease.release().await.unwrap();
|
||||
}
|
||||
|
||||
/// A stale lease from another process is not reaped at the short TTL —
|
||||
/// only the long foreign backstop applies.
|
||||
#[tokio::test]
|
||||
async fn foreign_leases_survive_local_reap() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let dataset =
|
||||
testing::write_dataset(&dir, &testing::vectors(4, 4), &["a", "b", "c", "d"]).await;
|
||||
let stale = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_nanos()
|
||||
- LEASE_TTL.as_nanos()
|
||||
- 1;
|
||||
let foreign = format!("{QUERY_TAG_PREFIX}other-{stale}-foreign");
|
||||
dataset
|
||||
.tags()
|
||||
.create(&foreign, Ref::Version(None, Some(dataset.version().version)))
|
||||
.await
|
||||
.unwrap();
|
||||
let lease = pin(&dataset).await.unwrap();
|
||||
let tags = dataset.tags().list().await.unwrap();
|
||||
assert!(tags.contains_key(&foreign), "foreign lease was reaped");
|
||||
lease.release().await.unwrap();
|
||||
}
|
||||
|
||||
/// An all-digit foreign owner still gets the backstop TTL applied to its
|
||||
/// own timestamp rather than being read as a far-future legacy stamp.
|
||||
#[tokio::test]
|
||||
async fn all_digit_foreign_owner_still_expires() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let dataset =
|
||||
testing::write_dataset(&dir, &testing::vectors(4, 4), &["a", "b", "c", "d"]).await;
|
||||
let stale = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_nanos()
|
||||
- FOREIGN_TTL.as_nanos()
|
||||
- 1;
|
||||
let tag = format!("{QUERY_TAG_PREFIX}12345678901234567890123456789012-{stale}-deadbeef");
|
||||
dataset
|
||||
.tags()
|
||||
.create(&tag, Ref::Version(None, Some(dataset.version().version)))
|
||||
.await
|
||||
.unwrap();
|
||||
let lease = pin(&dataset).await.unwrap();
|
||||
let tags = dataset.tags().list().await.unwrap();
|
||||
assert!(!tags.contains_key(&tag), "all-digit foreign owner was kept");
|
||||
lease.release().await.unwrap();
|
||||
}
|
||||
|
||||
/// Pins within one reap interval do not rescan the dataset's tags.
|
||||
#[tokio::test]
|
||||
async fn pin_throttles_reap_scans() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let dataset =
|
||||
testing::write_dataset(&dir, &testing::vectors(4, 4), &["a", "b", "c", "d"]).await;
|
||||
let first = pin(&dataset).await.unwrap();
|
||||
let stale = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_nanos()
|
||||
- LEASE_TTL.as_nanos()
|
||||
- 1;
|
||||
let tag = format!("{QUERY_TAG_PREFIX}{}-{stale}-slowbeef", &*INSTANCE);
|
||||
dataset
|
||||
.tags()
|
||||
.create(&tag, Ref::Version(None, Some(dataset.version().version)))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let second = pin(&dataset).await.unwrap();
|
||||
assert!(dataset.tags().list().await.unwrap().contains_key(&tag));
|
||||
first.release().await.unwrap();
|
||||
second.release().await.unwrap();
|
||||
}
|
||||
|
||||
/// A version reclaimed before its lease lands fails the pin instead of
|
||||
/// dying mid-query, and leaves no lease tag behind.
|
||||
#[tokio::test]
|
||||
async fn pin_fails_when_version_already_reclaimed() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let mut dataset =
|
||||
testing::write_dataset(&dir, &testing::vectors(4, 4), &["a", "b", "c", "d"]).await;
|
||||
let v1 = dataset.version().version;
|
||||
let old = dataset.checkout_version(v1).await.unwrap();
|
||||
testing::append_dataset(&mut dataset, &testing::vectors(4, 4), &["e", "f", "g", "h"]).await;
|
||||
let v2 = dataset.version().version;
|
||||
cleanup_old_versions(
|
||||
&dataset,
|
||||
CleanupPolicy {
|
||||
before_version: Some(v2),
|
||||
delete_unverified: true,
|
||||
error_if_tagged_old_versions: false,
|
||||
clean_referenced_branches: false,
|
||||
delete_rate_limit: None,
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(dataset.checkout_version(v1).await.is_err());
|
||||
|
||||
assert!(pin(&old).await.is_err());
|
||||
assert!(
|
||||
dataset
|
||||
.tags()
|
||||
.list()
|
||||
.await
|
||||
.unwrap()
|
||||
.keys()
|
||||
.all(|t| !t.starts_with(QUERY_TAG_PREFIX))
|
||||
);
|
||||
}
|
||||
|
||||
/// A data file deleted under a pinned query fails the request rather than
|
||||
/// returning a partial result set.
|
||||
#[tokio::test]
|
||||
async fn missing_data_file_errors_instead_of_partial() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let dataset =
|
||||
testing::write_dataset(&dir, &testing::vectors(4, 4), &["a", "b", "c", "d"]).await;
|
||||
let data_dir = dir.path().join("data");
|
||||
let file = std::fs::read_dir(&data_dir)
|
||||
.unwrap()
|
||||
.flatten()
|
||||
.find(|e| e.file_name().to_string_lossy().ends_with(".lance"))
|
||||
.unwrap();
|
||||
std::fs::remove_file(file.path()).unwrap();
|
||||
|
||||
let resolved = VectorTable::resolve(&dataset, None, None).unwrap();
|
||||
let q = Query {
|
||||
vector: vec![0.0; 4],
|
||||
k: 2,
|
||||
filter: None,
|
||||
postfilter: false,
|
||||
distance: DistanceType::L2,
|
||||
nprobes: None,
|
||||
index_segments: None,
|
||||
fragments: None,
|
||||
};
|
||||
assert!(query::flat(&dataset, &resolved, &q).await.is_err());
|
||||
}
|
||||
}
|
||||
@@ -1,481 +0,0 @@
|
||||
//! Top-K queries over a [`VectorTable`]: exact flat scan, or the ANN index
|
||||
//! with a flat pass over the fragments it does not cover yet.
|
||||
|
||||
use anyhow::{Context, Result, bail};
|
||||
use arrow_array::{Array, Float32Array, RecordBatch, StringArray, UInt64Array};
|
||||
use futures::TryStreamExt;
|
||||
use lance::Dataset;
|
||||
use lance::dataset::scanner::Scanner;
|
||||
use lance_linalg::distance::DistanceType;
|
||||
use lance_table::format::Fragment;
|
||||
|
||||
use crate::table::VectorTable;
|
||||
|
||||
const DISTANCE_COLUMN: &str = "_distance";
|
||||
const ROW_ID_COLUMN: &str = "_rowid";
|
||||
|
||||
/// One vector search request.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Query {
|
||||
pub vector: Vec<f32>,
|
||||
pub k: usize,
|
||||
/// A Lance SQL filter over the metadata columns.
|
||||
pub filter: Option<String>,
|
||||
/// Filter the top-K rows after ranking instead of the eligible rows
|
||||
/// before it. Lance's default post-filters and can return fewer than k
|
||||
/// results while eligible neighbours go unreported; keep it off for
|
||||
/// S3 Vectors filter semantics.
|
||||
pub postfilter: bool,
|
||||
pub distance: DistanceType,
|
||||
pub nprobes: Option<usize>,
|
||||
/// Restrict the indexed scan to these physical index segments (the
|
||||
/// Enterprise planner fans a query out across them). Without `fragments`,
|
||||
/// unindexed fragments outside the segments are not searched — the caller
|
||||
/// owns disjoint coverage of them. When `fragments` is also set the scan
|
||||
/// covers both, so a worker can take its segment share plus an
|
||||
/// unindexed-fragment sweep in one request.
|
||||
pub index_segments: Option<Vec<uuid::Uuid>>,
|
||||
/// Restrict the scan to these fragment ids — used by the planner to give
|
||||
/// a worker the unindexed-fragment sweep. Listed ids that no longer exist
|
||||
/// scan nothing.
|
||||
pub fragments: Option<Vec<u64>>,
|
||||
}
|
||||
|
||||
/// One row of a top-K answer.
|
||||
#[derive(Debug, Clone, serde::Serialize)]
|
||||
pub struct Hit {
|
||||
/// The key column value, or the row id when the table has no key column.
|
||||
pub key: String,
|
||||
/// Raw Lance `_distance` in the query's metric.
|
||||
pub distance: f32,
|
||||
pub row_id: u64,
|
||||
}
|
||||
|
||||
/// Exact top-K over every fragment, ignoring any index.
|
||||
pub async fn flat(dataset: &Dataset, table: &VectorTable, query: &Query) -> Result<Vec<Hit>> {
|
||||
run(scanner(dataset, table, query, false).await?, table).await
|
||||
}
|
||||
|
||||
/// Top-K with the ANN index where it covers the fragment and a flat pass over
|
||||
/// the rest. Whether the index is used is Lance's decision per fragment, so
|
||||
/// rows written after the last index build are always candidates.
|
||||
pub async fn ann(dataset: &Dataset, table: &VectorTable, query: &Query) -> Result<Vec<Hit>> {
|
||||
run(scanner(dataset, table, query, true).await?, table).await
|
||||
}
|
||||
|
||||
/// Fetch rows by key.
|
||||
pub async fn get(
|
||||
dataset: &Dataset,
|
||||
table: &VectorTable,
|
||||
keys: &[String],
|
||||
) -> Result<Vec<RecordBatch>> {
|
||||
let Some(key_column) = &table.key_column else {
|
||||
bail!("the table has no key column to look up");
|
||||
};
|
||||
if keys.is_empty() {
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
let list = keys
|
||||
.iter()
|
||||
.map(|k| format!("'{}'", k.replace('\'', "''")))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
let mut scanner = dataset.scan();
|
||||
scanner
|
||||
.filter(&format!("`{}` in ({list})", key_column.replace('`', "``")))?
|
||||
.with_row_id();
|
||||
scanner
|
||||
.try_into_stream()
|
||||
.await?
|
||||
.try_collect()
|
||||
.await
|
||||
.context("scan by keys")
|
||||
}
|
||||
|
||||
async fn scanner(
|
||||
dataset: &Dataset,
|
||||
table: &VectorTable,
|
||||
query: &Query,
|
||||
use_index: bool,
|
||||
) -> Result<Scanner> {
|
||||
if query.vector.len() != table.dimension {
|
||||
bail!(
|
||||
"query dim({}) does not match the table's dim({})",
|
||||
query.vector.len(),
|
||||
table.dimension
|
||||
);
|
||||
}
|
||||
let vector = Float32Array::from(query.vector.clone());
|
||||
let mut scanner = dataset.scan();
|
||||
scanner
|
||||
.nearest(&table.vector_column, &vector, query.k)?
|
||||
.distance_metric(query.distance)
|
||||
.use_index(use_index)
|
||||
.with_row_id();
|
||||
if let Some(filter) = &query.filter {
|
||||
scanner.filter(filter)?;
|
||||
scanner.prefilter(!query.postfilter);
|
||||
}
|
||||
if let Some(nprobes) = query.nprobes {
|
||||
scanner.nprobes(nprobes);
|
||||
}
|
||||
let segments = query.index_segments.as_deref().unwrap_or(&[]);
|
||||
if use_index && !segments.is_empty() {
|
||||
scanner.with_index_segments(segments.to_vec())?;
|
||||
}
|
||||
// Lance intersects the fragment list with the selected segments, so a
|
||||
// scoped scan must name the segment-covered fragments itself: the universe
|
||||
// is the listed ids plus the live coverage of the selected segments. An
|
||||
// empty universe (or an empty-segment, fragment-less assignment) scopes to
|
||||
// nothing — `with_fragments` with an empty list scans nothing.
|
||||
let mut wanted: Option<Vec<u64>> = query.fragments.clone();
|
||||
if let Some(ids) = &mut wanted {
|
||||
if use_index && !segments.is_empty() {
|
||||
ids.extend(
|
||||
crate::segments::covered_fragments(dataset, &table.vector_column, segments).await?,
|
||||
);
|
||||
}
|
||||
} else if use_index && query.index_segments.as_ref().is_some_and(|s| s.is_empty()) {
|
||||
wanted = Some(Vec::new());
|
||||
}
|
||||
if let Some(ids) = wanted {
|
||||
let frags: Vec<Fragment> = dataset
|
||||
.fragments()
|
||||
.iter()
|
||||
.filter(|f| ids.contains(&f.id))
|
||||
.cloned()
|
||||
.collect();
|
||||
scanner.with_fragments(frags);
|
||||
}
|
||||
let mut columns = Vec::new();
|
||||
if let Some(key) = &table.key_column {
|
||||
columns.push(key.clone());
|
||||
}
|
||||
columns.push(DISTANCE_COLUMN.to_string());
|
||||
columns.push(ROW_ID_COLUMN.to_string());
|
||||
scanner.project(&columns)?;
|
||||
Ok(scanner)
|
||||
}
|
||||
|
||||
async fn run(scanner: Scanner, table: &VectorTable) -> Result<Vec<Hit>> {
|
||||
let mut stream = scanner.try_into_stream().await?;
|
||||
let mut out = Vec::new();
|
||||
while let Some(batch) = stream.try_next().await? {
|
||||
out.extend(hits(&batch, table)?);
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
fn hits(batch: &RecordBatch, table: &VectorTable) -> Result<Vec<Hit>> {
|
||||
let distances = batch
|
||||
.column_by_name(DISTANCE_COLUMN)
|
||||
.and_then(|c| c.as_any().downcast_ref::<Float32Array>())
|
||||
.context("the scan did not return a _distance column")?;
|
||||
let row_ids = batch
|
||||
.column_by_name(ROW_ID_COLUMN)
|
||||
.and_then(|c| c.as_any().downcast_ref::<UInt64Array>())
|
||||
.context("the scan did not return a _rowid column")?;
|
||||
let keys = table.key_column.as_ref().and_then(|name| {
|
||||
batch
|
||||
.column_by_name(name)
|
||||
.and_then(|c| c.as_any().downcast_ref::<StringArray>())
|
||||
});
|
||||
if table.key_column.is_some() && keys.is_none() {
|
||||
bail!("key column did not come back as Utf8");
|
||||
}
|
||||
(0..batch.num_rows())
|
||||
.map(|i| {
|
||||
let key = match keys {
|
||||
Some(keys) if !keys.is_null(i) => keys.value(i).to_string(),
|
||||
Some(_) => bail!(
|
||||
"key column {} has a null at row {i}",
|
||||
table.key_column.as_deref().unwrap_or_default()
|
||||
),
|
||||
None => row_ids.value(i).to_string(),
|
||||
};
|
||||
Ok(Hit {
|
||||
key,
|
||||
distance: distances.value(i),
|
||||
row_id: row_ids.value(i),
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::table::VectorTable;
|
||||
use crate::testing::{DIM, write_dataset};
|
||||
use arrow_array::{FixedSizeListArray, RecordBatchIterator, types::Float32Type};
|
||||
use arrow_schema::{DataType, Field, Schema};
|
||||
use std::sync::Arc;
|
||||
use tempfile::TempDir;
|
||||
|
||||
fn l2(a: &[f32], b: &[f32]) -> f32 {
|
||||
a.iter().zip(b).map(|(x, y)| (x - y) * (x - y)).sum()
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn flat_returns_exact_top_k() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let vectors = vec![
|
||||
vec![1.0, 0.0, 0.0, 0.0],
|
||||
vec![0.9, 0.1, 0.0, 0.0],
|
||||
vec![0.0, 1.0, 0.0, 0.0],
|
||||
vec![0.0, 0.0, 1.0, 0.0],
|
||||
];
|
||||
let dataset = write_dataset(&dir, &vectors, &["a", "b", "a", "b"]).await;
|
||||
let table = VectorTable::resolve(&dataset, None, None).unwrap();
|
||||
|
||||
let query = Query {
|
||||
vector: vec![1.0, 0.0, 0.0, 0.0],
|
||||
k: 2,
|
||||
filter: None,
|
||||
postfilter: false,
|
||||
distance: DistanceType::L2,
|
||||
nprobes: None,
|
||||
index_segments: None,
|
||||
fragments: None,
|
||||
};
|
||||
let hits = flat(&dataset, &table, &query).await.unwrap();
|
||||
assert_eq!(hits.len(), 2);
|
||||
assert_eq!(hits[0].key, "k0");
|
||||
assert!(hits[0].distance <= hits[1].distance);
|
||||
|
||||
let mut brute: Vec<(String, f32)> = vectors
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, v)| (format!("k{i}"), l2(&query.vector, v)))
|
||||
.collect();
|
||||
brute.sort_by(|a, b| a.1.total_cmp(&b.1));
|
||||
for (hit, (key, distance)) in hits.iter().zip(brute.iter()) {
|
||||
assert_eq!(&hit.key, key);
|
||||
assert!((hit.distance - distance).abs() < 1e-5);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn flat_applies_the_filter() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let vectors = vec![
|
||||
vec![1.0, 0.0, 0.0, 0.0],
|
||||
vec![0.9, 0.1, 0.0, 0.0],
|
||||
vec![0.0, 1.0, 0.0, 0.0],
|
||||
];
|
||||
let dataset = write_dataset(&dir, &vectors, &["a", "b", "a"]).await;
|
||||
let table = VectorTable::resolve(&dataset, None, None).unwrap();
|
||||
|
||||
let hits = flat(
|
||||
&dataset,
|
||||
&table,
|
||||
&Query {
|
||||
vector: vec![1.0, 0.0, 0.0, 0.0],
|
||||
k: 3,
|
||||
filter: Some("tag = 'a'".to_string()),
|
||||
postfilter: false,
|
||||
distance: DistanceType::L2,
|
||||
nprobes: None,
|
||||
index_segments: None,
|
||||
fragments: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(hits.len(), 2);
|
||||
assert_eq!(hits[0].key, "k0");
|
||||
assert_eq!(hits[1].key, "k2");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn filter_matches_json_types_exactly() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let metas = vec![
|
||||
r#"{"k": 3}"#, // k0: number
|
||||
r#"{"k": "3"}"#, // k1: numeric string
|
||||
r#"{"k": true}"#, // k2: bool
|
||||
r#"{"k": "abc"}"#, // k3: non-numeric string
|
||||
r#"{"x": 1}"#, // k4: missing key
|
||||
r#"{"k": [1, 2]}"#, // k5: array
|
||||
r#"{"k": null}"#, // k6: null
|
||||
r#"{"k": 1}"#, // k7: serializes to '1', castable to boolean
|
||||
r#"{"k": 0}"#, // k8: serializes to '0', castable to boolean
|
||||
];
|
||||
let schema = Arc::new(Schema::new(vec![
|
||||
Field::new("key", DataType::Utf8, false),
|
||||
Field::new(
|
||||
"vector",
|
||||
DataType::FixedSizeList(
|
||||
Arc::new(Field::new("item", DataType::Float32, true)),
|
||||
DIM as i32,
|
||||
),
|
||||
false,
|
||||
),
|
||||
Field::new("metadata", DataType::Utf8, true).with_metadata(
|
||||
[("ARROW:extension:name".to_string(), "arrow.json".to_string())]
|
||||
.into_iter()
|
||||
.collect(),
|
||||
),
|
||||
]));
|
||||
let keys: Vec<String> = (0..metas.len()).map(|i| format!("k{i}")).collect();
|
||||
let batch = RecordBatch::try_new(
|
||||
schema.clone(),
|
||||
vec![
|
||||
Arc::new(StringArray::from(keys)),
|
||||
Arc::new(
|
||||
FixedSizeListArray::from_iter_primitive::<Float32Type, _, _>(
|
||||
(0..metas.len())
|
||||
.map(|i| Some(vec![Some(i as f32); DIM]))
|
||||
.collect::<Vec<_>>(),
|
||||
DIM as i32,
|
||||
),
|
||||
),
|
||||
Arc::new(StringArray::from(
|
||||
metas
|
||||
.iter()
|
||||
.map(|m| Some(m.to_string()))
|
||||
.collect::<Vec<_>>(),
|
||||
)),
|
||||
],
|
||||
)
|
||||
.unwrap();
|
||||
let reader = RecordBatchIterator::new(vec![Ok(batch)].into_iter(), schema);
|
||||
let dataset = Dataset::write(reader, dir.path().to_str().unwrap(), None)
|
||||
.await
|
||||
.unwrap();
|
||||
let table = VectorTable::resolve(&dataset, None, None).unwrap();
|
||||
async fn run(dataset: &Dataset, table: &VectorTable, filter: &str) -> Vec<Hit> {
|
||||
flat(
|
||||
dataset,
|
||||
table,
|
||||
&Query {
|
||||
vector: vec![1.0, 0.0, 0.0, 0.0],
|
||||
k: 10,
|
||||
filter: Some(filter.to_string()),
|
||||
postfilter: false,
|
||||
distance: DistanceType::L2,
|
||||
nprobes: None,
|
||||
index_segments: None,
|
||||
fragments: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap()
|
||||
}
|
||||
let keys_of = |hits: Vec<Hit>| {
|
||||
let mut keys: Vec<String> = hits.into_iter().map(|h| h.key).collect();
|
||||
keys.sort();
|
||||
keys
|
||||
};
|
||||
|
||||
// A stored string, boolean, array, or null must not satisfy a numeric
|
||||
// comparison — nor fail the query, the way the converting json_get_*
|
||||
// extractors do.
|
||||
let hits = run(
|
||||
&dataset,
|
||||
&table,
|
||||
"TRY_CAST(json_extract(`metadata`, '$[\"k\"]') AS DOUBLE) = 3",
|
||||
)
|
||||
.await;
|
||||
assert_eq!(keys_of(hits), ["k0"]);
|
||||
let hits = run(
|
||||
&dataset,
|
||||
&table,
|
||||
"TRY_CAST(json_extract(`metadata`, '$[\"k\"]') AS DOUBLE) > 1",
|
||||
)
|
||||
.await;
|
||||
assert_eq!(keys_of(hits), ["k0"]);
|
||||
|
||||
// Booleans compare the serialized form as well: '1' and '0' would
|
||||
// satisfy a cast but not the text match.
|
||||
let hits = run(
|
||||
&dataset,
|
||||
&table,
|
||||
"json_extract(`metadata`, '$[\"k\"]') = 'true'",
|
||||
)
|
||||
.await;
|
||||
assert_eq!(keys_of(hits), ["k2"]);
|
||||
|
||||
// The serialized extract is exact for strings too: the numeric 3 is
|
||||
// not a match for '"3"', and comparing json_extract never trips on
|
||||
// the array or null rows.
|
||||
let hits = run(
|
||||
&dataset,
|
||||
&table,
|
||||
"json_extract(`metadata`, '$[\"k\"]') = '\"3\"'",
|
||||
)
|
||||
.await;
|
||||
assert_eq!(keys_of(hits), ["k1"]);
|
||||
let hits = run(
|
||||
&dataset,
|
||||
&table,
|
||||
"NOT COALESCE(json_extract(`metadata`, '$[\"k\"]') = '\"3\"', false)",
|
||||
)
|
||||
.await;
|
||||
assert_eq!(
|
||||
keys_of(hits),
|
||||
["k0", "k2", "k3", "k4", "k5", "k6", "k7", "k8"]
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn get_fetches_rows_by_key() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let vectors = vec![vec![1.0; DIM], vec![2.0; DIM], vec![3.0; DIM]];
|
||||
let dataset = write_dataset(&dir, &vectors, &["a", "b", "c"]).await;
|
||||
let table = VectorTable::resolve(&dataset, None, None).unwrap();
|
||||
|
||||
let batches = get(&dataset, &table, &["k0".to_string(), "k2".to_string()])
|
||||
.await
|
||||
.unwrap();
|
||||
let rows: usize = batches.iter().map(|b| b.num_rows()).sum();
|
||||
assert_eq!(rows, 2);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn query_rejects_a_wrong_dimension() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let vectors = vec![vec![1.0; DIM]];
|
||||
let dataset = write_dataset(&dir, &vectors, &["a"]).await;
|
||||
let table = VectorTable::resolve(&dataset, None, None).unwrap();
|
||||
let query = Query {
|
||||
vector: vec![1.0; DIM + 1],
|
||||
k: 1,
|
||||
filter: None,
|
||||
postfilter: false,
|
||||
distance: DistanceType::L2,
|
||||
nprobes: None,
|
||||
index_segments: None,
|
||||
fragments: None,
|
||||
};
|
||||
assert!(flat(&dataset, &table, &query).await.is_err());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn ann_matches_flat_without_an_index() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let vectors = vec![
|
||||
vec![1.0, 0.0, 0.0, 0.0],
|
||||
vec![0.0, 1.0, 0.0, 0.0],
|
||||
vec![0.0, 0.0, 1.0, 0.0],
|
||||
];
|
||||
let dataset = write_dataset(&dir, &vectors, &["a", "b", "c"]).await;
|
||||
let table = VectorTable::resolve(&dataset, None, None).unwrap();
|
||||
let query = Query {
|
||||
vector: vec![1.0, 0.0, 0.0, 0.0],
|
||||
k: 2,
|
||||
filter: None,
|
||||
postfilter: false,
|
||||
distance: DistanceType::L2,
|
||||
nprobes: None,
|
||||
index_segments: None,
|
||||
fragments: None,
|
||||
};
|
||||
let indexed = ann(&dataset, &table, &query).await.unwrap();
|
||||
let exact = flat(&dataset, &table, &query).await.unwrap();
|
||||
assert_eq!(
|
||||
indexed.iter().map(|h| &h.key).collect::<Vec<_>>(),
|
||||
exact.iter().map(|h| &h.key).collect::<Vec<_>>()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,272 +0,0 @@
|
||||
//! Physical index segments and the partition a fanout planner assigns to each
|
||||
//! worker. OSS runs the same restriction in-process; Enterprise ships the
|
||||
//! segment ids to remote workers — the engine does not change.
|
||||
|
||||
use anyhow::Result;
|
||||
use lance::Dataset;
|
||||
use lance::index::DatasetIndexExt;
|
||||
use uuid::Uuid;
|
||||
|
||||
/// UUIDs of every physical index segment covering `field` at this version.
|
||||
pub async fn index_segments(dataset: &Dataset, field: &str) -> Result<Vec<Uuid>> {
|
||||
Ok(segment_fragments(dataset, field)
|
||||
.await?
|
||||
.iter()
|
||||
.map(|(id, _)| *id)
|
||||
.collect())
|
||||
}
|
||||
|
||||
/// Per index segment on `field`: its uuid and the live fragments it covers.
|
||||
/// Segments with unknown coverage (no bitmap) are skipped — callers needing
|
||||
/// strict coverage must treat that as a degenerate plan.
|
||||
pub async fn segment_fragments(
|
||||
dataset: &Dataset,
|
||||
field: &str,
|
||||
) -> Result<Vec<(Uuid, roaring::RoaringBitmap)>> {
|
||||
Ok(named_segment_fragments(dataset, field)
|
||||
.await?
|
||||
.into_iter()
|
||||
.map(|(id, _, b)| (id, b))
|
||||
.collect())
|
||||
}
|
||||
|
||||
/// Like `segment_fragments` but carries the logical index name — sharded
|
||||
/// builds create one named index per shard, and a `with_index_segments`
|
||||
/// scan must not mix names, so a fanout planner groups by name.
|
||||
pub async fn named_segment_fragments(
|
||||
dataset: &Dataset,
|
||||
field: &str,
|
||||
) -> Result<Vec<(Uuid, String, roaring::RoaringBitmap)>> {
|
||||
let field = dataset
|
||||
.schema()
|
||||
.field(field)
|
||||
.ok_or_else(|| anyhow::anyhow!("no such field {field}"))?;
|
||||
let live: roaring::RoaringBitmap = dataset.fragments().iter().map(|f| f.id as u32).collect();
|
||||
Ok(dataset
|
||||
.load_indices()
|
||||
.await?
|
||||
.iter()
|
||||
.filter(|i| i.fields == [field.id])
|
||||
.filter_map(|i| {
|
||||
i.fragment_bitmap
|
||||
.clone()
|
||||
.map(|b| (i.uuid, i.name.clone(), b & &live))
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
/// Live fragment ids covered by `segments` on `field` — the union a scoped
|
||||
/// fragment list needs so the selected segments are not filtered out of the
|
||||
/// scan.
|
||||
pub async fn covered_fragments(
|
||||
dataset: &Dataset,
|
||||
field: &str,
|
||||
segments: &[Uuid],
|
||||
) -> Result<Vec<u64>> {
|
||||
Ok(segment_fragments(dataset, field)
|
||||
.await?
|
||||
.into_iter()
|
||||
.filter(|(id, _)| segments.contains(id))
|
||||
.flat_map(|(_, b)| b.iter().map(u64::from).collect::<Vec<_>>())
|
||||
.collect())
|
||||
}
|
||||
|
||||
/// Round-robin `segments` across `n` workers. Index order is unstable, so
|
||||
/// workers see disjoint, deterministic-in-name partitions rather than
|
||||
/// physically adjacent ones. Zero workers means zero partitions — nothing is
|
||||
/// silently assigned.
|
||||
pub fn partition(segments: &[Uuid], n: usize) -> Vec<Vec<Uuid>> {
|
||||
let mut out = vec![Vec::new(); n];
|
||||
if n == 0 {
|
||||
return out;
|
||||
}
|
||||
let mut ids = segments.to_vec();
|
||||
ids.sort();
|
||||
for (i, id) in ids.into_iter().enumerate() {
|
||||
out[i % n].push(id);
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{Query, VectorTable, query, testing};
|
||||
use lance::index::vector::VectorIndexParams;
|
||||
use lance_index::IndexType;
|
||||
use lance_index::optimize::OptimizeOptions;
|
||||
use lance_linalg::distance::DistanceType;
|
||||
use tempfile::TempDir;
|
||||
|
||||
/// Two workers each scan their share of the index segments; merged, the
|
||||
/// hits equal a single full-dataset search.
|
||||
#[tokio::test]
|
||||
async fn partitioned_segments_merge_to_full_result() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let mut dataset = testing::write_dataset(
|
||||
&dir,
|
||||
&testing::vectors(8, 4),
|
||||
&["a", "b", "c", "d", "e", "f", "g", "h"],
|
||||
)
|
||||
.await;
|
||||
let params = VectorIndexParams::ivf_flat(4, DistanceType::L2);
|
||||
dataset
|
||||
.create_index(
|
||||
&["vector"],
|
||||
IndexType::Vector,
|
||||
Some("idx".to_string()),
|
||||
¶ms,
|
||||
false,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
// Second fragment + delta segment so the index has two parts, then a
|
||||
// third fragment left unindexed for the sweep half of the plan.
|
||||
testing::append_dataset(&mut dataset, &testing::vectors(4, 4), &["i", "j", "k", "l"]).await;
|
||||
dataset
|
||||
.optimize_indices(&OptimizeOptions::append())
|
||||
.await
|
||||
.unwrap();
|
||||
testing::append_dataset(&mut dataset, &testing::vectors(2, 4), &["m", "n"]).await;
|
||||
|
||||
let resolved = VectorTable::resolve(&dataset, None, None).unwrap();
|
||||
let base = Query {
|
||||
vector: vec![0.5; 4],
|
||||
k: 5,
|
||||
filter: None,
|
||||
postfilter: false,
|
||||
distance: DistanceType::L2,
|
||||
nprobes: None,
|
||||
index_segments: None,
|
||||
fragments: None,
|
||||
};
|
||||
let want: Vec<(u64, u32)> = query::ann(&dataset, &resolved, &base)
|
||||
.await
|
||||
.unwrap()
|
||||
.iter()
|
||||
.map(|h| (h.row_id, h.distance.to_bits()))
|
||||
.collect();
|
||||
|
||||
let segments_bitmap = segment_fragments(&dataset, "vector").await.unwrap();
|
||||
let segments: Vec<Uuid> = segments_bitmap.iter().map(|(id, _)| *id).collect();
|
||||
assert!(
|
||||
segments.len() >= 2,
|
||||
"expected >=2 segments, got {segments:?}"
|
||||
);
|
||||
// The unindexed fragment belongs to nobody's segment; worker 0 sweeps
|
||||
// it next to its own share — the same contract plan_search implements
|
||||
// on the enterprise side.
|
||||
let unindexed: Vec<u64> = {
|
||||
let all: std::collections::BTreeSet<u64> =
|
||||
dataset.fragments().iter().map(|f| f.id).collect();
|
||||
let mut indexed = std::collections::BTreeSet::new();
|
||||
for (_, b) in &segments_bitmap {
|
||||
indexed.extend(b.iter().map(|i| i as u64));
|
||||
}
|
||||
all.difference(&indexed).copied().collect()
|
||||
};
|
||||
assert!(!unindexed.is_empty(), "expected an unindexed fragment");
|
||||
let mut merged: Vec<(f32, u64)> = Vec::new();
|
||||
for (w, share) in partition(&segments, 2).into_iter().enumerate() {
|
||||
let mut worker_q = base.clone();
|
||||
worker_q.index_segments = Some(share);
|
||||
if w == 0 {
|
||||
worker_q.fragments = Some(unindexed.clone());
|
||||
}
|
||||
merged.extend(
|
||||
query::ann(&dataset, &resolved, &worker_q)
|
||||
.await
|
||||
.unwrap()
|
||||
.iter()
|
||||
.map(|h| (h.distance, h.row_id)),
|
||||
);
|
||||
}
|
||||
merged.sort_by(|a, b| {
|
||||
a.0.partial_cmp(&b.0)
|
||||
.unwrap_or(std::cmp::Ordering::Equal)
|
||||
.then(a.1.cmp(&b.1))
|
||||
});
|
||||
let got: Vec<(u64, u32)> = merged
|
||||
.iter()
|
||||
.take(base.k)
|
||||
.map(|(d, id)| (*id, d.to_bits()))
|
||||
.collect();
|
||||
assert_eq!(got, want);
|
||||
}
|
||||
|
||||
/// named_segment_fragments must carry the logical index name through —
|
||||
/// a fanout planner groups tasks by name.
|
||||
#[tokio::test]
|
||||
async fn named_segment_fragments_returns_index_names() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let mut dataset = testing::write_dataset(
|
||||
&dir,
|
||||
&testing::vectors(8, 4),
|
||||
&["a", "b", "c", "d", "e", "f", "g", "h"],
|
||||
)
|
||||
.await;
|
||||
let params = VectorIndexParams::ivf_flat(4, DistanceType::L2);
|
||||
dataset
|
||||
.create_index(
|
||||
&["vector"],
|
||||
IndexType::Vector,
|
||||
Some("shard-a".to_string()),
|
||||
¶ms,
|
||||
false,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let named = named_segment_fragments(&dataset, "vector").await.unwrap();
|
||||
assert!(!named.is_empty());
|
||||
assert!(named.iter().all(|(_, name, _)| name == "shard-a"));
|
||||
}
|
||||
|
||||
/// A scope of fragment ids that no longer exist, an empty list, or an
|
||||
/// empty-segment assignment must return no hits — never fall through to
|
||||
/// an unrestricted scan.
|
||||
#[tokio::test]
|
||||
async fn empty_scope_scans_nothing() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let dataset =
|
||||
testing::write_dataset(&dir, &testing::vectors(4, 4), &["a", "b", "c", "d"]).await;
|
||||
let resolved = VectorTable::resolve(&dataset, None, None).unwrap();
|
||||
let mut q = Query {
|
||||
vector: vec![0.5; 4],
|
||||
k: 4,
|
||||
filter: None,
|
||||
postfilter: false,
|
||||
distance: DistanceType::L2,
|
||||
nprobes: None,
|
||||
index_segments: None,
|
||||
fragments: Some(vec![u64::MAX]),
|
||||
};
|
||||
assert!(
|
||||
query::ann(&dataset, &resolved, &q)
|
||||
.await
|
||||
.unwrap()
|
||||
.is_empty()
|
||||
);
|
||||
assert!(
|
||||
query::flat(&dataset, &resolved, &q)
|
||||
.await
|
||||
.unwrap()
|
||||
.is_empty()
|
||||
);
|
||||
q.fragments = Some(Vec::new());
|
||||
assert!(
|
||||
query::ann(&dataset, &resolved, &q)
|
||||
.await
|
||||
.unwrap()
|
||||
.is_empty()
|
||||
);
|
||||
q.fragments = None;
|
||||
q.index_segments = Some(Vec::new());
|
||||
assert!(
|
||||
query::ann(&dataset, &resolved, &q)
|
||||
.await
|
||||
.unwrap()
|
||||
.is_empty()
|
||||
);
|
||||
assert!(partition(&[Uuid::nil()], 0).is_empty());
|
||||
}
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
//! The columns a vector query needs, resolved from a table's Arrow schema.
|
||||
|
||||
use anyhow::{Context, Result, bail};
|
||||
use arrow_schema::DataType;
|
||||
use lance::Dataset;
|
||||
|
||||
/// The default name for the vector column, matching what the S3 Vectors API
|
||||
/// writes.
|
||||
const DEFAULT_VECTOR_COLUMN: &str = "vector";
|
||||
|
||||
/// The default name for the key column.
|
||||
const DEFAULT_KEY_COLUMN: &str = "key";
|
||||
|
||||
/// Layout of a Lance table used as a vector index.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct VectorTable {
|
||||
/// The row key column; `None` falls back to `_rowid` in results.
|
||||
pub key_column: Option<String>,
|
||||
pub vector_column: String,
|
||||
pub dimension: usize,
|
||||
pub metadata_columns: Vec<String>,
|
||||
}
|
||||
|
||||
impl VectorTable {
|
||||
/// Resolve the vector layout of `dataset`. `vector_column` and
|
||||
/// `key_column` override detection: the vector column defaults to the one
|
||||
/// named `vector`, or the sole fixed-size float list when unambiguous.
|
||||
pub fn resolve(
|
||||
dataset: &Dataset,
|
||||
vector_column: Option<&str>,
|
||||
key_column: Option<&str>,
|
||||
) -> Result<Self> {
|
||||
let schema: arrow_schema::Schema = dataset.schema().into();
|
||||
resolve_schema(&schema, vector_column, key_column)
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn resolve_schema(
|
||||
schema: &arrow_schema::Schema,
|
||||
vector_column: Option<&str>,
|
||||
key_column: Option<&str>,
|
||||
) -> Result<VectorTable> {
|
||||
let vector_column = match vector_column {
|
||||
Some(name) => name.to_string(),
|
||||
None => detect_vector_column(schema)?,
|
||||
};
|
||||
let field = schema
|
||||
.field_with_name(&vector_column)
|
||||
.with_context(|| format!("no such column {vector_column}"))?;
|
||||
let dimension = vector_dimension(field.data_type())
|
||||
.with_context(|| format!("column {vector_column} is not a fixed-size float vector"))?;
|
||||
|
||||
let key_column = match key_column {
|
||||
Some(name) => {
|
||||
let field = schema
|
||||
.field_with_name(name)
|
||||
.with_context(|| format!("no such column {name}"))?;
|
||||
if field.data_type() != &DataType::Utf8 {
|
||||
bail!("key column {name} is not Utf8");
|
||||
}
|
||||
Some(name.to_string())
|
||||
}
|
||||
None => detect_key_column(schema),
|
||||
};
|
||||
|
||||
let metadata_columns = schema
|
||||
.fields()
|
||||
.iter()
|
||||
.map(|f| f.name().clone())
|
||||
.filter(|name| name != &vector_column && Some(name) != key_column.as_ref())
|
||||
.collect();
|
||||
|
||||
Ok(VectorTable {
|
||||
key_column,
|
||||
vector_column,
|
||||
dimension,
|
||||
metadata_columns,
|
||||
})
|
||||
}
|
||||
|
||||
fn detect_vector_column(schema: &arrow_schema::Schema) -> Result<String> {
|
||||
let mut named = None;
|
||||
let mut candidates = Vec::new();
|
||||
for field in schema.fields() {
|
||||
if vector_dimension(field.data_type()).is_none() {
|
||||
continue;
|
||||
}
|
||||
if field.name() == DEFAULT_VECTOR_COLUMN {
|
||||
named = Some(field.name().clone());
|
||||
}
|
||||
candidates.push(field.name().clone());
|
||||
}
|
||||
if let Some(name) = named {
|
||||
return Ok(name);
|
||||
}
|
||||
match candidates.as_slice() {
|
||||
[only] => Ok(only.clone()),
|
||||
[] => bail!("no fixed-size float vector column found"),
|
||||
many => bail!("several vector columns, pick one of: {}", many.join(", ")),
|
||||
}
|
||||
}
|
||||
|
||||
fn detect_key_column(schema: &arrow_schema::Schema) -> Option<String> {
|
||||
schema
|
||||
.field_with_name(DEFAULT_KEY_COLUMN)
|
||||
.ok()
|
||||
.filter(|f| f.data_type() == &DataType::Utf8)
|
||||
.map(|f| f.name().clone())
|
||||
}
|
||||
|
||||
fn vector_dimension(data_type: &DataType) -> Option<usize> {
|
||||
let DataType::FixedSizeList(child, dimension) = data_type else {
|
||||
return None;
|
||||
};
|
||||
match child.data_type() {
|
||||
DataType::Float16 | DataType::Float32 | DataType::Float64 => Some(*dimension as usize),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use arrow_schema::{Field, Schema};
|
||||
use std::sync::Arc;
|
||||
|
||||
fn vector_field(name: &str, dim: i32) -> Field {
|
||||
Field::new(
|
||||
name,
|
||||
DataType::FixedSizeList(Arc::new(Field::new("item", DataType::Float32, true)), dim),
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_prefers_the_column_named_vector() {
|
||||
let schema = Schema::new(vec![
|
||||
Field::new("key", DataType::Utf8, false),
|
||||
vector_field("embedding", 4),
|
||||
vector_field("vector", 8),
|
||||
Field::new("tag", DataType::Utf8, true),
|
||||
]);
|
||||
let table = resolve_schema(&schema, None, None).unwrap();
|
||||
assert_eq!(table.vector_column, "vector");
|
||||
assert_eq!(table.dimension, 8);
|
||||
assert_eq!(table.key_column.as_deref(), Some("key"));
|
||||
assert_eq!(table.metadata_columns, vec!["embedding", "tag"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_uses_the_sole_vector_column() {
|
||||
let schema = Schema::new(vec![
|
||||
vector_field("embedding", 4),
|
||||
Field::new("tag", DataType::Utf8, true),
|
||||
]);
|
||||
let table = resolve_schema(&schema, None, None).unwrap();
|
||||
assert_eq!(table.vector_column, "embedding");
|
||||
assert_eq!(table.key_column, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_rejects_ambiguous_vector_columns() {
|
||||
let schema = Schema::new(vec![vector_field("a", 4), vector_field("b", 4)]);
|
||||
assert!(resolve_schema(&schema, None, None).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_rejects_a_non_vector_column() {
|
||||
let schema = Schema::new(vec![
|
||||
Field::new("vector", DataType::Utf8, true),
|
||||
vector_field("embedding", 4),
|
||||
]);
|
||||
assert!(resolve_schema(&schema, Some("vector"), None).is_err());
|
||||
let table = resolve_schema(&schema, None, Some("vector")).unwrap();
|
||||
assert_eq!(table.vector_column, "embedding");
|
||||
assert_eq!(table.key_column.as_deref(), Some("vector"));
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
//! Small Lance datasets for the query and coverage tests.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use arrow_array::{
|
||||
FixedSizeListArray, RecordBatch, RecordBatchIterator, StringArray, types::Float32Type,
|
||||
};
|
||||
use arrow_schema::{DataType, Field, Schema};
|
||||
use lance::Dataset;
|
||||
use lance::dataset::WriteParams;
|
||||
use tempfile::TempDir;
|
||||
|
||||
pub const DIM: usize = 4;
|
||||
|
||||
fn vector_column(vectors: &[Vec<f32>], dim: usize) -> FixedSizeListArray {
|
||||
FixedSizeListArray::from_iter_primitive::<Float32Type, _, _>(
|
||||
vectors
|
||||
.iter()
|
||||
.map(|v| Some(v.iter().copied().map(Some).collect::<Vec<_>>())),
|
||||
dim as i32,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn schema(dim: usize) -> Arc<Schema> {
|
||||
Arc::new(Schema::new(vec![
|
||||
Field::new("key", DataType::Utf8, false),
|
||||
Field::new(
|
||||
"vector",
|
||||
DataType::FixedSizeList(
|
||||
Arc::new(Field::new("item", DataType::Float32, true)),
|
||||
dim as i32,
|
||||
),
|
||||
false,
|
||||
),
|
||||
Field::new("tag", DataType::Utf8, true),
|
||||
]))
|
||||
}
|
||||
|
||||
pub fn batch(offset: usize, vectors: &[Vec<f32>], tags: &[&str], dim: usize) -> RecordBatch {
|
||||
let keys: Vec<String> = (0..vectors.len())
|
||||
.map(|i| format!("k{}", offset + i))
|
||||
.collect();
|
||||
RecordBatch::try_new(
|
||||
schema(dim),
|
||||
vec![
|
||||
Arc::new(StringArray::from(keys)),
|
||||
Arc::new(vector_column(vectors, dim)),
|
||||
Arc::new(StringArray::from(
|
||||
tags.iter().map(|t| Some(t.to_string())).collect::<Vec<_>>(),
|
||||
)),
|
||||
],
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub async fn write_dataset(dir: &TempDir, vectors: &[Vec<f32>], tags: &[&str]) -> Dataset {
|
||||
write_dataset_at(dir.path().to_str().unwrap(), vectors, tags).await
|
||||
}
|
||||
|
||||
pub async fn write_dataset_at(uri: &str, vectors: &[Vec<f32>], tags: &[&str]) -> Dataset {
|
||||
let dim = vectors[0].len();
|
||||
let reader = RecordBatchIterator::new(
|
||||
vec![Ok(batch(0, vectors, tags, dim))].into_iter(),
|
||||
schema(dim),
|
||||
);
|
||||
Dataset::write(reader, uri, None).await.unwrap()
|
||||
}
|
||||
|
||||
/// Deterministic non-trivial vectors for index coverage tests.
|
||||
pub fn vectors(rows: usize, dim: usize) -> Vec<Vec<f32>> {
|
||||
(0..rows)
|
||||
.map(|i| {
|
||||
(0..dim)
|
||||
.map(|j| ((i * 31 + j * 17) % 97) as f32 / 97.0)
|
||||
.collect()
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Commit a new version whose fragment is not yet covered by the index the
|
||||
/// dataset had before.
|
||||
pub async fn append_dataset(dataset: &mut Dataset, vectors: &[Vec<f32>], tags: &[&str]) {
|
||||
let offset = dataset.count_rows(None).await.unwrap();
|
||||
let dim = vectors[0].len();
|
||||
let reader = RecordBatchIterator::new(
|
||||
vec![Ok(batch(offset, vectors, tags, dim))].into_iter(),
|
||||
schema(dim),
|
||||
);
|
||||
dataset
|
||||
.append(reader, Some(WriteParams::default()))
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
@@ -1,203 +0,0 @@
|
||||
//! The spike's exit gate: the engine's answers must equal what a bare Lance
|
||||
//! `scan().nearest()` produces on the same pinned version, and no eligible
|
||||
//! row — indexed or not — may be missing.
|
||||
|
||||
use arrow_array::{Float32Array, UInt64Array};
|
||||
use futures::TryStreamExt;
|
||||
use lance::Dataset;
|
||||
use lance::index::DatasetIndexExt;
|
||||
use lance::index::vector::VectorIndexParams;
|
||||
use lance_index::IndexType;
|
||||
use lance_index::optimize::OptimizeOptions;
|
||||
use lance_linalg::distance::DistanceType;
|
||||
use tempfile::TempDir;
|
||||
|
||||
use crate::coverage::coverage;
|
||||
use crate::query::{self, Query};
|
||||
use crate::table::VectorTable;
|
||||
use crate::testing::{self, DIM};
|
||||
|
||||
async fn indexed_dataset(dir: &TempDir) -> Dataset {
|
||||
let mut dataset = testing::write_dataset(dir, &testing::vectors(64, DIM), &["a"; 64]).await;
|
||||
let params = VectorIndexParams::ivf_flat(4, DistanceType::L2);
|
||||
dataset
|
||||
.create_index(
|
||||
&["vector"],
|
||||
IndexType::Vector,
|
||||
Some("vidx".to_string()),
|
||||
¶ms,
|
||||
true,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
dataset.checkout_latest().await.unwrap();
|
||||
dataset
|
||||
}
|
||||
|
||||
fn query_for(vector: Vec<f32>, k: usize) -> Query {
|
||||
Query {
|
||||
vector,
|
||||
k,
|
||||
filter: None,
|
||||
postfilter: false,
|
||||
distance: DistanceType::L2,
|
||||
nprobes: Some(4),
|
||||
index_segments: None,
|
||||
fragments: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// The reference path: a bare scanner over the same dataset handle.
|
||||
async fn reference(dataset: &Dataset, vector: &[f32], k: usize) -> Vec<(u64, f32)> {
|
||||
let mut scanner = dataset.scan();
|
||||
scanner
|
||||
.nearest("vector", &Float32Array::from(vector.to_vec()), k)
|
||||
.unwrap()
|
||||
.distance_metric(DistanceType::L2)
|
||||
.nprobes(4)
|
||||
.with_row_id();
|
||||
let mut stream = scanner.try_into_stream().await.unwrap();
|
||||
let mut rows = Vec::new();
|
||||
while let Some(batch) = stream.try_next().await.unwrap() {
|
||||
let ids = batch
|
||||
.column_by_name("_rowid")
|
||||
.unwrap()
|
||||
.as_any()
|
||||
.downcast_ref::<UInt64Array>()
|
||||
.unwrap();
|
||||
let distances = batch
|
||||
.column_by_name("_distance")
|
||||
.unwrap()
|
||||
.as_any()
|
||||
.downcast_ref::<Float32Array>()
|
||||
.unwrap();
|
||||
for i in 0..batch.num_rows() {
|
||||
rows.push((ids.value(i), distances.value(i)));
|
||||
}
|
||||
}
|
||||
rows
|
||||
}
|
||||
|
||||
async fn assert_matches_reference(dataset: &Dataset, vector: &[f32], k: usize) {
|
||||
let table = VectorTable::resolve(dataset, None, None).unwrap();
|
||||
let hits = query::ann(dataset, &table, &query_for(vector.to_vec(), k))
|
||||
.await
|
||||
.unwrap();
|
||||
let expected = reference(dataset, vector, k).await;
|
||||
assert_eq!(hits.len(), expected.len());
|
||||
for (hit, (row_id, distance)) in hits.iter().zip(expected.iter()) {
|
||||
assert_eq!(hit.row_id, *row_id);
|
||||
assert!((hit.distance - distance).abs() < 1e-6, "{}", hit.key);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn ann_matches_lance_reference() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let dataset = indexed_dataset(&dir).await;
|
||||
assert_matches_reference(&dataset, &testing::vectors(1, DIM)[0], 10).await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn ann_matches_reference_over_unindexed_fragments() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let mut dataset = indexed_dataset(&dir).await;
|
||||
testing::append_dataset(&mut dataset, &testing::vectors(8, DIM), &["a"; 8]).await;
|
||||
|
||||
let cov = &coverage(&dataset, "vector").await.unwrap()[0];
|
||||
assert_eq!(cov.unindexed_fragments.len(), 1);
|
||||
assert_eq!(cov.unindexed_rows, 8);
|
||||
|
||||
for vector in testing::vectors(4, DIM) {
|
||||
assert_matches_reference(&dataset, &vector, 10).await;
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn ann_matches_reference_across_segments() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let mut dataset = indexed_dataset(&dir).await;
|
||||
testing::append_dataset(&mut dataset, &testing::vectors(32, DIM), &["a"; 32]).await;
|
||||
dataset
|
||||
.optimize_indices(&OptimizeOptions::append())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let cov = &coverage(&dataset, "vector").await.unwrap()[0];
|
||||
assert_eq!(cov.segments, 2);
|
||||
assert!(cov.unindexed_fragments.is_empty());
|
||||
|
||||
for vector in testing::vectors(4, DIM) {
|
||||
assert_matches_reference(&dataset, &vector, 10).await;
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn deletes_are_not_returned() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let mut dataset = indexed_dataset(&dir).await;
|
||||
dataset.delete("key = 'k0'").await.unwrap();
|
||||
assert_matches_reference(&dataset, &testing::vectors(1, DIM)[0], 10).await;
|
||||
}
|
||||
|
||||
/// Writes a small indexed dataset with unindexed rows to
|
||||
/// $WEED_VECTOR_SPIKE_DIR for exercising the `weed-vector` CLI:
|
||||
///
|
||||
/// WEED_VECTOR_SPIKE_DIR=/tmp/vds cargo test make_spike_dataset -- --ignored
|
||||
/// weed-vector-cli describe /tmp/vds
|
||||
/// weed-vector-cli coverage /tmp/vds
|
||||
/// weed-vector-cli query /tmp/vds --vector 0,0,0,0 --k 5
|
||||
#[tokio::test]
|
||||
#[ignore]
|
||||
async fn make_spike_dataset() {
|
||||
let dir = std::env::var("WEED_VECTOR_SPIKE_DIR").expect("set WEED_VECTOR_SPIKE_DIR");
|
||||
let mut dataset = testing::write_dataset_at(&dir, &testing::vectors(64, DIM), &["a"; 64]).await;
|
||||
let params = VectorIndexParams::ivf_flat(4, DistanceType::L2);
|
||||
dataset
|
||||
.create_index(
|
||||
&["vector"],
|
||||
IndexType::Vector,
|
||||
Some("vidx".to_string()),
|
||||
¶ms,
|
||||
true,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
dataset.checkout_latest().await.unwrap();
|
||||
testing::append_dataset(&mut dataset, &testing::vectors(8, DIM), &["b"; 8]).await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn query_at_pinned_version_survives_maintenance() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let mut dataset = indexed_dataset(&dir).await;
|
||||
let pinned = dataset
|
||||
.checkout_version(dataset.version().version)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
testing::append_dataset(&mut dataset, &testing::vectors(8, DIM), &["b"; 8]).await;
|
||||
dataset
|
||||
.optimize_indices(&OptimizeOptions::default())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(pinned.count_rows(None).await.unwrap(), 64);
|
||||
let vector = testing::vectors(1, DIM)[0].clone();
|
||||
let hits = query::ann(
|
||||
&pinned,
|
||||
&VectorTable::resolve(&pinned, None, None).unwrap(),
|
||||
&query_for(vector.clone(), 10),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let expected = reference(&pinned, &vector, 10).await;
|
||||
assert_eq!(hits.len(), expected.len());
|
||||
assert!(hits.iter().all(|h| h.row_id < 64));
|
||||
for (hit, (row_id, distance)) in hits.iter().zip(expected.iter()) {
|
||||
assert_eq!(hit.row_id, *row_id);
|
||||
assert!((hit.distance - distance).abs() < 1e-6);
|
||||
}
|
||||
|
||||
assert_matches_reference(&dataset, &vector, 10).await;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
[package]
|
||||
name = "weed-vector-server"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
description = "VectorService gRPC server over SeaweedFS Lance table buckets"
|
||||
|
||||
[lib]
|
||||
name = "weed_vector_server"
|
||||
|
||||
[[bin]]
|
||||
name = "weed-vector"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
weed-vector-core = { path = "../core" }
|
||||
weed-lance-worker = { path = "../../../seaweed-worker/crates/lance" }
|
||||
lance = { version = "10", default-features = false, features = ["aws"] }
|
||||
lance-arrow = "10"
|
||||
lance-linalg = "10"
|
||||
arrow-array = "58"
|
||||
arrow-cast = "58"
|
||||
arrow-schema = "58"
|
||||
prost = "0.14"
|
||||
prost-types = "0.14"
|
||||
reqwest = { version = "0.12", default-features = false }
|
||||
tonic = { version = "0.14", features = ["tls-aws-lc"] }
|
||||
tonic-prost = "0.14"
|
||||
anyhow.workspace = true
|
||||
clap = { version = "4", features = ["derive", "env"] }
|
||||
futures = "0.3"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
tokio.workspace = true
|
||||
tokio-stream.workspace = true
|
||||
tracing.workspace = true
|
||||
tracing-subscriber.workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
tonic-prost-build = "0.14"
|
||||
protoc-bin-vendored = "3"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -1,24 +0,0 @@
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
if std::env::var_os("PROTOC").is_none() {
|
||||
// SAFETY: a build script's main runs single-threaded before anything
|
||||
// else in this process, so no other thread can be reading the
|
||||
// environment concurrently.
|
||||
unsafe {
|
||||
std::env::set_var("PROTOC", protoc_bin_vendored::protoc_bin_path()?);
|
||||
}
|
||||
}
|
||||
tonic_prost_build::configure()
|
||||
.build_server(true)
|
||||
.build_client(true)
|
||||
.compile_protos(
|
||||
&[
|
||||
"../../../weed/pb/vector.proto",
|
||||
"../../../weed/pb/master.proto",
|
||||
"../../../weed/pb/volume_server.proto",
|
||||
"../../../weed/pb/remote.proto",
|
||||
],
|
||||
&["../../../weed/pb/"],
|
||||
)?;
|
||||
println!("cargo:rerun-if-changed=../../../weed/pb/vector.proto");
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
//! The VectorService gRPC server the S3 gateway talks to.
|
||||
|
||||
pub mod service;
|
||||
|
||||
pub mod remote_pb {
|
||||
tonic::include_proto!("remote_pb");
|
||||
}
|
||||
pub mod volume_server_pb {
|
||||
tonic::include_proto!("volume_server_pb");
|
||||
}
|
||||
pub mod master_pb {
|
||||
tonic::include_proto!("master_pb");
|
||||
}
|
||||
pub mod master_client;
|
||||
|
||||
pub mod pb {
|
||||
pub mod vector {
|
||||
tonic::include_proto!("vector_pb");
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use tonic::transport::Server;
|
||||
use weed_lance_worker::catalog::NamespaceClient;
|
||||
use weed_lance_worker::dataset::FallbackOptions;
|
||||
use weed_vector_server::pb::vector::vector_service_server::VectorServiceServer;
|
||||
use weed_vector_server::service::VectorServer;
|
||||
|
||||
/// The VectorService the S3 gateway fans vector calls out to.
|
||||
#[derive(Parser)]
|
||||
struct Args {
|
||||
/// Lance Namespace base URL, e.g. http://localhost:8888/lance.
|
||||
#[arg(
|
||||
long,
|
||||
env = "WEED_VECTOR_NAMESPACE",
|
||||
default_value = "http://localhost:8888/lance"
|
||||
)]
|
||||
namespace: String,
|
||||
/// gRPC listen address.
|
||||
#[arg(long, env = "WEED_VECTOR_LISTEN", default_value = "127.0.0.1:8080")]
|
||||
listen: String,
|
||||
/// object_store option fallback for deployments that vend no credentials:
|
||||
/// key=value, repeatable.
|
||||
#[arg(long = "storage-option", value_parser = parse_option)]
|
||||
storage_options: Vec<(String, String)>,
|
||||
/// Comma-separated master addresses to register this server with; the
|
||||
/// gateway discovers it via ListClusterNodes(client_type=vector).
|
||||
#[arg(long, env = "WEED_VECTOR_MASTERS")]
|
||||
masters: Option<String>,
|
||||
}
|
||||
|
||||
fn parse_option(s: &str) -> Result<(String, String), String> {
|
||||
s.split_once('=')
|
||||
.map(|(k, v)| (k.to_string(), v.to_string()))
|
||||
.ok_or_else(|| "expected key=value".to_string())
|
||||
}
|
||||
|
||||
/// A wildcard listen address is not reachable for peers; derive the outbound
|
||||
/// IP toward the first master instead — the address the master sees anyway.
|
||||
fn advertised_addr(listen: &str, masters: &[String]) -> String {
|
||||
let Some((host, _)) = listen.rsplit_once(':') else {
|
||||
return listen.to_string();
|
||||
};
|
||||
if !matches!(host, "0.0.0.0" | "::" | "" | "[::]") {
|
||||
return listen.to_string();
|
||||
}
|
||||
let port = listen.rsplit_once(':').map(|(_, p)| p).unwrap_or_default();
|
||||
if let Some(master) = masters.first() {
|
||||
if let Ok(sock) = std::net::UdpSocket::bind((host, 0u16)) {
|
||||
if sock.connect(master).is_ok() {
|
||||
if let Ok(local) = sock.local_addr() {
|
||||
return format!("{}:{}", local.ip(), port);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
listen.to_string()
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
tracing_subscriber::fmt::init();
|
||||
let args = Args::parse();
|
||||
if let Some(masters) = &args.masters {
|
||||
let masters: Vec<String> = masters.split(',').map(|s| s.trim().to_string()).collect();
|
||||
let advertise = advertised_addr(&args.listen, &masters);
|
||||
tokio::spawn(weed_vector_server::master_client::keep_connected(
|
||||
masters,
|
||||
advertise,
|
||||
));
|
||||
}
|
||||
let fallback: FallbackOptions = args.storage_options.into_iter().collect();
|
||||
let client = NamespaceClient::new(args.namespace.clone()).with_fallback(&fallback);
|
||||
let service = VectorServer::new(client, fallback);
|
||||
tracing::info!(namespace = %args.namespace, listen = %args.listen, "weed-vector");
|
||||
Server::builder()
|
||||
// Match the gateway's 1 GiB cap — put batches over the tonic 4 MiB
|
||||
// default otherwise get rejected before they reach the handler.
|
||||
.add_service(
|
||||
VectorServiceServer::new(service)
|
||||
.max_decoding_message_size(1 << 30)
|
||||
.max_encoding_message_size(1 << 30),
|
||||
)
|
||||
.serve(args.listen.parse()?)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
//! Self-registration with the weed master, mirroring how filer/s3 keep
|
||||
//! connected: hold a KeepConnected stream open to the leader and the node
|
||||
//! shows up in ListClusterNodes(client_type="vector").
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::Result;
|
||||
use tokio::time::sleep;
|
||||
use tonic::transport::Endpoint;
|
||||
|
||||
use crate::master_pb::{seaweed_client::SeaweedClient, KeepConnectedRequest};
|
||||
|
||||
fn registration(client_addr: &str) -> KeepConnectedRequest {
|
||||
KeepConnectedRequest {
|
||||
client_type: "vector".into(),
|
||||
client_address: client_addr.into(),
|
||||
version: env!("CARGO_PKG_VERSION").into(),
|
||||
filer_group: String::new(),
|
||||
data_center: String::new(),
|
||||
rack: String::new(),
|
||||
leave_lock_ring: false,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
/// Masters are configured by their HTTP address; gRPC lives +10000 like the
|
||||
/// weed conventions (server_address.ToGrpcAddress).
|
||||
// A master address may carry an explicit gRPC port as `host:http.grpc` —
|
||||
// use it directly; otherwise the gRPC port is http + 10000.
|
||||
fn grpc_addr(master: &str) -> String {
|
||||
let (scheme, rest) = master.split_once("://").unwrap_or(("http", master));
|
||||
if let Some((host, port)) = rest.rsplit_once(':') {
|
||||
if let Some((_, grpc)) = port.split_once('.') {
|
||||
if grpc.parse::<u16>().is_ok() {
|
||||
return format!("{scheme}://{host}:{grpc}");
|
||||
}
|
||||
}
|
||||
if let Ok(port) = port.parse::<u16>() {
|
||||
return format!("{scheme}://{host}:{}", port + 10000);
|
||||
}
|
||||
}
|
||||
format!("{scheme}://{rest}")
|
||||
}
|
||||
|
||||
// `host:http.grpc` normalizes to `host:http` so a leader hint naming the
|
||||
// dialed master does not read as a redirect.
|
||||
fn http_addr(master: &str) -> String {
|
||||
let rest = master.rsplit_once("://").map(|(_, r)| r).unwrap_or(master);
|
||||
match rest.rsplit_once(':') {
|
||||
Some((host, port)) => {
|
||||
format!("{host}:{}", port.split('.').next().unwrap_or(port))
|
||||
}
|
||||
None => rest.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Retry forever: try each master until a stream opens, hold it until it
|
||||
/// errors, then rediscover — same shape as wdclient.KeepConnectedToMaster.
|
||||
/// A follower response's leader hint takes priority on the next pass.
|
||||
pub async fn keep_connected(masters: Vec<String>, client_addr: String) {
|
||||
let mut leader: Option<String> = None;
|
||||
loop {
|
||||
let mut seeds: Vec<String> = Vec::new();
|
||||
if let Some(l) = &leader {
|
||||
seeds.push(l.clone());
|
||||
}
|
||||
seeds.extend(masters.iter().cloned());
|
||||
for master in &seeds {
|
||||
match stream_to(master, &client_addr).await {
|
||||
Ok(Some(l)) => {
|
||||
leader = Some(l);
|
||||
break;
|
||||
}
|
||||
Ok(None) => break,
|
||||
Err(e) => tracing::warn!("master {master}: {e:#}"),
|
||||
}
|
||||
}
|
||||
sleep(Duration::from_secs(3)).await;
|
||||
}
|
||||
}
|
||||
|
||||
async fn stream_to(master: &str, client_addr: &str) -> Result<Option<String>> {
|
||||
let channel = Endpoint::new(grpc_addr(master))?.connect().await?;
|
||||
let mut client = SeaweedClient::new(channel);
|
||||
let (tx, rx) = tokio::sync::mpsc::channel(8);
|
||||
tx.send(registration(client_addr)).await?;
|
||||
let mut stream = client
|
||||
.keep_connected(tokio_stream::wrappers::ReceiverStream::new(rx))
|
||||
.await?
|
||||
.into_inner();
|
||||
// The master keeps the node live while the stream is open; resend the
|
||||
// registration periodically so a reconnect never leaves a stale entry.
|
||||
loop {
|
||||
tokio::select! {
|
||||
msg = stream.message() => match msg? {
|
||||
Some(resp) => {
|
||||
// A volume_location appears on every response — only
|
||||
// follow it when the hint points at a different master,
|
||||
// otherwise the leader keeps identifying itself and we
|
||||
// would reconnect forever.
|
||||
if let Some(loc) = resp.volume_location {
|
||||
if !loc.leader.is_empty()
|
||||
&& http_addr(&loc.leader) != http_addr(master)
|
||||
{
|
||||
return Ok(Some(loc.leader));
|
||||
}
|
||||
}
|
||||
}
|
||||
None => anyhow::bail!("master closed the keep-connected stream"),
|
||||
},
|
||||
_ = sleep(Duration::from_secs(5)) => {
|
||||
tx.send(registration(client_addr)).await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,641 +0,0 @@
|
||||
use anyhow::{Result, bail};
|
||||
use arrow_array::{Array, ArrayRef, FixedSizeListArray, Float32Array, RecordBatch, StringArray};
|
||||
use arrow_schema::{DataType, Field, Schema};
|
||||
use futures::TryStreamExt;
|
||||
use lance::Dataset;
|
||||
use lance::dataset::ProjectionRequest;
|
||||
use lance::dataset::WriteParams;
|
||||
use lance::dataset::{MergeInsertBuilder, WhenMatched, WhenNotMatched};
|
||||
use lance::io::ObjectStoreParams;
|
||||
use lance::io::StorageOptionsAccessor;
|
||||
use lance_linalg::distance::DistanceType;
|
||||
use prost_types::{ListValue, Struct, Value, value::Kind};
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::sync::Arc;
|
||||
use tonic::{Request, Response, Status};
|
||||
use weed_lance_worker::catalog::NamespaceClient;
|
||||
use weed_lance_worker::dataset::{self, FallbackOptions};
|
||||
use weed_vector_core::query::{self, Query};
|
||||
use weed_vector_core::table::VectorTable;
|
||||
|
||||
use crate::pb::vector::{self as pb, vector_service_server::VectorService};
|
||||
|
||||
fn internal(err: impl Into<anyhow::Error>) -> Status {
|
||||
Status::internal(format!("{:#}", err.into()))
|
||||
}
|
||||
|
||||
fn invalid(err: impl Into<anyhow::Error>) -> Status {
|
||||
Status::invalid_argument(format!("{:#}", err.into()))
|
||||
}
|
||||
|
||||
fn open_status(err: anyhow::Error) -> Status {
|
||||
let missing = err.chain().any(|cause| {
|
||||
cause
|
||||
.downcast_ref::<reqwest::Error>()
|
||||
.is_some_and(|e| e.status() == Some(reqwest::StatusCode::NOT_FOUND))
|
||||
|| cause.downcast_ref::<lance::Error>().is_some_and(|e| {
|
||||
matches!(
|
||||
e,
|
||||
lance::Error::DatasetNotFound { .. }
|
||||
| lance::Error::NotFound { .. }
|
||||
| lance::Error::VersionNotFound { .. }
|
||||
)
|
||||
})
|
||||
});
|
||||
if missing {
|
||||
Status::not_found(format!("{:#}", err))
|
||||
} else {
|
||||
Status::unavailable(format!("{:#}", err))
|
||||
}
|
||||
}
|
||||
|
||||
const KEY_COLUMN: &str = "key";
|
||||
const METADATA_COLUMN: &str = "metadata";
|
||||
const VECTOR_COLUMN: &str = "vector";
|
||||
|
||||
fn schema_for(
|
||||
dimension: usize,
|
||||
metric: pb::DistanceMetric,
|
||||
non_filterable: &[String],
|
||||
) -> Arc<Schema> {
|
||||
let vector_field = Field::new(
|
||||
VECTOR_COLUMN,
|
||||
DataType::FixedSizeList(
|
||||
Arc::new(Field::new("item", DataType::Float32, false)),
|
||||
dimension as i32,
|
||||
),
|
||||
false,
|
||||
)
|
||||
.with_metadata(
|
||||
[(
|
||||
"distance_metric".to_string(),
|
||||
metric.as_str_name().to_string(),
|
||||
)]
|
||||
.into_iter()
|
||||
.collect(),
|
||||
);
|
||||
// The arrow.json extension marks the Utf8 column as JSON: lance stores it
|
||||
// as jsonb, which is what the json_get_* filter functions take.
|
||||
let mut metadata_meta =
|
||||
HashMap::from_iter([("ARROW:extension:name".to_string(), "arrow.json".to_string())]);
|
||||
if !non_filterable.is_empty() {
|
||||
metadata_meta.insert(
|
||||
"non_filterable_metadata_keys".to_string(),
|
||||
serde_json::to_string(non_filterable).unwrap_or_default(),
|
||||
);
|
||||
}
|
||||
let metadata_field =
|
||||
Field::new(METADATA_COLUMN, DataType::Utf8, true).with_metadata(metadata_meta);
|
||||
Arc::new(Schema::new(vec![
|
||||
Field::new(KEY_COLUMN, DataType::Utf8, false),
|
||||
vector_field,
|
||||
metadata_field,
|
||||
]))
|
||||
}
|
||||
|
||||
fn batch_of(vectors: &[pb::Vector], dimension: usize, schema: Arc<Schema>) -> Result<RecordBatch> {
|
||||
let mut seen = std::collections::HashSet::new();
|
||||
for vector in vectors {
|
||||
if !seen.insert(vector.key.as_str()) {
|
||||
bail!("duplicate key in request: {}", vector.key);
|
||||
}
|
||||
}
|
||||
let keys = StringArray::from(vectors.iter().map(|v| v.key.as_str()).collect::<Vec<_>>());
|
||||
// Check every vector's length before flattening: equal totals would
|
||||
// still let a short vector borrow from the next one's values.
|
||||
if vectors.iter().any(|v| v.data.len() != dimension) {
|
||||
bail!("a vector's data length does not match the index dimension");
|
||||
}
|
||||
let flat = vectors
|
||||
.iter()
|
||||
.flat_map(|v| v.data.iter().copied())
|
||||
.collect::<Vec<_>>();
|
||||
let values: ArrayRef = Arc::new(Float32Array::from(flat));
|
||||
// Lance stores the list item as nullable even when the write schema
|
||||
// declared it non-null, so the child field must come from the batch's
|
||||
// schema rather than a fixed declaration.
|
||||
let DataType::FixedSizeList(item_field, _) = schema
|
||||
.field_with_name(VECTOR_COLUMN)
|
||||
.map_err(anyhow::Error::from)?
|
||||
.data_type()
|
||||
else {
|
||||
bail!("vector column is not a fixed-size list");
|
||||
};
|
||||
let vectors_array =
|
||||
FixedSizeListArray::try_new(item_field.clone(), dimension as i32, values, None)?;
|
||||
let metas = vectors
|
||||
.iter()
|
||||
.map(|v| {
|
||||
v.metadata
|
||||
.as_ref()
|
||||
.map(|m| serde_json::to_string(&struct_to_json(m)))
|
||||
.transpose()
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
// The stored column is lance's jsonb (LargeBinary) once the field carries
|
||||
// the arrow.json extension; encode the strings, else keep the Utf8 batch.
|
||||
let metadata_array: ArrayRef = match schema
|
||||
.field_with_name(METADATA_COLUMN)
|
||||
.map(|f| f.data_type())
|
||||
{
|
||||
Ok(DataType::LargeBinary) => {
|
||||
Arc::new(lance_arrow::json::JsonArray::try_from_iter(metas)?.into_inner())
|
||||
}
|
||||
_ => Arc::new(StringArray::from(metas)),
|
||||
};
|
||||
RecordBatch::try_new(
|
||||
schema,
|
||||
vec![Arc::new(keys), Arc::new(vectors_array), metadata_array],
|
||||
)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
fn struct_to_json(s: &Struct) -> serde_json::Value {
|
||||
serde_json::Value::Object(
|
||||
s.fields
|
||||
.iter()
|
||||
.map(|(k, v)| (k.clone(), value_to_json(v)))
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
|
||||
fn value_to_json(v: &Value) -> serde_json::Value {
|
||||
match &v.kind {
|
||||
None | Some(Kind::NullValue(_)) => serde_json::Value::Null,
|
||||
Some(Kind::NumberValue(n)) => serde_json::json!(n),
|
||||
Some(Kind::StringValue(s)) => serde_json::json!(s),
|
||||
Some(Kind::BoolValue(b)) => serde_json::json!(b),
|
||||
Some(Kind::StructValue(s)) => struct_to_json(s),
|
||||
Some(Kind::ListValue(l)) => {
|
||||
serde_json::Value::Array(l.values.iter().map(value_to_json).collect())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn json_to_value(v: serde_json::Value) -> Value {
|
||||
let kind = match v {
|
||||
serde_json::Value::Null => Kind::NullValue(0),
|
||||
serde_json::Value::Bool(b) => Kind::BoolValue(b),
|
||||
serde_json::Value::Number(n) => Kind::NumberValue(n.as_f64().unwrap_or(0.0)),
|
||||
serde_json::Value::String(s) => Kind::StringValue(s),
|
||||
serde_json::Value::Array(items) => Kind::ListValue(ListValue {
|
||||
values: items.into_iter().map(json_to_value).collect(),
|
||||
}),
|
||||
serde_json::Value::Object(map) => Kind::StructValue(json_to_struct(map)),
|
||||
};
|
||||
Value { kind: Some(kind) }
|
||||
}
|
||||
|
||||
fn json_to_struct(map: serde_json::Map<String, serde_json::Value>) -> Struct {
|
||||
Struct {
|
||||
fields: map
|
||||
.into_iter()
|
||||
.map(|(k, v)| (k, json_to_value(v)))
|
||||
.collect::<BTreeMap<_, _>>(),
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_struct(s: &str) -> Result<Struct> {
|
||||
let v: serde_json::Value = serde_json::from_str(s)?;
|
||||
match v {
|
||||
serde_json::Value::Object(map) => Ok(json_to_struct(map)),
|
||||
_ => bail!("metadata is not a JSON object"),
|
||||
}
|
||||
}
|
||||
|
||||
fn key_list(keys: &[String]) -> String {
|
||||
format!(
|
||||
"`{KEY_COLUMN}` in ({})",
|
||||
keys.iter()
|
||||
.map(|k| format!("'{}'", k.replace('\'', "''")))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
)
|
||||
}
|
||||
|
||||
fn rows_as_vectors(
|
||||
batches: &[RecordBatch],
|
||||
return_data: bool,
|
||||
return_metadata: bool,
|
||||
) -> Vec<pb::Vector> {
|
||||
let mut out = Vec::new();
|
||||
for batch in batches {
|
||||
let Some(keys) = batch
|
||||
.column_by_name(KEY_COLUMN)
|
||||
.and_then(|c| c.as_any().downcast_ref::<StringArray>())
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
let vectors = batch
|
||||
.column_by_name(VECTOR_COLUMN)
|
||||
.and_then(|c| c.as_any().downcast_ref::<FixedSizeListArray>());
|
||||
let metas = batch
|
||||
.column_by_name(METADATA_COLUMN)
|
||||
.and_then(|c| c.as_any().downcast_ref::<StringArray>());
|
||||
for i in 0..batch.num_rows() {
|
||||
let data = match (return_data, vectors) {
|
||||
(true, Some(list)) => list
|
||||
.value(i)
|
||||
.as_any()
|
||||
.downcast_ref::<Float32Array>()
|
||||
.map(|a| a.values().to_vec())
|
||||
.unwrap_or_default(),
|
||||
_ => Vec::new(),
|
||||
};
|
||||
let metadata = match (return_metadata, metas) {
|
||||
(true, Some(m)) if !m.is_null(i) => parse_struct(m.value(i)).ok(),
|
||||
_ => None,
|
||||
};
|
||||
out.push(pb::Vector {
|
||||
key: keys.value(i).to_string(),
|
||||
data,
|
||||
metadata,
|
||||
});
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
pub struct VectorServer {
|
||||
client: NamespaceClient,
|
||||
fallback: FallbackOptions,
|
||||
}
|
||||
|
||||
impl VectorServer {
|
||||
pub fn new(client: NamespaceClient, fallback: FallbackOptions) -> Self {
|
||||
Self { client, fallback }
|
||||
}
|
||||
|
||||
async fn open(&self, table: &pb::Table) -> Result<Dataset> {
|
||||
let opened = dataset::open(&self.client, &table.id, &self.fallback).await?;
|
||||
let mut dataset = opened.dataset;
|
||||
if table.version != 0 {
|
||||
dataset = dataset.checkout_version(table.version).await?;
|
||||
}
|
||||
Ok(dataset)
|
||||
}
|
||||
}
|
||||
|
||||
#[tonic::async_trait]
|
||||
impl VectorService for VectorServer {
|
||||
async fn create_index(
|
||||
&self,
|
||||
request: Request<pb::CreateIndexRequest>,
|
||||
) -> Result<Response<pb::CreateIndexResponse>, Status> {
|
||||
let req = request.into_inner();
|
||||
let metric = req.distance_metric();
|
||||
let table = req
|
||||
.table
|
||||
.ok_or_else(|| Status::invalid_argument("missing table"))?;
|
||||
let dimension = req.dimension as usize;
|
||||
// S3 Vectors caps at 4096; reject beyond it instead of letting an
|
||||
// oversized request build a huge Arrow schema.
|
||||
if dimension == 0 || dimension > 4096 {
|
||||
return Err(Status::invalid_argument("dimension must be 1..=4096"));
|
||||
}
|
||||
let description = self
|
||||
.client
|
||||
.declare_table(&table.id, None)
|
||||
.await
|
||||
.map_err(internal)?;
|
||||
let mut options = self.fallback.clone();
|
||||
options.extend(description.storage_options.clone());
|
||||
let schema = schema_for(dimension, metric, &req.non_filterable_metadata_keys);
|
||||
let empty = RecordBatch::new_empty(schema.clone());
|
||||
let reader = arrow_array::RecordBatchIterator::new(vec![Ok(empty)].into_iter(), schema);
|
||||
let dataset = Dataset::write(
|
||||
reader,
|
||||
&description.location,
|
||||
Some(WriteParams {
|
||||
store_params: Some(ObjectStoreParams {
|
||||
storage_options_accessor: Some(Arc::new(
|
||||
StorageOptionsAccessor::with_static_options(options),
|
||||
)),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
}),
|
||||
)
|
||||
.await
|
||||
.map_err(internal)?;
|
||||
Ok(Response::new(pb::CreateIndexResponse {
|
||||
version: dataset.version().version,
|
||||
}))
|
||||
}
|
||||
|
||||
async fn drop_index(
|
||||
&self,
|
||||
_request: Request<pb::DropIndexRequest>,
|
||||
) -> Result<Response<pb::DropIndexResponse>, Status> {
|
||||
// Dropping is a catalog decision; the gateway deletes the table record.
|
||||
Err(Status::unimplemented("drop through the catalog"))
|
||||
}
|
||||
|
||||
async fn put_vectors(
|
||||
&self,
|
||||
request: Request<pb::PutVectorsRequest>,
|
||||
) -> Result<Response<pb::PutVectorsResponse>, Status> {
|
||||
let req = request.into_inner();
|
||||
let table = req
|
||||
.table
|
||||
.ok_or_else(|| Status::invalid_argument("missing table"))?;
|
||||
let dataset = self.open(&table).await.map_err(open_status)?;
|
||||
if req.vectors.is_empty() {
|
||||
return Ok(Response::new(pb::PutVectorsResponse {
|
||||
version: dataset.version().version,
|
||||
}));
|
||||
}
|
||||
let dimension = VectorTable::resolve(&dataset, None, Some(KEY_COLUMN))
|
||||
.map_err(invalid)?
|
||||
.dimension;
|
||||
let batch = batch_of(
|
||||
&req.vectors,
|
||||
dimension,
|
||||
Arc::new(Into::<arrow_schema::Schema>::into(dataset.schema())),
|
||||
)
|
||||
.map_err(invalid)?;
|
||||
// Upsert by key in one merge commit: no window where the old rows are
|
||||
// already deleted, and a losing writer fails the request instead of
|
||||
// leaving duplicate keys.
|
||||
let mut builder =
|
||||
MergeInsertBuilder::try_new(Arc::new(dataset), vec![KEY_COLUMN.to_string()])
|
||||
.map_err(internal)?;
|
||||
builder.when_matched(WhenMatched::UpdateAll);
|
||||
builder.when_not_matched(WhenNotMatched::InsertAll);
|
||||
let (dataset, _stats) = builder
|
||||
.try_build()
|
||||
.map_err(internal)?
|
||||
.execute_batches(vec![batch])
|
||||
.await
|
||||
.map_err(internal)?;
|
||||
Ok(Response::new(pb::PutVectorsResponse {
|
||||
version: dataset.version().version,
|
||||
}))
|
||||
}
|
||||
|
||||
async fn get_vectors(
|
||||
&self,
|
||||
request: Request<pb::GetVectorsRequest>,
|
||||
) -> Result<Response<pb::GetVectorsResponse>, Status> {
|
||||
let req = request.into_inner();
|
||||
let table = req
|
||||
.table
|
||||
.ok_or_else(|| Status::invalid_argument("missing table"))?;
|
||||
let dataset = self.open(&table).await.map_err(open_status)?;
|
||||
// Lease the resolved version so maintenance cannot reclaim its files
|
||||
// while this query runs against it.
|
||||
let _lease = weed_vector_core::maintenance::try_pin(&dataset)
|
||||
.await
|
||||
.map_err(internal)?;
|
||||
let resolved = VectorTable::resolve(&dataset, None, Some(KEY_COLUMN)).map_err(invalid)?;
|
||||
let batches = query::get(&dataset, &resolved, &req.keys)
|
||||
.await
|
||||
.map_err(internal)?;
|
||||
Ok(Response::new(pb::GetVectorsResponse {
|
||||
vectors: rows_as_vectors(&batches, req.return_data, req.return_metadata),
|
||||
}))
|
||||
}
|
||||
|
||||
async fn delete_vectors(
|
||||
&self,
|
||||
request: Request<pb::DeleteVectorsRequest>,
|
||||
) -> Result<Response<pb::DeleteVectorsResponse>, Status> {
|
||||
let req = request.into_inner();
|
||||
let table = req
|
||||
.table
|
||||
.ok_or_else(|| Status::invalid_argument("missing table"))?;
|
||||
let mut dataset = self.open(&table).await.map_err(open_status)?;
|
||||
if !req.keys.is_empty() {
|
||||
dataset
|
||||
.delete(&key_list(&req.keys))
|
||||
.await
|
||||
.map_err(internal)?;
|
||||
}
|
||||
Ok(Response::new(pb::DeleteVectorsResponse {
|
||||
version: dataset.version().version,
|
||||
}))
|
||||
}
|
||||
|
||||
async fn list_vectors(
|
||||
&self,
|
||||
request: Request<pb::ListVectorsRequest>,
|
||||
) -> Result<Response<pb::ListVectorsResponse>, Status> {
|
||||
let req = request.into_inner();
|
||||
let table = req
|
||||
.table
|
||||
.ok_or_else(|| Status::invalid_argument("missing table"))?;
|
||||
let dataset = self.open(&table).await.map_err(open_status)?;
|
||||
let offset: u64 = if req.next_token.is_empty() {
|
||||
0
|
||||
} else {
|
||||
req.next_token
|
||||
.parse()
|
||||
.map_err(|_| Status::invalid_argument("invalid next_token"))?
|
||||
};
|
||||
let mut columns = vec![KEY_COLUMN.to_string()];
|
||||
if req.return_data {
|
||||
columns.push(VECTOR_COLUMN.to_string());
|
||||
}
|
||||
if req.return_metadata {
|
||||
columns.push(METADATA_COLUMN.to_string());
|
||||
}
|
||||
// An unset max_results arrives as 0; page it like S3 Vectors does.
|
||||
const DEFAULT_PAGE: u32 = 500;
|
||||
const MAX_PAGE: u32 = 1000;
|
||||
let page = match req.max_results {
|
||||
0 => DEFAULT_PAGE,
|
||||
n => n.min(MAX_PAGE),
|
||||
};
|
||||
let mut scanner = dataset.scan();
|
||||
scanner
|
||||
.project(&columns)
|
||||
.map_err(internal)?
|
||||
.limit(Some(page as i64), Some(offset as i64))
|
||||
.map_err(internal)?;
|
||||
let batches: Vec<RecordBatch> = scanner
|
||||
.try_into_stream()
|
||||
.await
|
||||
.map_err(internal)?
|
||||
.try_collect()
|
||||
.await
|
||||
.map_err(internal)?;
|
||||
let rows = batches.iter().map(|b| b.num_rows()).sum::<usize>();
|
||||
let next = offset + rows as u64;
|
||||
let next_token = if rows == page as usize && rows > 0 {
|
||||
next.to_string()
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
Ok(Response::new(pb::ListVectorsResponse {
|
||||
vectors: rows_as_vectors(&batches, req.return_data, req.return_metadata),
|
||||
next_token,
|
||||
}))
|
||||
}
|
||||
|
||||
async fn query_vectors(
|
||||
&self,
|
||||
request: Request<pb::QueryVectorsRequest>,
|
||||
) -> Result<Response<pb::QueryVectorsResponse>, Status> {
|
||||
let req = request.into_inner();
|
||||
let table = req
|
||||
.table
|
||||
.ok_or_else(|| Status::invalid_argument("missing table"))?;
|
||||
let dataset = self.open(&table).await.map_err(open_status)?;
|
||||
// Lease the resolved version so maintenance cannot reclaim its files
|
||||
// while this query runs against it.
|
||||
let _lease = weed_vector_core::maintenance::try_pin(&dataset)
|
||||
.await
|
||||
.map_err(internal)?;
|
||||
let resolved = VectorTable::resolve(&dataset, None, Some(KEY_COLUMN)).map_err(invalid)?;
|
||||
if req.query_vector.len() != resolved.dimension {
|
||||
return Err(Status::invalid_argument(format!(
|
||||
"query vector carries {} floats, the index dimension is {}",
|
||||
req.query_vector.len(),
|
||||
resolved.dimension
|
||||
)));
|
||||
}
|
||||
if req.top_k == 0 {
|
||||
return Err(Status::invalid_argument("top_k must be positive"));
|
||||
}
|
||||
// The index's configured metric lives in the vector field's metadata.
|
||||
let distance = match dataset
|
||||
.schema()
|
||||
.field(VECTOR_COLUMN)
|
||||
.and_then(|f| f.metadata.get("distance_metric").map(String::as_str))
|
||||
{
|
||||
Some("COSINE") => DistanceType::Cosine,
|
||||
Some("DOT_PRODUCT") => DistanceType::Dot,
|
||||
_ => DistanceType::L2,
|
||||
};
|
||||
let query = Query {
|
||||
vector: req.query_vector,
|
||||
k: req.top_k as usize,
|
||||
filter: if req.filter.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(req.filter)
|
||||
},
|
||||
postfilter: req.postfilter,
|
||||
distance,
|
||||
nprobes: None,
|
||||
index_segments: None,
|
||||
fragments: None,
|
||||
};
|
||||
let hits = query::ann(&dataset, &resolved, &query)
|
||||
.await
|
||||
.map_err(internal)?;
|
||||
// One batched read for every hit's columns; keyed by the hit key so
|
||||
// row order does not matter.
|
||||
let mut metas: std::collections::HashMap<String, Option<Struct>> =
|
||||
std::collections::HashMap::new();
|
||||
let mut data_map: std::collections::HashMap<String, Vec<f32>> =
|
||||
std::collections::HashMap::new();
|
||||
if (req.return_metadata || req.return_data) && !hits.is_empty() {
|
||||
let row_ids: Vec<u64> = hits.iter().map(|h| h.row_id).collect();
|
||||
let mut columns = vec![KEY_COLUMN];
|
||||
if req.return_metadata {
|
||||
columns.push(METADATA_COLUMN);
|
||||
}
|
||||
if req.return_data {
|
||||
columns.push(VECTOR_COLUMN);
|
||||
}
|
||||
let batch = dataset
|
||||
.take_rows(
|
||||
&row_ids,
|
||||
ProjectionRequest::from_columns(columns, dataset.schema()),
|
||||
)
|
||||
.await
|
||||
.map_err(internal)?;
|
||||
let keys = batch
|
||||
.column_by_name(KEY_COLUMN)
|
||||
.and_then(|c| c.as_any().downcast_ref::<StringArray>());
|
||||
let meta_col = batch
|
||||
.column_by_name(METADATA_COLUMN)
|
||||
.and_then(|c| c.as_any().downcast_ref::<StringArray>());
|
||||
let data_col = batch
|
||||
.column_by_name(VECTOR_COLUMN)
|
||||
.and_then(|c| c.as_any().downcast_ref::<FixedSizeListArray>());
|
||||
if let Some(keys) = keys {
|
||||
for i in 0..batch.num_rows() {
|
||||
let key = keys.value(i).to_string();
|
||||
if let Some(meta_col) = meta_col {
|
||||
metas.insert(
|
||||
key.clone(),
|
||||
if meta_col.is_null(i) {
|
||||
None
|
||||
} else {
|
||||
parse_struct(meta_col.value(i)).ok()
|
||||
},
|
||||
);
|
||||
}
|
||||
if let Some(data_col) = data_col {
|
||||
data_map.insert(
|
||||
key,
|
||||
data_col
|
||||
.value(i)
|
||||
.as_any()
|
||||
.downcast_ref::<Float32Array>()
|
||||
.map(|a| a.values().to_vec())
|
||||
.unwrap_or_default(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut vectors = Vec::with_capacity(hits.len());
|
||||
for hit in &hits {
|
||||
vectors.push(pb::QueryResult {
|
||||
key: hit.key.clone(),
|
||||
distance: if req.return_distance {
|
||||
hit.distance
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
metadata: metas.remove(&hit.key).flatten(),
|
||||
data: data_map.remove(&hit.key).unwrap_or_default(),
|
||||
});
|
||||
}
|
||||
Ok(Response::new(pb::QueryVectorsResponse { vectors }))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn batch_of_rejects_a_ragged_vector() {
|
||||
let vectors = vec![
|
||||
pb::Vector {
|
||||
key: "a".to_string(),
|
||||
data: vec![1.0, 2.0],
|
||||
metadata: None,
|
||||
},
|
||||
pb::Vector {
|
||||
key: "b".to_string(),
|
||||
data: vec![1.0; 4],
|
||||
metadata: None,
|
||||
},
|
||||
];
|
||||
let schema = schema_for(4, pb::DistanceMetric::L2, &[]);
|
||||
assert!(batch_of(&vectors, 4, schema).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn batch_of_rejects_a_repeated_key() {
|
||||
let schema = schema_for(4, pb::DistanceMetric::L2, &[]);
|
||||
let vectors = vec![
|
||||
pb::Vector {
|
||||
key: "a".to_string(),
|
||||
data: vec![1.0; 4],
|
||||
metadata: None,
|
||||
},
|
||||
pb::Vector {
|
||||
key: "a".to_string(),
|
||||
data: vec![2.0; 4],
|
||||
metadata: None,
|
||||
},
|
||||
];
|
||||
assert!(batch_of(&vectors, 4, schema).is_err());
|
||||
}
|
||||
}
|
||||
Generated
+10
-11
@@ -86,7 +86,7 @@ version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -97,7 +97,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"once_cell_polyfill",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1350,7 +1350,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2404,7 +2404,7 @@ version = "0.50.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3416,14 +3416,14 @@ dependencies = [
|
||||
"errno 0.3.14",
|
||||
"libc",
|
||||
"linux-raw-sys 0.12.1",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.23.46"
|
||||
version = "0.23.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"
|
||||
checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634"
|
||||
dependencies = [
|
||||
"aws-lc-rs",
|
||||
"log",
|
||||
@@ -3701,7 +3701,7 @@ version = "1.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"
|
||||
dependencies = [
|
||||
"errno 0.3.14",
|
||||
"errno 0.2.8",
|
||||
"libc",
|
||||
]
|
||||
|
||||
@@ -3768,7 +3768,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3902,7 +3902,7 @@ dependencies = [
|
||||
"getrandom 0.4.2",
|
||||
"once_cell",
|
||||
"rustix 1.1.4",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4601,7 +4601,6 @@ dependencies = [
|
||||
"futures",
|
||||
"hex",
|
||||
"http-body 1.0.1",
|
||||
"httpdate",
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"image",
|
||||
|
||||
@@ -51,7 +51,6 @@ prost-types = "0.14"
|
||||
# HTTP server
|
||||
axum = { version = "0.8", features = ["multipart"] }
|
||||
http-body = "1"
|
||||
httpdate = "1"
|
||||
hyper = { version = "1", features = ["full"] }
|
||||
hyper-util = { version = "0.1", features = ["tokio", "service", "server-auto", "http1", "http2"] }
|
||||
tower = { version = "0.5", features = ["util"] }
|
||||
@@ -158,8 +157,6 @@ windows-sys = { version = "0.61", features = ["Win32_Storage_FileSystem"] }
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3"
|
||||
# Paused-time tests drive the write-queue batch window deterministically.
|
||||
tokio = { version = "1", features = ["full", "test-util"] }
|
||||
# Already a transitive dependency of aws-sdk-s3 at a single locked version;
|
||||
# needed directly only for the canned HttpClient in remote_storage::s3 tests.
|
||||
aws-smithy-runtime-api = "1"
|
||||
|
||||
@@ -233,25 +233,6 @@ pub struct Cli {
|
||||
#[arg(long = "volume.allowUntrustedRemoteEndpoints", default_value_t = false)]
|
||||
pub allow_untrusted_remote_endpoints: bool,
|
||||
|
||||
/// Minimum bytes an fsync batch gathers before a drained queue flushes
|
||||
/// without waiting.
|
||||
#[arg(long = "fsyncMinBatchBytes", default_value_t = 1024 * 1024)]
|
||||
pub fsync_min_batch_bytes: u64,
|
||||
|
||||
/// Minimum requests an fsync batch gathers before a drained queue flushes
|
||||
/// without waiting.
|
||||
#[arg(long = "fsyncMinBatchRequests", default_value_t = 128)]
|
||||
pub fsync_min_batch_requests: usize,
|
||||
|
||||
/// How long a below-minimum fsync batch waits for more requests once the
|
||||
/// queue drains; 0 flushes immediately.
|
||||
#[arg(
|
||||
long = "fsyncBatchWait",
|
||||
default_value = "500us",
|
||||
value_parser = parse_go_duration
|
||||
)]
|
||||
pub fsync_batch_wait: std::time::Duration,
|
||||
|
||||
/// A file of command line options, each line in optionName=optionValue format.
|
||||
#[arg(long = "options", default_value = "")]
|
||||
pub options: String,
|
||||
@@ -327,14 +308,6 @@ pub struct VolumeServerConfig {
|
||||
/// If true, FetchAndWriteNeedle skips remote S3 endpoint validation
|
||||
/// (allows loopback / link-local / metadata hosts).
|
||||
pub allow_untrusted_remote_endpoints: bool,
|
||||
/// Minimum bytes an fsync batch gathers before a drained queue flushes
|
||||
/// without waiting.
|
||||
pub fsync_min_batch_bytes: u64,
|
||||
/// Minimum requests an fsync batch gathers before a drained queue flushes
|
||||
/// without waiting.
|
||||
pub fsync_min_batch_requests: usize,
|
||||
/// How long a below-minimum fsync batch waits for stragglers.
|
||||
pub fsync_batch_wait: std::time::Duration,
|
||||
}
|
||||
|
||||
pub use crate::storage::needle_map::NeedleMapKind;
|
||||
@@ -352,25 +325,6 @@ pub enum MinFreeSpace {
|
||||
Bytes(u64),
|
||||
}
|
||||
|
||||
impl MinFreeSpace {
|
||||
/// Mirrors Go's MinFreeSpace.IsLow.
|
||||
pub fn is_low(&self, free_bytes: u64, total_bytes: u64) -> bool {
|
||||
match self {
|
||||
MinFreeSpace::Percent(pct) => free_bytes as f64 / total_bytes as f64 * 100.0 < *pct,
|
||||
MinFreeSpace::Bytes(min) => free_bytes < *min,
|
||||
}
|
||||
}
|
||||
|
||||
/// Free bytes above the floor; mirrors Go's MinFreeSpace.AvailableSpace.
|
||||
pub fn available_space(&self, free_bytes: u64, total_bytes: u64) -> u64 {
|
||||
let floor = match self {
|
||||
MinFreeSpace::Percent(pct) => (total_bytes as f64 * pct / 100.0) as u64,
|
||||
MinFreeSpace::Bytes(min) => *min,
|
||||
};
|
||||
free_bytes.saturating_sub(floor)
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert single-dash long options to double-dash for clap compatibility.
|
||||
/// Go's `flag` package uses `-port`, clap expects `--port`.
|
||||
/// This allows both `-port 8080` and `--port 8080` to work.
|
||||
@@ -984,9 +938,6 @@ fn resolve_config_with_env(cli: Cli, env: EnvLookup<'_>) -> VolumeServerConfig {
|
||||
concurrent_download_limit: cli.concurrent_download_limit_mb as i64 * 1024 * 1024,
|
||||
inflight_upload_data_timeout: cli.inflight_upload_data_timeout,
|
||||
inflight_download_data_timeout: cli.inflight_download_data_timeout,
|
||||
fsync_min_batch_bytes: cli.fsync_min_batch_bytes,
|
||||
fsync_min_batch_requests: cli.fsync_min_batch_requests,
|
||||
fsync_batch_wait: cli.fsync_batch_wait,
|
||||
has_slow_read: cli.has_slow_read,
|
||||
read_buffer_size_mb: cli.read_buffer_size_mb,
|
||||
ldb_timeout: cli.ldb_timeout,
|
||||
|
||||
@@ -23,7 +23,7 @@ use seaweed_volume::server::request_id::GrpcRequestIdLayer;
|
||||
use seaweed_volume::server::volume_server::{
|
||||
RuntimeMetricsConfig, VolumeServerState, build_metrics_router,
|
||||
};
|
||||
use seaweed_volume::server::write_queue::{self, WriteQueue};
|
||||
use seaweed_volume::server::write_queue::WriteQueue;
|
||||
use seaweed_volume::storage::store::Store;
|
||||
use seaweed_volume::storage::types::DiskType;
|
||||
|
||||
@@ -102,22 +102,6 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Mirrors Go's rejectHttpsDowngrade: a redirect must not downgrade a request
|
||||
/// carrying data and auth headers from https to plaintext.
|
||||
fn redirect_is_https_downgrade(previous: &[reqwest::Url], next: &reqwest::Url) -> bool {
|
||||
matches!(previous.first(), Some(url) if url.scheme() == "https") && next.scheme() != "https"
|
||||
}
|
||||
|
||||
fn reject_https_downgrade(attempt: reqwest::redirect::Attempt) -> reqwest::redirect::Action {
|
||||
if attempt.previous().len() >= 10 {
|
||||
attempt.error("redirect limit reached")
|
||||
} else if redirect_is_https_downgrade(attempt.previous(), attempt.url()) {
|
||||
attempt.error("redirect downgraded https to plaintext")
|
||||
} else {
|
||||
attempt.follow()
|
||||
}
|
||||
}
|
||||
|
||||
fn build_outgoing_http_client(
|
||||
config: &VolumeServerConfig,
|
||||
) -> Result<(reqwest::Client, String), Box<dyn std::error::Error>> {
|
||||
@@ -126,17 +110,11 @@ fn build_outgoing_http_client(
|
||||
} else {
|
||||
"http"
|
||||
};
|
||||
let redirect_policy = reqwest::redirect::Policy::custom(reject_https_downgrade);
|
||||
if !config.https_client_enabled {
|
||||
return Ok((
|
||||
reqwest::Client::builder()
|
||||
.redirect(redirect_policy)
|
||||
.build()?,
|
||||
scheme.to_string(),
|
||||
));
|
||||
return Ok((reqwest::Client::new(), scheme.to_string()));
|
||||
}
|
||||
|
||||
let mut builder = reqwest::Client::builder().redirect(redirect_policy);
|
||||
let mut builder = reqwest::Client::builder();
|
||||
if !config.https_client_ca_file.is_empty() {
|
||||
let ca_pem = std::fs::read(&config.https_client_ca_file).map_err(|e| {
|
||||
format!(
|
||||
@@ -458,17 +436,7 @@ async fn run(
|
||||
// The write queue is always on: durable (fsync) uploads go through it so
|
||||
// a batch shares one .dat/.idx sync, the way Go's per-volume async writer
|
||||
// group-commits. Non-fsync writes stay on the synchronous path.
|
||||
let min_bytes = usize::try_from(config.fsync_min_batch_bytes)
|
||||
.map_err(|_| "fsyncMinBatchBytes exceeds this platform's maximum usize value")?;
|
||||
let wq = WriteQueue::new(
|
||||
state.clone(),
|
||||
128,
|
||||
write_queue::SyncBatchOption {
|
||||
min_bytes,
|
||||
min_requests: config.fsync_min_batch_requests,
|
||||
wait: config.fsync_batch_wait,
|
||||
},
|
||||
);
|
||||
let wq = WriteQueue::new(state.clone(), 128);
|
||||
let _ = state.write_queue.set(wq);
|
||||
|
||||
// Set initial metric gauges for concurrent limits and max volumes
|
||||
@@ -1174,19 +1142,4 @@ mod tests {
|
||||
cipher_suites: String::new(),
|
||||
}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_redirect_is_https_downgrade() {
|
||||
use super::redirect_is_https_downgrade;
|
||||
let https = reqwest::Url::parse("https://peer:8443/1?type=replicate").unwrap();
|
||||
let http = reqwest::Url::parse("http://other:8080/1?type=replicate").unwrap();
|
||||
assert!(redirect_is_https_downgrade(&[https.clone()], &http));
|
||||
assert!(!redirect_is_https_downgrade(&[http.clone()], &https));
|
||||
assert!(!redirect_is_https_downgrade(&[http.clone()], &http));
|
||||
assert!(!redirect_is_https_downgrade(&[https.clone()], &https));
|
||||
assert!(!redirect_is_https_downgrade(&[], &http));
|
||||
// Only the origin scheme counts (Go's via[0]): a chain that started
|
||||
// plaintext loses nothing by returning to plaintext.
|
||||
assert!(!redirect_is_https_downgrade(&[http.clone(), https.clone()], &http));
|
||||
}
|
||||
}
|
||||
@@ -393,9 +393,6 @@ mod tests {
|
||||
fix_jpg_orientation: false,
|
||||
read_mode: ReadMode::Local,
|
||||
allow_untrusted_remote_endpoints: false,
|
||||
fsync_min_batch_bytes: 1024 * 1024,
|
||||
fsync_min_batch_requests: 128,
|
||||
fsync_batch_wait: std::time::Duration::from_micros(500),
|
||||
cpu_profile: String::new(),
|
||||
mem_profile: String::new(),
|
||||
compaction_byte_per_second: 0,
|
||||
|
||||
@@ -20,9 +20,7 @@ use crate::storage::erasure_coding::ec_shard::{ShardId, shard_id_try_from};
|
||||
use crate::storage::erasure_coding::ecj_merge::EcjIdDecoder;
|
||||
use crate::storage::needle::needle::{self, Needle};
|
||||
use crate::storage::types::*;
|
||||
use crate::storage::volume::{
|
||||
PREALLOCATE_SUPPORTED, VolumeSpec, allocated_file_size, preallocate_file,
|
||||
};
|
||||
use crate::storage::volume::VolumeSpec;
|
||||
|
||||
use super::grpc_client::{
|
||||
GrpcDialOptions, VolumeServerGrpcClient, connect_channel, connect_channel_guarded,
|
||||
@@ -2069,13 +2067,8 @@ impl VolumeServer for VolumeGrpcService {
|
||||
let source_status_before =
|
||||
fetch_source_status_before(&mut client, req.volume_id, vid).await;
|
||||
let source = SourceVolumeStatus::fetch(&mut client, req.volume_id).await?;
|
||||
let preallocate_size = self.copy_preallocate_size(&source).await;
|
||||
let dest =
|
||||
self.plan_copy_destination(&req, vid, &source, had_existing_volume, preallocate_size)?;
|
||||
if let Err(e) = dest.write_note(vid, &req.source_data_node) {
|
||||
dest.release_reservation(&self.state.store.read().unwrap());
|
||||
return Err(e);
|
||||
}
|
||||
let dest = self.plan_copy_destination(&req, vid, &source, had_existing_volume)?;
|
||||
dest.write_note(vid, &req.source_data_node)?;
|
||||
|
||||
let (tx, rx) =
|
||||
tokio::sync::mpsc::channel::<Result<volume_server_pb::VolumeCopyResponse, Status>>(16);
|
||||
@@ -2086,7 +2079,6 @@ impl VolumeServer for VolumeGrpcService {
|
||||
source,
|
||||
source_status_before,
|
||||
dest,
|
||||
preallocate_size,
|
||||
tx,
|
||||
};
|
||||
|
||||
@@ -2096,11 +2088,8 @@ impl VolumeServer for VolumeGrpcService {
|
||||
// races a departing caller is the one case where the existing
|
||||
// file-only cleanup leaves the volume loaded in memory.
|
||||
let mut mounted = false;
|
||||
match job.run(&mut client, &mut mounted).await {
|
||||
Ok(()) => job
|
||||
.dest
|
||||
.commit_reservation(&job.state.store.read().unwrap()),
|
||||
Err(e) => job.cleanup_failed_copy(e, mounted).await,
|
||||
if let Err(e) = job.run(&mut client, &mut mounted).await {
|
||||
job.cleanup_failed_copy(e, mounted).await;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5076,25 +5065,15 @@ impl VolumeServer for VolumeGrpcService {
|
||||
handles.push(tokio::spawn(async move {
|
||||
let form = reqwest::multipart::Form::new()
|
||||
.part("file", reqwest::multipart::Part::bytes(data_clone));
|
||||
let resp = client_clone
|
||||
client_clone
|
||||
.post(&url)
|
||||
.multipart(form)
|
||||
.send()
|
||||
.await
|
||||
.map(|_| ())
|
||||
.map_err(|e| {
|
||||
format!("remote write needle {} size {}: {}", needle_id, size, e)
|
||||
})?;
|
||||
if resp.status().is_success() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(format!(
|
||||
"remote write needle {} size {}: {} returned status {}",
|
||||
needle_id,
|
||||
size,
|
||||
url,
|
||||
resp.status()
|
||||
))
|
||||
}
|
||||
})
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -5646,11 +5625,6 @@ struct CopyDestination {
|
||||
disk_type: DiskType,
|
||||
/// A remote-backed volume only lands its .idx/.vif locally; the .dat stays in the tier.
|
||||
has_remote_dat: bool,
|
||||
/// The disk and headroom charge held by reserve_free_location; the copy
|
||||
/// settles it as its bytes land on disk, and a failed copy releases only
|
||||
/// what is still promised.
|
||||
loc_idx: usize,
|
||||
reserved_space: std::sync::atomic::AtomicU64,
|
||||
}
|
||||
|
||||
impl CopyDestination {
|
||||
@@ -5666,27 +5640,6 @@ impl CopyDestination {
|
||||
.map_err(|e| Status::internal(format!("write .note for volume {}: {}", vid, e)))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Bytes the copy put on disk stop needing the headroom charge, so a
|
||||
/// slow copy does not count its own .dat against the free space a
|
||||
/// second reservation needs.
|
||||
fn settle_reservation(&self, store: &crate::storage::store::Store, n: u64) {
|
||||
let n = n.min(self.reserved_space.load(Ordering::Relaxed));
|
||||
if n > 0 {
|
||||
store.commit_free_location(self.loc_idx, n);
|
||||
self.reserved_space.fetch_sub(n, Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
|
||||
fn release_reservation(&self, store: &crate::storage::store::Store) {
|
||||
store.release_free_location(self.loc_idx, self.reserved_space.swap(0, Ordering::Relaxed));
|
||||
}
|
||||
|
||||
/// The copied bytes are on disk now, so the pending charge ends without
|
||||
/// refunding the cache — the charge and the landed usage cancel out.
|
||||
fn commit_reservation(&self, store: &crate::storage::store::Store) {
|
||||
store.commit_free_location(self.loc_idx, self.reserved_space.swap(0, Ordering::Relaxed));
|
||||
}
|
||||
}
|
||||
|
||||
impl VolumeGrpcService {
|
||||
@@ -5721,36 +5674,6 @@ impl VolumeGrpcService {
|
||||
Ok(volume_server_client(channel))
|
||||
}
|
||||
|
||||
/// Query master for the .dat reservation a copy will make, as Go's
|
||||
/// VolumeCopy does before picking a destination. A remote-backed volume
|
||||
/// lands no .dat, so only a local copy needs the reservation.
|
||||
async fn copy_preallocate_size(&self, source: &SourceVolumeStatus) -> i64 {
|
||||
let has_remote_dat = source
|
||||
.volume_info
|
||||
.as_ref()
|
||||
.map(|vi| !vi.files.is_empty())
|
||||
.unwrap_or(false);
|
||||
if !has_remote_dat {
|
||||
let master = self.state.current_master().await;
|
||||
let grpc_addr = super::heartbeat::to_grpc_address(&master);
|
||||
match super::heartbeat::try_get_master_configuration(
|
||||
&grpc_addr,
|
||||
self.state.outgoing_grpc_tls.as_ref(),
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(resp) if resp.volume_preallocate => {
|
||||
return resp.volume_size_limit_m_b as i64 * 1024 * 1024;
|
||||
}
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
tracing::warn!("get master {} configuration: {}", master, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
0
|
||||
}
|
||||
|
||||
/// Picks the destination disk and, under the same write lock, drops a
|
||||
/// pre-existing local replica so its slot counts as free for the pick.
|
||||
fn plan_copy_destination(
|
||||
@@ -5759,7 +5682,6 @@ impl VolumeGrpcService {
|
||||
vid: VolumeId,
|
||||
vol_info: &SourceVolumeStatus,
|
||||
had_existing_volume: bool,
|
||||
preallocate_size: i64,
|
||||
) -> Result<CopyDestination, Status> {
|
||||
let requested_disk_type = if !req.disk_type.is_empty() {
|
||||
DiskType::from_string(&req.disk_type)
|
||||
@@ -5772,24 +5694,17 @@ impl VolumeGrpcService {
|
||||
.as_ref()
|
||||
.map(|vi| !vi.files.is_empty())
|
||||
.unwrap_or(false);
|
||||
let mut needed_space = if has_remote_dat {
|
||||
let needed_space = if has_remote_dat {
|
||||
vol_info.idx_file_size
|
||||
} else {
|
||||
vol_info.dat_file_size
|
||||
};
|
||||
if !has_remote_dat && PREALLOCATE_SUPPORTED && preallocate_size as u64 > needed_space {
|
||||
// the .dat reserves the master's volume size limit up front, so
|
||||
// the location must fit the reservation, not just the copied
|
||||
// bytes (Go's neededSpace)
|
||||
needed_space = preallocate_size as u64;
|
||||
}
|
||||
|
||||
// Find a free disk location using Go's Store.ReserveFreeLocation
|
||||
// Find a free disk location using Go's Store.FindFreeLocation
|
||||
// semantics; the slot of the replica being replaced counts as free.
|
||||
let ((data_base, idx_base, selected_disk_type), loc_idx) = {
|
||||
let (data_base, idx_base, selected_disk_type) = {
|
||||
let mut store = self.state.store.write().unwrap();
|
||||
let Some(loc_idx) = store.reserve_free_location(
|
||||
needed_space,
|
||||
let Some(loc_idx) = store.find_free_location_predicate(
|
||||
|loc| {
|
||||
loc.disk_type == requested_disk_type
|
||||
&& loc.available_space.load(Ordering::Relaxed) > needed_space
|
||||
@@ -5808,12 +5723,9 @@ impl VolumeGrpcService {
|
||||
loc.disk_type.clone(),
|
||||
);
|
||||
if had_existing_volume {
|
||||
if let Err(e) = delete_existing_replica(&mut store, vid, vol_info) {
|
||||
store.release_free_location(loc_idx, needed_space);
|
||||
return Err(e);
|
||||
}
|
||||
delete_existing_replica(&mut store, vid, vol_info)?;
|
||||
}
|
||||
(selected, loc_idx)
|
||||
selected
|
||||
};
|
||||
if had_existing_volume {
|
||||
self.state.volume_state_notify.notify_one();
|
||||
@@ -5829,8 +5741,6 @@ impl VolumeGrpcService {
|
||||
idx_base_name,
|
||||
disk_type: selected_disk_type,
|
||||
has_remote_dat,
|
||||
loc_idx,
|
||||
reserved_space: std::sync::atomic::AtomicU64::new(needed_space),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -5843,7 +5753,6 @@ struct VolumeCopyJob {
|
||||
source: SourceVolumeStatus,
|
||||
source_status_before: Option<volume_server_pb::VolumeStatusResponse>,
|
||||
dest: CopyDestination,
|
||||
preallocate_size: i64,
|
||||
tx: tokio::sync::mpsc::Sender<Result<volume_server_pb::VolumeCopyResponse, Status>>,
|
||||
}
|
||||
|
||||
@@ -5873,24 +5782,15 @@ impl VolumeCopyJob {
|
||||
};
|
||||
let mut throttler = WriteThrottler::new(io_byte_per_second);
|
||||
|
||||
let dat_on_disk = self.preallocate_dat().await?;
|
||||
self.preallocate_dat().await?;
|
||||
|
||||
let dest = &self.dest;
|
||||
let store = &self.state.store;
|
||||
let mut settle = |landed: i64| {
|
||||
if landed > 0 {
|
||||
dest.settle_reservation(&store.read().unwrap(), landed as u64);
|
||||
}
|
||||
};
|
||||
let mut progress = CopyProgress {
|
||||
tx,
|
||||
next_report_target: &mut next_report_target,
|
||||
report_interval,
|
||||
throttler: &mut throttler,
|
||||
settle: &mut settle,
|
||||
};
|
||||
self.transfer_files(client, &mut progress, dat_on_disk)
|
||||
.await?;
|
||||
self.transfer_files(client, &mut progress).await?;
|
||||
|
||||
let source_status_after =
|
||||
fetch_source_status_after(client, self.req.volume_id, vid, tx).await?;
|
||||
@@ -5899,39 +5799,64 @@ impl VolumeCopyJob {
|
||||
.await
|
||||
}
|
||||
|
||||
/// Reserve the .dat's full size up front, matching Go's VolumeCopy
|
||||
/// CreateVolumeFile. Returns the bytes the filesystem actually holds —
|
||||
/// settled at once, since statfs already counts them — which a failed
|
||||
/// fallocate reports as 0 so the write progress settles them instead.
|
||||
async fn preallocate_dat(&self) -> Result<u64, Status> {
|
||||
/// Query master for preallocation settings (matching Go VolumeCopy behavior).
|
||||
async fn preallocate_dat(&self) -> Result<(), Status> {
|
||||
let (state, vid, tx) = (&self.state, self.vid, &self.tx);
|
||||
let (data_base_name, has_remote_dat) =
|
||||
(&self.dest.data_base_name, self.dest.has_remote_dat);
|
||||
let preallocate_size = self.preallocate_size;
|
||||
if preallocate_size <= 0 || has_remote_dat {
|
||||
return Ok(0);
|
||||
let mut preallocate_size: i64 = 0;
|
||||
if !has_remote_dat {
|
||||
let master = state.current_master().await;
|
||||
let grpc_addr = super::heartbeat::to_grpc_address(&master);
|
||||
// Race the master-configuration RPC against the caller's
|
||||
// response channel: a stalled master (or a slow leader
|
||||
// election) would otherwise hold the task and its .note
|
||||
// past a departing caller, since the per-chunk checks in
|
||||
// copy_file_from_source are never reached.
|
||||
let config = tokio::select! {
|
||||
res = super::heartbeat::try_get_master_configuration(
|
||||
&grpc_addr,
|
||||
state.outgoing_grpc_tls.as_ref(),
|
||||
) => res,
|
||||
_ = tx.closed() => {
|
||||
return Err(Status::cancelled(format!(
|
||||
"volume {} copy cancelled by caller",
|
||||
vid
|
||||
)));
|
||||
}
|
||||
};
|
||||
match config {
|
||||
Ok(resp) => {
|
||||
if resp.volume_preallocate {
|
||||
preallocate_size = resp.volume_size_limit_m_b as i64 * 1024 * 1024;
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::warn!("get master {} configuration: {}", master, e);
|
||||
}
|
||||
}
|
||||
|
||||
if preallocate_size > 0 {
|
||||
let dat_path = format!("{}.dat", data_base_name);
|
||||
let file = std::fs::File::create(&dat_path).map_err(|e| {
|
||||
Status::internal(format!(
|
||||
"create preallocated volume file {}: {}",
|
||||
dat_path, e
|
||||
))
|
||||
})?;
|
||||
file.set_len(preallocate_size as u64).map_err(|e| {
|
||||
Status::internal(format!("preallocate volume file {}: {}", dat_path, e))
|
||||
})?;
|
||||
}
|
||||
}
|
||||
let dat_path = format!("{}.dat", data_base_name);
|
||||
let file = std::fs::File::create(&dat_path).map_err(|e| {
|
||||
Status::internal(format!(
|
||||
"create preallocated volume file {}: {}",
|
||||
dat_path, e
|
||||
))
|
||||
})?;
|
||||
preallocate_file(&file, preallocate_size as u64);
|
||||
let allocated = allocated_file_size(&file);
|
||||
self.dest
|
||||
.settle_reservation(&self.state.store.read().unwrap(), allocated);
|
||||
Ok(allocated)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Pull the .dat (unless it stays in the remote tier), .idx and .vif.
|
||||
/// dat_on_disk is how much of the .dat statfs already counts, so only
|
||||
/// writes past it settle the charge.
|
||||
async fn transfer_files(
|
||||
&self,
|
||||
client: &mut VolumeServerGrpcClient,
|
||||
progress: &mut CopyProgress<'_>,
|
||||
dat_on_disk: u64,
|
||||
) -> Result<(), Status> {
|
||||
let (req, vol_info) = (&self.req, &self.source);
|
||||
let (data_base_name, idx_base_name, has_remote_dat) = (
|
||||
@@ -5939,9 +5864,7 @@ impl VolumeCopyJob {
|
||||
&self.dest.idx_base_name,
|
||||
self.dest.has_remote_dat,
|
||||
);
|
||||
// Copy .dat file. Writing in place into the just-preallocated file
|
||||
// keeps its fallocated blocks — truncating would free them at open
|
||||
// and re-spend the headroom as the bytes stream back in.
|
||||
// Copy .dat file
|
||||
if !has_remote_dat {
|
||||
let dat_path = format!("{}.dat", data_base_name);
|
||||
let dat_modified_ts_ns = copy_file_from_source(
|
||||
@@ -5954,10 +5877,9 @@ impl VolumeCopyJob {
|
||||
stop_offset: vol_info.dat_file_size,
|
||||
dest_path: &dat_path,
|
||||
ext: ".dat",
|
||||
is_append: self.preallocate_size > 0,
|
||||
is_append: false,
|
||||
ignore_source_not_found: true,
|
||||
report_progress: true,
|
||||
settle_skip: dat_on_disk as i64,
|
||||
},
|
||||
progress,
|
||||
)
|
||||
@@ -5982,7 +5904,6 @@ impl VolumeCopyJob {
|
||||
is_append: false,
|
||||
ignore_source_not_found: false,
|
||||
report_progress: false,
|
||||
settle_skip: 0,
|
||||
},
|
||||
progress,
|
||||
)
|
||||
@@ -6006,7 +5927,6 @@ impl VolumeCopyJob {
|
||||
is_append: false,
|
||||
ignore_source_not_found: true,
|
||||
report_progress: false,
|
||||
settle_skip: 0,
|
||||
},
|
||||
progress,
|
||||
)
|
||||
@@ -6176,8 +6096,6 @@ impl VolumeCopyJob {
|
||||
let _ = std::fs::remove_file(format!("{}.idx", idx_base_name));
|
||||
let _ = std::fs::remove_file(format!("{}.vif", data_base_name));
|
||||
let _ = std::fs::remove_file(¬e_path);
|
||||
self.dest
|
||||
.release_reservation(&state.store.read().unwrap());
|
||||
let _ = tx.send(Err(e)).await;
|
||||
}
|
||||
}
|
||||
@@ -6376,9 +6294,6 @@ struct CopyFileSpec<'a> {
|
||||
ignore_source_not_found: bool,
|
||||
/// Whether this file's bytes are reported back to the caller as progress.
|
||||
report_progress: bool,
|
||||
/// Bytes of this file statfs already counts (a fallocated .dat); only
|
||||
/// writes past it settle the copy's headroom charge.
|
||||
settle_skip: i64,
|
||||
}
|
||||
|
||||
/// Progress reporting and throttling shared by every file of one volume copy.
|
||||
@@ -6387,8 +6302,6 @@ struct CopyProgress<'a> {
|
||||
next_report_target: &'a mut i64,
|
||||
report_interval: i64,
|
||||
throttler: &'a mut WriteThrottler,
|
||||
/// Settles the headroom charge for bytes newly visible to statfs.
|
||||
settle: &'a mut (dyn FnMut(i64) + Send),
|
||||
}
|
||||
|
||||
/// Mirrors Go's checkVolumeFileExtension: the client-supplied Ext that
|
||||
@@ -6440,7 +6353,6 @@ where
|
||||
is_append,
|
||||
ignore_source_not_found,
|
||||
report_progress,
|
||||
settle_skip,
|
||||
} = *spec;
|
||||
let progress_tx = progress.tx;
|
||||
let copy_req = volume_server_pb::CopyFileRequest {
|
||||
@@ -6499,7 +6411,6 @@ where
|
||||
|
||||
let mut progressed_bytes: i64 = 0;
|
||||
let mut modified_ts_ns: i64 = 0;
|
||||
let mut settled_bytes: i64 = 0;
|
||||
|
||||
// The source stream's message() future is the one await in this loop that
|
||||
// can hang indefinitely: a stalled source (slow disk, network partition,
|
||||
@@ -6534,11 +6445,6 @@ where
|
||||
file.write_all(&resp.file_content)
|
||||
.map_err(|e| Status::internal(format!("write file {}: {}", dest_path, e)))?;
|
||||
progressed_bytes += resp.file_content.len() as i64;
|
||||
// Writes past settle_skip are new usage statfs can see; the
|
||||
// copy's headroom charge settles as they land.
|
||||
let landed = (progressed_bytes - settle_skip).max(0);
|
||||
(progress.settle)(landed - settled_bytes);
|
||||
settled_bytes = landed;
|
||||
// A throttled copy sleeps seconds at a time; wake for a departing
|
||||
// caller instead of finishing the nap first.
|
||||
tokio::select! {
|
||||
@@ -9025,14 +8931,12 @@ mod tests {
|
||||
is_append: false,
|
||||
ignore_source_not_found: true,
|
||||
report_progress: true,
|
||||
settle_skip: 0,
|
||||
},
|
||||
&mut CopyProgress {
|
||||
tx: &tx,
|
||||
next_report_target: &mut next_report_target,
|
||||
report_interval: 128 * 1024 * 1024,
|
||||
throttler: &mut throttler,
|
||||
settle: &mut |_| {},
|
||||
},
|
||||
)
|
||||
.await
|
||||
|
||||
Loaded 100 of 574 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user