mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
- The provider refuses the removed names and, under every selector and before any selector comparison, a volume carrying their magic (SWAW; SWPW in either header slot), reading the file read-only and never modifying it. blockvolume --durable-impl and the launcher refuse the names with the same advice; the chart schema allows walstore only. - core/storage/smartwal, core/storage/parallelwal and cmd/sw-block-testutil (whose one command corrupted smartwal records) are deleted, with the helm smartwal-corruption scenario and the parallel-walstore gate script. - The replication harness runs on walstore; tests that ran on a removed engine only because a stub needed some store move to walstore, and the state_convergence label test moves to the in-memory BlockStore. - sw-block cluster.check drops the removed engines' cases. - Ledger: INV-OPEN-REMOVED-ENGINE-REFUSED-001 and INV-OPEN-REMOVED-ENGINE-NAME-REFUSED-001, an OpenRefused edge in M1, and the rows citing the removed tests updated. Docs: block-design 1.3 now describes the removal, the smartwal deep-dive and figure are gone, the scripts default to walstore, and the v1.1 notes carry the removal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
66 lines
3.1 KiB
Python
66 lines
3.1 KiB
Python
import copy
|
|
import json
|
|
import pathlib
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
import unittest
|
|
|
|
HELPER = pathlib.Path(__file__).with_name('phase163-backend-write-proof.py')
|
|
|
|
|
|
class BackendProofTest(unittest.TestCase):
|
|
def setUp(self):
|
|
self.before = {'process': {'pid': 123, 'start': 456, 'binary': '/tmp/run/bin/blockvolume'},
|
|
'address': '127.0.0.1:16334', 'status': {'Volumes': [{
|
|
'VolumeID': 'v1', 'ReplicaID': 'r1', 'Epoch': 4, 'EndpointVersion': 2,
|
|
'Latched': True, 'Operational': True, 'Closed': False,
|
|
'Path': '/tmp/run/store/v1', 'Impl': 'walstore',
|
|
'WriteProfile': {'BackendWriteOps': 7, 'BackendWriteBytes': 28672,
|
|
'BackendStorageWriteCalls': 7}}]}}
|
|
self.after = copy.deepcopy(self.before)
|
|
self.profile = self.after['status']['Volumes'][0]['WriteProfile']
|
|
self.profile.update(BackendWriteOps=8, BackendWriteBytes=32768, BackendStorageWriteCalls=8)
|
|
|
|
def judge(self, want_success):
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
paths = [pathlib.Path(tmp) / name for name in ('before.json', 'after.json')]
|
|
for path, sample in zip(paths, (self.before, self.after)):
|
|
path.write_text(json.dumps(sample))
|
|
result = subprocess.run([sys.executable, str(HELPER), 'check', *map(str, paths)],
|
|
capture_output=True, timeout=5)
|
|
self.assertEqual(result.returncode == 0, want_success, result.stderr)
|
|
return result
|
|
|
|
def test_successful_backend_write(self):
|
|
self.assertEqual(json.loads(self.judge(True).stdout)['BackendWriteBytes'], 4096)
|
|
|
|
def test_unchanged_missing_reset_or_short_counters_refuse(self):
|
|
original = copy.deepcopy(self.profile)
|
|
for field in original:
|
|
for value in ('missing', self.before['status']['Volumes'][0]['WriteProfile'][field], -1, True):
|
|
with self.subTest(field=field, value=value):
|
|
self.profile.clear(); self.profile.update(original)
|
|
if value == 'missing': self.profile.pop(field)
|
|
else: self.profile[field] = value
|
|
self.judge(False)
|
|
self.profile.clear(); self.profile.update(original)
|
|
self.profile['BackendWriteBytes'] -= 1
|
|
self.judge(False)
|
|
|
|
def test_changed_process_or_backend_refuses(self):
|
|
pristine = copy.deepcopy(self.after)
|
|
for key, value in (('pid', 124), ('start', 457), ('binary', '/other/blockvolume')):
|
|
self.after = copy.deepcopy(pristine); self.after['process'][key] = value
|
|
self.judge(False)
|
|
for key, value in (('VolumeID', 'v2'), ('ReplicaID', 'r2'), ('Epoch', 5),
|
|
('EndpointVersion', 3), ('Path', '/other/store'), ('Closed', True)):
|
|
self.after = copy.deepcopy(pristine); self.after['status']['Volumes'][0][key] = value
|
|
self.judge(False)
|
|
self.after = copy.deepcopy(pristine); self.after['status']['Volumes'] = []
|
|
self.judge(False)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|