Skip to content

Instantly share code, notes, and snippets.

@clayg
clayg / container_head.out
Created March 2, 2020 16:37
vary content-type
vagrant@saio:~$ curl -H 'x-auth-token: AUTH_tk5c4a1e905d2a40ab98e9c955fc97e2c6' "http://saio:8080/v1/AUTH_test/test" -I
HTTP/1.1 204 No Content
X-Container-Object-Count: 10
Accept-Ranges: bytes
X-Storage-Policy: default
Last-Modified: Mon, 02 Mar 2020 16:34:12 GMT
X-Container-Bytes-Used: 80
X-Timestamp: 1583166844.22391
Content-Type: text/plain; charset=utf-8
Vary: Accept
@clayg
clayg / log.patch
Last active February 21, 2020 19:19
log exceptions cause duh
diff --git a/swift/common/utils.py b/swift/common/utils.py
index 392312800..5deab454f 100644
--- a/swift/common/utils.py
+++ b/swift/common/utils.py
@@ -47,6 +47,7 @@ import ctypes
import ctypes.util
from copy import deepcopy
from optparse import OptionParser
+import traceback
vagrant@saio:~$ curl -v -H 'x-auth-token: AUTH_tkc955ef07f0ee4fa1b985b287e7c1d977' http://saio:8080/AUTH_test/foo/bar
* Trying 127.0.1.1...
* TCP_NODELAY set
* Connected to saio (127.0.1.1) port 8080 (#0)
> GET /AUTH_test/foo/bar HTTP/1.1
> Host: saio:8080
> User-Agent: curl/7.58.0
> Accept: */*
> x-auth-token: AUTH_tkc955ef07f0ee4fa1b985b287e7c1d977
>
@clayg
clayg / add_weight.py
Created January 14, 2020 16:35
playing with composite rings
#!/usr/bin/env python
import sys
from swift.common.ring import RingBuilder
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('--full', action='store_true', help='put weight up to full')
def main():
vagrant@saio:~$ curl -w "%{time_total}|%{speed_upload}" -X POST "http://127.0.0.1:8090" -T file_200.txt
(8950) accepted ('127.0.0.1', 46762)
/srv/node1/sdb1/objects/59
os write time is - 1.09243893623
fsync time is - 0.254086017609
127.0.0.1 - - [08/Jan/2020 15:02:40] "POST /file_200.txt HTTP/1.1" 200 218 1.348623
The Begining
******************************
3566de3a97906edb98d004d6b947ae9b
******************************
@clayg
clayg / swift-reconciler-status
Created December 23, 2019 21:05
Check .misplaced_objects account
#!/usr/bin/env python
from argparse import ArgumentParser
from collections import defaultdict
import sys
from swift.common.internal_client import InternalClient
from swift.common.wsgi import ConfigString
from swift.container.sync import ic_conf_body
@clayg
clayg / fix-hardlinks.patch
Created November 18, 2019 22:40
make hardlinks versionable
@clayg
clayg / example.out
Created November 14, 2019 02:18
bummer failure mode
vagrant@saio:~$ swift post test -H 'x-versions-enabled: true'
vagrant@saio:~$ for i in {1..10}; do swift upload test test; done
test
test
test
test
test
test
test
test
@clayg
clayg / stuck.out
Created October 28, 2019 22:41
s3api tests get stuck, unable to clean out bucket
vagrant@saio:~$ swift list
s3api-test-versioning-09c55a7246a948679dc054bb58b5d6c8
vagrant@saio:~$ swift list s3api-test-versioning-09c55a7246a948679dc054bb58b5d6c8 --json
[
{
"bytes": 55,
"content_type": "binary/octet-stream",
"hash": "36219fbb5e2de8b89565dcd15fb1afed",
"last_modified": "2019-10-28T22:38:10.704330",
"name": "s3api-test-versioned-obj-69225ae9863d49e79d0147e6d79ff24a",
@clayg
clayg / curl.out
Created October 15, 2019 20:22
container servers HEAD requests are pretty easy going with the PATH
vagrant@saio:~$ curl http://localhost:6041/sdb4/28/AUTH_test/test/foo/blah/whatever/hahah -I
HTTP/1.1 204 No Content
X-Backend-Sharding-State: unsharded
X-Backend-Timestamp: 1571170834.78939
X-Container-Object-Count: 0
X-Put-Timestamp: 1571170834.76786
X-Backend-Put-Timestamp: 1571170834.76786
Last-Modified: Tue, 15 Oct 2019 20:20:35 GMT
X-Backend-Delete-Timestamp: 0000000000.00000
X-Container-Bytes-Used: 0