Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Shmulik Regev committed Mar 1, 2017
1 parent 049b628 commit 98ef2fb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,7 @@ function simple_cache(capacity_,page_size_)

local function pop_page()
local p = table.remove(pages,1)
-- num_keys will be update when the key is removed
return p
end

Expand Down
3 changes: 0 additions & 3 deletions httpd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,6 @@ function http_loop(address_port_,with_mule_,backup_callback_,incoming_queue_call
end)
local adaptive_timeout = 0
local function step(verbose)
if verbose then
logd(step,adaptive_timeout)
end
copas.step(adaptive_timeout)
end

Expand Down
2 changes: 1 addition & 1 deletion indexer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function indexer(path_)
return sqlite_error("create table failed")
end

if db:exec("PRAGMA journal_mode=DELETE")~=sqlite3.OK then
if db:exec("PRAGMA journal_mode=OFF")~=sqlite3.OK then
return sqlite_error("pragma failed")
end
insert_st = db:prepare("INSERT INTO metrics_index(rowid,content) VALUES (:1,:2)")
Expand Down
5 changes: 4 additions & 1 deletion lightning_mdb.lua
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,14 @@ local function lightning_mdb(base_dir_,read_only_,num_pages_,slots_per_page_)
local function sync()
local function helper(array_)
if not array_ then return end
local start = now_ms()
for _,ed in ipairs(array_) do
local rv,err = ed[1]:sync(1)
if err then
logw("sync",err)
end
end
logi("sync",now_ms()-start)
end
helper(_metas)
helper(_pages)
Expand All @@ -283,7 +285,7 @@ local function lightning_mdb(base_dir_,read_only_,num_pages_,slots_per_page_)
if not amount_ then -- if we are flushing everything, we want to know how much we are going to flush
flush_cache_logger()
end

local start = now_ms()
local log_progress = not amount_ and every_nth_call(PROGRESS_AMOUNT/10,function(count_) logi("flush_cache - progress",count_*10) end)
local insert = table.insert

Expand Down Expand Up @@ -324,6 +326,7 @@ local function lightning_mdb(base_dir_,read_only_,num_pages_,slots_per_page_)
helper(_cache,false)
local size = helper(_nodes_cache,true)
_delayed_sync()
logi("flush_cache",now_ms()-start)
return size>0 -- this only addresses the nodes cache but it actually suffices as for every page there is a node
end

Expand Down
2 changes: 1 addition & 1 deletion mule.lua
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ local function incoming_queue(db_path_,incoming_queue_path_)
os.rename(file,new_name)
local delta = now_ms()-n
logi("processed",new_name,string.format("%.3f",delta),
string.format("%.3f",delta>0 and sz/delta or 0))
string.format("%.1f",delta>0 and sz/delta or 0))
end)
end
executing = false
Expand Down

0 comments on commit 98ef2fb

Please sign in to comment.