From adac7f68f3c377884891972f59cd07ddcc31e2ae Mon Sep 17 00:00:00 2001 From: ooeyoshinori Date: Fri, 3 Apr 2015 09:06:02 +0000 Subject: [PATCH 01/26] modify_stat_page --- app/assets/javascripts/cluster.js | 2 +- app/helpers/stat_helper.rb | 57 ++++++++++++++++++++++++++++--- app/models/roma.rb | 2 ++ app/views/cluster/_modal.html.erb | 2 +- app/views/cluster/index.html.erb | 2 +- config/initializers/constants.rb | 2 ++ 6 files changed, 60 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/cluster.js b/app/assets/javascripts/cluster.js index e3a3f05..1ebd128 100644 --- a/app/assets/javascripts/cluster.js +++ b/app/assets/javascripts/cluster.js @@ -227,7 +227,7 @@ $(window).load(function() { var currentPort = $('#currentPort').val(); var configPath = $('#configPath').val(); if ($("#repetitionCheck").prop('checked')) { - var repetitionOption = "--enabled_repeathost" + var repetitionOption = "--replication_in_host" } else { var repetitionOption = "" diff --git a/app/helpers/stat_helper.rb b/app/helpers/stat_helper.rb index b539467..ec5befc 100644 --- a/app/helpers/stat_helper.rb +++ b/app/helpers/stat_helper.rb @@ -142,13 +142,17 @@ def explanation(column) return <<-EOS Balance process is going or not. EOS - when "last_clean_up" + when "gui_run_snapshot" return <<-EOS - Date of last executing of clean up storage. + Snapshot process is going or not. EOS when "last_clean_up" return <<-EOS - Date of last executing of clean up storage. + Date of last executing of clean up storage. + EOS + when "gui_last_snapshot" + return <<-EOS + Date of last executing of snapshot. EOS when "spushv_protection" return <<-EOS @@ -158,7 +162,11 @@ def explanation(column) EOS when "stream_copy_wait_param" return <<-EOS - Specify waiting time (in seconds) to copy the data slowly between nodes. + Specify waiting time (in seconds) to copy the data slowly between nodes. + EOS + when "stream_show_wait_param" + return <<-EOS + Specify waiting time (in seconds) to show gathered log data each of 10 lines. EOS when "dcnice" return <<-EOS @@ -281,12 +289,29 @@ def explanation(column) Specify the transaction time of routing change.
When over the this setting time, routing will be rollback. EOS + when "log_shift_size" + return <<-EOS + Specify size (in bytes) of the log files.
+ When the log file reaches this size, it will rotate to the next file. + EOS + when "log_shift_age" + return <<-EOS + Specify number of log files which are rotated. + EOS when "storage.storage_path" return <<-EOS Specify directory that ROMA should create storage files in.

This is required when ROMA select file-based storage implementation.
Default directory is current directory. EOS + when "storage.st_class" + return <<-EOS + Specify the storage type.

+ RubyHashStorage : RubyHash(OS memory)
+ TCStorage : TokyoCabinet
+ GroongaStorage : groonga
+ SQLite3Storage : SQLite + EOS when "storage.divnum" return <<-EOS Specify the number which divides the storage of ROMA process. @@ -327,12 +352,20 @@ def explanation(column) Specify the time of sleeping in each keys when clean up executing.

So at least, clean_up process take time over ([storage.each_clean_up_sleep] * Key count)sec EOS + when "storage.cleanup_regexp" + return <<-EOS + By this regular expression, specify a rule how key list makes. + EOS when "storage.logic_clock_expire" return <<-EOS ROMA's data have date data & logic clock.

But sometimes some difference happen between date data & logic clock.

This setting specify the time lag to estimate which node's data is correct. EOS + when "storage.safecopy_stats" + return <<-EOS + TC file's status of snapshot process. + EOS when "path" return <<-EOS Path of write-behind's file @@ -440,6 +473,14 @@ def explanation(column) return <<-EOS Specify the waiting time to execute auto-recover after short vnode rising. EOS + when "event" + return <<-EOS + The list of event(node down and join). + EOS + when "event_limit_line" + return <<-EOS + Specify the counts how many event are stored. + EOS when "auto_recover_status" return <<-EOS waiting : Nothing to do (Default)
@@ -562,6 +603,10 @@ def default_value(column) Constants::DEFAULT_SPUSHV_VLENGTH_WARN when "routing_trans_timeout" Constants::DEFAULT_ROUTING_TRNAS_TIMEOUT + when "log_shift_size" + Constants::DEFAULT_LOG_SHIFT_SIZE + when "log_shift_age" + Constants::DEFAULT_LOG_SHIFT_AGE when "shift_size" Constants::DEFAULT_SHIFT_SIZE #when "do_write" @@ -648,6 +693,10 @@ def change_cmd(key) "set_spushv_vlength_warn" when "routing_trans_timeout" "set_routing_trans_timeout" + when "log_shift_size" + "set_log_shift_size" + when "log_shift_age" + "set_log_shift_age" when "shift_size" "set_wb_shift_size" #when "do_write" diff --git a/app/models/roma.rb b/app/models/roma.rb index eb12fe7..17bfa02 100644 --- a/app/models/roma.rb +++ b/app/models/roma.rb @@ -10,6 +10,8 @@ class Roma :spushv_klength_warn, :spushv_vlength_warn, :routing_trans_timeout, + :log_shift_size, + :log_shift_age, :shift_size, :fail_cnt_threshold, :fail_cnt_gap, diff --git a/app/views/cluster/_modal.html.erb b/app/views/cluster/_modal.html.erb index 061b402..208d7ab 100644 --- a/app/views/cluster/_modal.html.erb +++ b/app/views/cluster/_modal.html.erb @@ -122,7 +122,7 @@
- <% if past_version?(@stats_hash) %> -
-
- You can Not use this function
in this ROMA version. -
-
- <% end %> -
Routing history
<% if @routing_event.size == 0 %> diff --git a/app/views/stat/edit.html.erb b/app/views/stat/edit.html.erb index 2d48241..bd82506 100644 --- a/app/views/stat/edit.html.erb +++ b/app/views/stat/edit.html.erb @@ -23,14 +23,6 @@
- <% if past_version?(@stats_hash) %> -
-
- You can Not use this function
in this ROMA version. -
-
- <% end %> - CHANGE VALUE: <%= form_tag({ :controller => 'stat', :action => 'update' }, { :method => :put, :id => 'dynamic_change_value', :class => 'edit-form' }) do %> <% if @key == "continuous_limit" %> @@ -57,7 +49,7 @@ <%= hidden_field_tag :key, @key %>
- <%= submit_tag " store ", { :class => "btn btn-info", :disabled=>past_version?(@stats_hash) }%> + <%= submit_tag " store ", { :class => "btn btn-info" }%>
<% end %> diff --git a/app/views/storage/index.html.erb b/app/views/storage/index.html.erb index 61c0af4..90e9b87 100644 --- a/app/views/storage/index.html.erb +++ b/app/views/storage/index.html.erb @@ -40,20 +40,12 @@ <% if storage_type_is_tc?(@stats_hash) %>
- <% unless can_i_use_snapshot?(@stats_hash) %> -
-
- You can Not use this function
in this ROMA version. -
-
- <% end %> -
Snapshot
Command Generater
<%= text_field_tag :port, nil, {:placeholder=>"Target Port No.", :class=>"snapPort"} %> - <%= submit_tag " Generate ", { :class => "btn btn-info snapshot-btn allow_submit", :disabled=>(chk_roma_version(@stats_hash['others']['version']) < Constants::VERSION_0_8_14) }%> + <%= submit_tag " Generate ", { :class => "btn btn-info snapshot-btn allow_submit" }%>
@@ -61,15 +53,6 @@
- <% if chk_roma_version(@stats_hash['others']['version']) == Constants::VERSION_0_8_14 %> -
-
-
- You can Not use this function in this ROMA version. -
-
- <% end %> -
Status
<% if flash[:snapshoting] %>
@@ -105,9 +88,6 @@
<%= @last_snapshot_data %>
- <% if chk_roma_version(@stats_hash['others']['version']) == Constants::VERSION_0_8_14 %> -
- <% end %>
<% end %> diff --git a/config/initializers/constants.rb b/config/initializers/constants.rb index 03fc8ee..32f0476 100644 --- a/config/initializers/constants.rb +++ b/config/initializers/constants.rb @@ -6,10 +6,6 @@ module Constants VERSION = "1.2.0" # ROMA bit shifted version - VERSION_0_8_11 = 2059 - VERSION_0_8_12 = 2060 - VERSION_0_8_13 = 2061 - VERSION_0_8_14 = 2062 VERSION_1_0_0 = 65536 VERSION_1_1_0 = 65792 VERSION_1_2_0 = 66048 @@ -64,5 +60,4 @@ module Constants LIST_WB_COMMAND_MAP = {} LIST_ENABLED_FAILOVER = ["on", "off"] - end From 6982195469c7bd7a490216739f3203f340e0221e Mon Sep 17 00:00:00 2001 From: hiroaki-iwase Date: Wed, 30 Sep 2015 19:16:41 +0900 Subject: [PATCH 23/26] adjust v1.0.0 in case of using groonga --- app/assets/javascripts/cluster.js | 2 +- app/helpers/application_helper.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/cluster.js b/app/assets/javascripts/cluster.js index 09c49b6..8db9f1c 100644 --- a/app/assets/javascripts/cluster.js +++ b/app/assets/javascripts/cluster.js @@ -239,7 +239,7 @@ $(window).load(function() { $('.join-explanation').text("Please execute below command on your ROMA server."); $('.join-command').css({"padding":"10px"}); $('.join-command').html( - "$ cd ${ROMA directory}/ruby/server
" + + "$ cd ${ROMA directory}
" + "$ bin/romad "+newHost+" -p "+newPort+" -d -j "+currentHost+"_"+currentPort+" --config "+configPath+" "+repetitionOption ); } diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e9a4771..ac1332f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -26,6 +26,12 @@ def groonga_mode?(stats_hash) end def storage_type_is_tc?(stats_hash) + # for v1.0.0 + if chk_roma_version(stats_hash['others']['version']) == Constants::VERSION_1_0_0 && @stats_hash['storages[roma]']['storage[0].fsiz'] + return true + end + + # for v1.1.0- if stats_hash['storages[roma]']['storage.st_class'] == 'TCStorage' return true else From 95eab169668920b77183818100975410775de6c5 Mon Sep 17 00:00:00 2001 From: hiroaki-iwase Date: Wed, 30 Sep 2015 19:46:55 +0900 Subject: [PATCH 24/26] change some storage setting --- app/helpers/application_helper.rb | 16 ---------------- app/helpers/stat_helper.rb | 6 +++--- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ac1332f..3d0921e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -9,22 +9,6 @@ def chk_roma_version(vs) raise end - def memory_mode?(stats_hash) - if stats_hash['storages[roma]']['storage.st_class'] == "RubyHashStorage" - return true - else - return false - end - end - - def groonga_mode?(stats_hash) - if stats_hash['storages[roma]']['storage.st_class'] == "GroongaStorage" - return true - else - return false - end - end - def storage_type_is_tc?(stats_hash) # for v1.0.0 if chk_roma_version(stats_hash['others']['version']) == Constants::VERSION_1_0_0 && @stats_hash['storages[roma]']['storage[0].fsiz'] diff --git a/app/helpers/stat_helper.rb b/app/helpers/stat_helper.rb index a96235f..87a6755 100644 --- a/app/helpers/stat_helper.rb +++ b/app/helpers/stat_helper.rb @@ -1,12 +1,12 @@ module StatHelper def check_skip_columns(column, stats_hash) - # skip each file's path - if /^storage\[\d*\]/ =~ column + # skip each srorage file's path and primary/secondary nodes + if /^storage\[\d*\]|primary|secondary/ =~ column return true end - if memory_mode?(stats_hash) || groonga_mode?(stats_hash) + unless storage_type_is_tc?(stats_hash) return true if /storage\.option|storage\.safecopy_stats/ =~ column end end From 39c93bceb47ae909b2a79bc17eb130f40cf48a69 Mon Sep 17 00:00:00 2001 From: hiroaki-iwase Date: Thu, 1 Oct 2015 09:47:57 +0900 Subject: [PATCH 25/26] modify layout --- app/assets/stylesheets/cluster.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/assets/stylesheets/cluster.css b/app/assets/stylesheets/cluster.css index 4dd1fc1..7f20d7f 100644 --- a/app/assets/stylesheets/cluster.css +++ b/app/assets/stylesheets/cluster.css @@ -241,6 +241,7 @@ li.version-diff-info { .instance-table { background-color: #ffffff; margin: 10px; + overflow:auto; } .instance-table td { @@ -248,6 +249,10 @@ li.version-diff-info { vertical-align: middle; } +.cluster-table { + margin: 0; +} + td.instance-status-column { min-width: 100px; text-align: left; From 40dbb2cddff0acbb443b9972ee53efe0a892be69 Mon Sep 17 00:00:00 2001 From: hiroaki-iwase Date: Thu, 1 Oct 2015 12:30:43 +0900 Subject: [PATCH 26/26] adjust all support version --- app/assets/javascripts/cluster.js | 26 +++++++++++++------ app/assets/stylesheets/cluster.css | 11 +++++++- app/controllers/cluster_controller.rb | 21 ++++++++++------ app/helpers/cluster_helper.rb | 7 +++++- app/models/roma.rb | 13 +++++++--- app/views/cluster/index.html.erb | 36 +++++++++++++++++++-------- 6 files changed, 85 insertions(+), 29 deletions(-) diff --git a/app/assets/javascripts/cluster.js b/app/assets/javascripts/cluster.js index 8db9f1c..a9a5918 100644 --- a/app/assets/javascripts/cluster.js +++ b/app/assets/javascripts/cluster.js @@ -114,8 +114,12 @@ $(window).load(function() { // secondary node rd = parseInt(data[instanceName]["redundant"]) - for(i = 0; i < rd; i++ ){ - updateVnodesCount(data, instanceName, "secondary_nodes"+(i+1)) + if (data[instanceName]["version"].match(/^1\.[01]\.0/)) { + updateVnodesCount(data, instanceName, "secondary_nodes") + } else { + for(i = 0; i < rd-1; i++ ){ + updateVnodesCount(data, instanceName, "secondary_nodes"+(i+1)) + } } if (instanceName == gon.host+"_"+gon.port) { @@ -137,8 +141,13 @@ $(window).load(function() { case "release": sum_vnodes = parseInt(data["primary_nodes"]); rd = parseInt(data["redundant"]) - for(i = 0; i < rd-1; i++ ){ - sum_vnodes += parseInt(data["secondary_nodes"+(i+1)]); + + if (data["version"].match(/^1\.[01]\.0/)) { + sum_vnodes += parseInt(data["secondary_nodes"]); + } else { + for(i = 0; i < rd-1; i++ ){ + sum_vnodes += parseInt(data["secondary_nodes"+(i+1)]); + } } progressRate = Math.round((1-(sum_vnodes/gon.denominator)) * 1000) /10 @@ -165,10 +174,13 @@ $(window).load(function() { case "release": sum_vnodes = parseInt(data["primary_nodes"]); rd = parseInt(data["redundant"]) - for(i = 0; i < rd; i++ ){ - sum_vnodes += parseInt(data["secondary_nodes"+(i+1)]); + if (data["version"].match(/^1\.[01]\.0/)) { + sum_vnodes += parseInt(data["secondary_nodes"]); + } else { + for(i = 0; i < rd-1; i++ ){ + sum_vnodes += parseInt(data["secondary_nodes"+(i+1)]); + } } - progressRate = Math.round((1-(sum_vnodes/gon.denominator)) * 1000) /10 if (progressRate == 100) { diff --git a/app/assets/stylesheets/cluster.css b/app/assets/stylesheets/cluster.css index 7f20d7f..7e9023d 100644 --- a/app/assets/stylesheets/cluster.css +++ b/app/assets/stylesheets/cluster.css @@ -207,7 +207,16 @@ li.version-diff-info { .cluster-type-panel .panel-name { color: white; - + filter:dropshadow(color=grey,offX= 0,offY=-1) + dropshadow(color=grey,offX= 1,offY= 0) + dropshadow(color=grey,offX= 0,offY= 1) + dropshadow(color=grey,offX=-1,offY= 0); + + -webkit-text-stroke-color: grey; + -webkit-text-stroke-width: 0.1px; + + text-shadow: grey 1px 1px 0px, grey -1px 1px 0px, + grey 1px -1px 0px, grey -1px -1px 0px; } .cluster-type-panel .panel-value { text-align: center; diff --git a/app/controllers/cluster_controller.rb b/app/controllers/cluster_controller.rb index ab695a7..6a83603 100644 --- a/app/controllers/cluster_controller.rb +++ b/app/controllers/cluster_controller.rb @@ -18,10 +18,13 @@ def index # in case of release was executing by console or login by other users if !session[:denominator] session[:denominator] = info["primary_nodes"] - (info["redundant"]-1).times{|i| - session[:denominator] += info["secondary_nodes#{i+1}"] - } - + if view_context.chk_roma_version(@stats_hash['others']['version']) < Constants::VERSION_1_2_0 + session[:denominator] += info["secondary_nodes"] + else + (info["redundant"]-1).times{|i| + session[:denominator] += info["secondary_nodes#{i+1}"] + } + end end gon.denominator = session[:denominator] gon.routing_info = @routing_info @@ -101,9 +104,13 @@ def release #[release] @routing_info = roma.get_routing_info(@active_routing_list) gon.routing_info = @routing_info session[:denominator] = @routing_info[params[:target_instance]]["primary_nodes"] - (@stats_hash["routing"]["redundant"].to_i - 1).times{|i| - session[:denominator] += @routing_info[params[:target_instance]]["secondary_nodes#{i+1}"] - } + if view_context.chk_roma_version(@stats_hash['others']['version']) < Constants::VERSION_1_2_0 + session[:denominator] += @routing_info[params[:target_instance]]["secondary_nodes"] + else + (@stats_hash["routing"]["redundant"].to_i - 1).times{|i| + session[:denominator] += @routing_info[params[:target_instance]]["secondary_nodes#{i+1}"] + } + end gon.denominator = session[:denominator] render :action => "index" diff --git a/app/helpers/cluster_helper.rb b/app/helpers/cluster_helper.rb index 37e9f61..0b35342 100644 --- a/app/helpers/cluster_helper.rb +++ b/app/helpers/cluster_helper.rb @@ -132,7 +132,12 @@ def released_flg?(routing_info) return true if session[:released] routing_info.each{|instance, info| sum_secondary = 0 - if info["redundant"] + + # for v1.0.0-1.1.0 + if info["secondary_nodes"] + sum_secondary += info["secondary_nodes"] + # for v1.2.0- + elsif info["redundant"] (info["redundant"]-1).times{|i| sum_secondary += info["secondary_nodes#{i+1}"] } diff --git a/app/models/roma.rb b/app/models/roma.rb index c568d5b..bc88334 100644 --- a/app/models/roma.rb +++ b/app/models/roma.rb @@ -209,6 +209,8 @@ def get_routing_info(active_routing_list, *option_params) begin each_stats = self.get_stats(instance.split("_")[0], instance.split("_")[1]) + + ### status[active|inactive|recover|join] if each_stats["stats"]["run_recover"].chomp == "true" status = "recover" @@ -237,9 +239,14 @@ def get_routing_info(active_routing_list, *option_params) ### vnodes count routing_list_info[instance]["primary_nodes"] = each_stats["routing"]["primary"].to_i - (rd-1).times{|i| - routing_list_info[instance]["secondary_nodes#{i+1}"] = each_stats["routing"]["secondary#{i+1}"].to_i - } + + if ApplicationController.helpers.chk_roma_version(@stats_hash['others']['version']) < Constants::VERSION_1_2_0 + routing_list_info[instance]["secondary_nodes"] = each_stats["routing"]["secondary"].to_i + else + (rd-1).times{|i| + routing_list_info[instance]["secondary_nodes#{i+1}"] = each_stats["routing"]["secondary#{i+1}"].to_i + } + end ### option params unless option_params.empty? diff --git a/app/views/cluster/index.html.erb b/app/views/cluster/index.html.erb index 9c7c7ed..645e7df 100644 --- a/app/views/cluster/index.html.erb +++ b/app/views/cluster/index.html.erb @@ -170,17 +170,25 @@ Data rate Data size <% end %> - - vnodes count + <% if chk_roma_version(@stats_hash['others']['version']) < Constants::VERSION_1_2_0 %> + vnodes count + <% else %> + vnodes count + <% end %> <% if session[:user_type] == 'root' %>   <% end %> Primary - <% (@stats_hash['routing']['redundant'].to_i - 1).times{|i| %> - Secondary<%= i+1 %> - <% } %> + <% if chk_roma_version(@stats_hash['others']['version']) < Constants::VERSION_1_2_0 %> + Secondary + <% else %> + <% (@stats_hash['routing']['redundant'].to_i - 1).times{|i| %> + Secondary<%= i+1 %> + <% } %> + <% end %> + @@ -250,14 +258,22 @@ <%= info["primary_nodes"] %> - - <% (@stats_hash['routing']['redundant'].to_i - 1).times{|i| %> + + <% if chk_roma_version(@stats_hash['others']['version']) < Constants::VERSION_1_2_0 %> - - <%= info["secondary_nodes#{i+1}"] %> + + <%= info["secondary_nodes"] %> - <% } %> + <% else %> + <% (@stats_hash['routing']['redundant'].to_i - 1).times{|i| %> + + + <%= info["secondary_nodes#{i+1}"] %> + + + <% } %> + <% end %> <% if session[:user_type] == 'root' %>