Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH 0/3] replace feedback send on tarantool start with send after 2 minutes of operation
@ 2021-04-21  6:31 Serge Petrenko via Tarantool-patches
  2021-04-21  6:31 ` [Tarantool-patches] [PATCH 1/3] Revert "feedback_daemon: send feedback on server start" Serge Petrenko via Tarantool-patches
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Serge Petrenko via Tarantool-patches @ 2021-04-21  6:31 UTC (permalink / raw)
  To: avtikhon, kyukhin; +Cc: tarantool-patches

The reason for this patchset is that the former approach had a bug which was
was worked around ugly by sleeping for 10 seconds in feedback daemon fiber.
The problem was that this hack still didn't work always.

https://github.com/tarantool/tarantool/tree/sp/alt-feedback-daemon

Serge Petrenko (3):
  Revert "feedback_daemon: send feedback on server start"
  feedback_daemon: do not trigger feedback send on first occurred event
  feedback_daemon: speedup the first send to 2 minutes

 src/box/lua/feedback_daemon.lua | 20 ++++---------------
 src/box/lua/load_cfg.lua        | 34 +++++++++++----------------------
 2 files changed, 15 insertions(+), 39 deletions(-)

-- 
2.24.3 (Apple Git-128)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Tarantool-patches] [PATCH 1/3] Revert "feedback_daemon: send feedback on server start"
  2021-04-21  6:31 [Tarantool-patches] [PATCH 0/3] replace feedback send on tarantool start with send after 2 minutes of operation Serge Petrenko via Tarantool-patches
@ 2021-04-21  6:31 ` Serge Petrenko via Tarantool-patches
  2021-04-21  6:31 ` [Tarantool-patches] [PATCH 2/3] feedback_daemon: do not trigger feedback send on first occurred event Serge Petrenko via Tarantool-patches
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Serge Petrenko via Tarantool-patches @ 2021-04-21  6:31 UTC (permalink / raw)
  To: avtikhon, kyukhin; +Cc: tarantool-patches

This reverts commit bc15e0f070c89e00cd76b0432d906697aae25202.
---
 src/box/lua/feedback_daemon.lua | 10 ----------
 src/box/lua/load_cfg.lua        | 34 +++++++++++----------------------
 2 files changed, 11 insertions(+), 33 deletions(-)

diff --git a/src/box/lua/feedback_daemon.lua b/src/box/lua/feedback_daemon.lua
index 7a6b0c94c..8953185b2 100644
--- a/src/box/lua/feedback_daemon.lua
+++ b/src/box/lua/feedback_daemon.lua
@@ -328,12 +328,6 @@ local function fill_in_feedback(self, feedback)
     return feedback
 end
 
--- fixme: remove this hack.
--- It's here to prevent too early feedback sending.
--- This leads to problems with thread sanitization after fork() on Mac OS.
--- Google objc_initializeAfterForkError for details.
-local is_first_send = true
-
 local function feedback_loop(self)
     fiber.name(PREFIX, { truncate = true })
 
@@ -343,10 +337,6 @@ local function feedback_loop(self)
         if msg == "stop" then
             break
         end
-        if is_first_send then
-            fiber.sleep(10)
-            is_first_send = nil
-        end
         local feedback = self:generate_feedback()
         if feedback ~= nil then
             pcall(http.post, self.host, json.encode(feedback), {timeout=1})
diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua
index 11fa98586..4df70c210 100644
--- a/src/box/lua/load_cfg.lua
+++ b/src/box/lua/load_cfg.lua
@@ -661,27 +661,6 @@ setmetatable(box, {
      end
 })
 
--- A trigger on initial box.cfg{} call. Used to perform some checks and
--- send feedback report once instance is fully configured.
-local function on_initial_config()
-    -- Check if schema version matches Tarantool version and print
-    -- warning if it's not (in case user forgot to call
-    -- box.schema.upgrade()).
-    local needs, schema_version_str = private.schema_needs_upgrade()
-    if needs then
-        local msg = string.format(
-            'Your schema version is %s while Tarantool %s requires a more'..
-            ' recent schema version. Please, consider using box.'..
-            'schema.upgrade().', schema_version_str, box.info.version)
-        log.warn(msg)
-    end
-
-    -- Send feedback as soon as instance is configured.
-    if private.feedback_daemon ~= nil then
-        private.feedback_daemon.send()
-    end
-end
-
 -- Whether box is loaded.
 --
 -- `false` when box is not configured or when the initialization
@@ -776,8 +755,17 @@ local function load_cfg(cfg)
 
     box_is_configured = true
 
-    on_initial_config()
-
+    -- Check if schema version matches Tarantool version and print
+    -- warning if it's not (in case user forgot to call
+    -- box.schema.upgrade()).
+    local needs, schema_version_str = private.schema_needs_upgrade()
+    if needs then
+        local msg = string.format(
+            'Your schema version is %s while Tarantool %s requires a more'..
+            ' recent schema version. Please, consider using box.'..
+            'schema.upgrade().', schema_version_str, box.info.version)
+        log.warn(msg)
+    end
 end
 box.cfg = locked(load_cfg)
 
-- 
2.24.3 (Apple Git-128)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Tarantool-patches] [PATCH 2/3] feedback_daemon: do not trigger feedback send on first occurred event
  2021-04-21  6:31 [Tarantool-patches] [PATCH 0/3] replace feedback send on tarantool start with send after 2 minutes of operation Serge Petrenko via Tarantool-patches
  2021-04-21  6:31 ` [Tarantool-patches] [PATCH 1/3] Revert "feedback_daemon: send feedback on server start" Serge Petrenko via Tarantool-patches
@ 2021-04-21  6:31 ` Serge Petrenko via Tarantool-patches
  2021-04-21  6:31 ` [Tarantool-patches] [PATCH 3/3] feedback_daemon: speedup the first send to 2 minutes Serge Petrenko via Tarantool-patches
  2021-04-21 10:18 ` [Tarantool-patches] [PATCH 0/3] replace feedback send on tarantool start with send after 2 minutes of operation Kirill Yukhin via Tarantool-patches
  3 siblings, 0 replies; 5+ messages in thread
From: Serge Petrenko via Tarantool-patches @ 2021-04-21  6:31 UTC (permalink / raw)
  To: avtikhon, kyukhin; +Cc: tarantool-patches

Follow-up #5750
---
 src/box/lua/feedback_daemon.lua | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/src/box/lua/feedback_daemon.lua b/src/box/lua/feedback_daemon.lua
index 8953185b2..239af5fda 100644
--- a/src/box/lua/feedback_daemon.lua
+++ b/src/box/lua/feedback_daemon.lua
@@ -368,11 +368,6 @@ local function save_event(self, event)
         error("Usage: box.internal.feedback_daemon.save_event(string)")
     end
     self.cached_events[event] = (self.cached_events[event] or 0) + 1
-    if self.cached_events[event] == 1 then
-        -- The first occurred event of this type triggers report dispatch
-        -- immediately.
-        self.send()
-    end
 end
 
 -- these functions are used for test purposes only
-- 
2.24.3 (Apple Git-128)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Tarantool-patches] [PATCH 3/3] feedback_daemon: speedup the first send to 2 minutes
  2021-04-21  6:31 [Tarantool-patches] [PATCH 0/3] replace feedback send on tarantool start with send after 2 minutes of operation Serge Petrenko via Tarantool-patches
  2021-04-21  6:31 ` [Tarantool-patches] [PATCH 1/3] Revert "feedback_daemon: send feedback on server start" Serge Petrenko via Tarantool-patches
  2021-04-21  6:31 ` [Tarantool-patches] [PATCH 2/3] feedback_daemon: do not trigger feedback send on first occurred event Serge Petrenko via Tarantool-patches
@ 2021-04-21  6:31 ` Serge Petrenko via Tarantool-patches
  2021-04-21 10:18 ` [Tarantool-patches] [PATCH 0/3] replace feedback send on tarantool start with send after 2 minutes of operation Kirill Yukhin via Tarantool-patches
  3 siblings, 0 replies; 5+ messages in thread
From: Serge Petrenko via Tarantool-patches @ 2021-04-21  6:31 UTC (permalink / raw)
  To: avtikhon, kyukhin; +Cc: tarantool-patches

The first send should happen sooner, than default feedback interval, to
catch not so long-living instances. This replaces the commit we had with
sending feedback right from initial box.cfg{} and on first event
appearance, such as creation/drop of a space or index.

The reason for this commit instead of "send feedback on server start",
is that the latter one was quite hacky and didn't work correctly without
some ugly crutches, namely, fiber.sleep(10) in feedback daemon code.

Follow-up #5750
---
 src/box/lua/feedback_daemon.lua | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/box/lua/feedback_daemon.lua b/src/box/lua/feedback_daemon.lua
index 239af5fda..e1263866a 100644
--- a/src/box/lua/feedback_daemon.lua
+++ b/src/box/lua/feedback_daemon.lua
@@ -330,9 +330,12 @@ end
 
 local function feedback_loop(self)
     fiber.name(PREFIX, { truncate = true })
+    -- Speed up the first send.
+    local send_timeout = math.min(120, self.interval)
 
     while true do
-        local msg = self.control:get(self.interval)
+        local msg = self.control:get(send_timeout)
+        send_timeout = self.interval
         -- if msg == "send" then we simply send feedback
         if msg == "stop" then
             break
-- 
2.24.3 (Apple Git-128)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Tarantool-patches] [PATCH 0/3] replace feedback send on tarantool start with send after 2 minutes of operation
  2021-04-21  6:31 [Tarantool-patches] [PATCH 0/3] replace feedback send on tarantool start with send after 2 minutes of operation Serge Petrenko via Tarantool-patches
                   ` (2 preceding siblings ...)
  2021-04-21  6:31 ` [Tarantool-patches] [PATCH 3/3] feedback_daemon: speedup the first send to 2 minutes Serge Petrenko via Tarantool-patches
@ 2021-04-21 10:18 ` Kirill Yukhin via Tarantool-patches
  3 siblings, 0 replies; 5+ messages in thread
From: Kirill Yukhin via Tarantool-patches @ 2021-04-21 10:18 UTC (permalink / raw)
  To: Serge Petrenko; +Cc: tarantool-patches

Hello,

On 21 апр 09:31, Serge Petrenko wrote:
> The reason for this patchset is that the former approach had a bug which was
> was worked around ugly by sleeping for 10 seconds in feedback daemon fiber.
> The problem was that this hack still didn't work always.
> 
> https://github.com/tarantool/tarantool/tree/sp/alt-feedback-daemon

LGTM.

I've checked your patchset into master.

--
Regards, Kirill Yukhin

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-21 10:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21  6:31 [Tarantool-patches] [PATCH 0/3] replace feedback send on tarantool start with send after 2 minutes of operation Serge Petrenko via Tarantool-patches
2021-04-21  6:31 ` [Tarantool-patches] [PATCH 1/3] Revert "feedback_daemon: send feedback on server start" Serge Petrenko via Tarantool-patches
2021-04-21  6:31 ` [Tarantool-patches] [PATCH 2/3] feedback_daemon: do not trigger feedback send on first occurred event Serge Petrenko via Tarantool-patches
2021-04-21  6:31 ` [Tarantool-patches] [PATCH 3/3] feedback_daemon: speedup the first send to 2 minutes Serge Petrenko via Tarantool-patches
2021-04-21 10:18 ` [Tarantool-patches] [PATCH 0/3] replace feedback send on tarantool start with send after 2 minutes of operation Kirill Yukhin via Tarantool-patches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox