summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMatthew Oliver <matt@oliver.net.au>2018-05-02 10:47:51 +0100
committerAlistair Coles <alistairncoles@gmail.com>2018-05-18 18:48:13 +0100
commit26418140108281ae5ac11004ebf33b7b3e08c74d (patch)
tree6b709264365b48f622667aec5176ac2818267118 /bin
parent4a3efe61a978b9d7adeabd556ce4a3820e6af555 (diff)
downloadswift-26418140108281ae5ac11004ebf33b7b3e08c74d.tar.gz
Add sharder daemon, manage_shard_ranges tool and probe tests
The sharder daemon visits container dbs and when necessary executes the sharding workflow on the db. The workflow is, in overview: - perform an audit of the container for sharding purposes. - move any misplaced objects that do not belong in the container to their correct shard. - move shard ranges from FOUND state to CREATED state by creating shard containers. - move shard ranges from CREATED to CLEAVED state by cleaving objects to shard dbs and replicating those dbs. By default this is done in batches of 2 shard ranges per visit. Additionally, when the auto_shard option is True (NOT yet recommeneded in production), the sharder will identify shard ranges for containers that have exceeded the threshold for sharding, and will also manage the sharding and shrinking of shard containers. The manage_shard_ranges tool provides a means to manually identify shard ranges and merge them to a container in order to trigger sharding. This is currently the recommended way to shard a container. Co-Authored-By: Alistair Coles <alistairncoles@gmail.com> Co-Authored-By: Tim Burke <tim.burke@gmail.com> Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com> Change-Id: I7f192209d4d5580f5a0aa6838f9f04e436cf6b1f
Diffstat (limited to 'bin')
-rwxr-xr-xbin/swift-container-sharder33
1 files changed, 33 insertions, 0 deletions
diff --git a/bin/swift-container-sharder b/bin/swift-container-sharder
new file mode 100755
index 000000000..3e6551319
--- /dev/null
+++ b/bin/swift-container-sharder
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+# Copyright (c) 2010-2015 OpenStack Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from swift.container.sharder import ContainerSharder
+from swift.common.utils import parse_options
+from swift.common.daemon import run_daemon
+from optparse import OptionParser
+
+if __name__ == '__main__':
+ parser = OptionParser("%prog CONFIG [options]")
+ parser.add_option('-d', '--devices',
+ help='Shard containers only on given devices. '
+ 'Comma-separated list. '
+ 'Only has effect if --once is used.')
+ parser.add_option('-p', '--partitions',
+ help='Shard containers only in given partitions. '
+ 'Comma-separated list. '
+ 'Only has effect if --once is used.')
+ conf_file, options = parse_options(parser=parser, once=True)
+ run_daemon(ContainerSharder, conf_file, **options)