Skip to content

Commit 044835b

Browse files
committed
Don't compact by default, simplify compaction code.
1 parent ac118ca commit 044835b

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

couchdb/tools/replicate.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@
2222
import sys
2323
import time
2424

25-
def compact(server, dbnames):
26-
for dbname in dbnames:
27-
sys.stdout.flush()
28-
db = server[dbname]
29-
db.resource.post('_compact')
30-
3125
def main():
3226

3327
usage = '%prog [options]'
@@ -36,14 +30,14 @@ def main():
3630
action='append',
3731
dest='dbnames',
3832
help='Database to replicate. Can be given more than once. [all databases]')
39-
parser.add_option('--no-target-compaction',
40-
action='store_false',
41-
dest='compact_target',
42-
help='do not start compaction of target after replications')
4333
parser.add_option('--continuous',
4434
action='store_true',
4535
dest='continuous',
4636
help='trigger continuous replication in cochdb')
37+
parser.add_option('--compact',
38+
action='store_true',
39+
dest='compact',
40+
help='compact target database after replication')
4741

4842
options, args = parser.parse_args()
4943
if len(args) != 2:
@@ -81,9 +75,13 @@ def main():
8175
body.update({'source': '%s%s' % (src, dbname), 'target': dbname})
8276
target_server.resource.post('_replicate', body)
8377
print '%.1fs' % (time.time() - start)
84-
85-
if options.compact_target:
86-
compact(target_server, dbnames)
78+
79+
if not options.compact:
80+
return
81+
82+
sys.stdout.flush()
83+
for dbname in dbnames:
84+
target_server[dbname].compact()
8785

8886
if __name__ == '__main__':
8987
main()

0 commit comments

Comments
 (0)