Created
September 4, 2014 06:17
-
-
Save yoku0825/305f18ff3ec52eee5a50 to your computer and use it in GitHub Desktop.
rroonga-4.0.4/bin/grndumpに--lock-all-tablesオプション追加
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** /usr/local/lib/ruby/gems/2.1.0/gems/rroonga-4.0.4/bin/grndump.orig 2014-09-02 17:43:14.239617704 +0900 | |
--- /usr/local/lib/ruby/gems/2.1.0/gems/rroonga-4.0.4/bin/grndump.lock 2014-09-04 15:06:39.795523494 +0900 | |
*************** | |
*** 28,33 **** | |
--- 28,34 ---- | |
options.dump_schema = true | |
options.dump_indexes = true | |
options.dump_tables = true | |
+ options.lock_tables = false | |
options.order_by = "id" | |
option_parser = OptionParser.new do |parser| | |
parser.version = Groonga::BINDINGS_VERSION | |
*************** | |
*** 48,53 **** | |
--- 49,59 ---- | |
options.dump_tables = boolean | |
end | |
+ parser.on("--lock-all-tables", | |
+ "lock all tables between dumping.") do |boolean| | |
+ options.lock_tables = boolean | |
+ end | |
+ | |
parser.on("-t=TABLE", "--table=TABLE", | |
"dump only TABLE.", | |
"use this option multiple to dump multiple tables.", | |
*************** | |
*** 79,84 **** | |
--- 85,91 ---- | |
"(#{options.order_by})") do |type| | |
options.order_by = type | |
end | |
+ | |
end | |
args = option_parser.parse!(ARGV) | |
*************** | |
*** 96,104 **** | |
--- 103,124 ---- | |
:dump_schema => options.dump_schema, | |
:dump_indexes => options.dump_indexes, | |
:dump_tables => options.dump_tables, | |
+ :lock_tables => options.lock_tables, | |
:tables => options.tables, | |
:exclude_tables => options.exclude_tables, | |
:order_by => options.order_by, | |
} | |
+ | |
+ if options.lock_tables | |
+ database.each do |table| | |
+ next unless table.is_a?(Groonga::Table) | |
+ Groonga[table.name].lock | |
+ end | |
+ end | |
+ | |
database_dumper = Groonga::DatabaseDumper.new(dumper_options) | |
database_dumper.dump | |
+ | |
+ if options.lock_tables | |
+ database.clearlock | |
+ end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment