From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 7C02B6EC5D; Thu, 8 Apr 2021 16:42:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7C02B6EC5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617889347; bh=flCi9wRlZj7G+wRHIfhFlBTXPMbR9Bebd6JO7mdx7wE=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=CPkndEphYv9mby0jWBb47c2zk/fUHbLUjxV0CkK2GxfFhRGke0iCxqZ9hUL5ZZHWW cD5IgRhkN0qXAJQRAiIKMhqW8+6TfTxBjoGxHvIzAZReQuSabEsnlqBMgJziXk46M5 ZOpcaEpkT5VLWAyoV8pBOCguiyfh8DONnlJCNGZo= Received: from smtp35.i.mail.ru (smtp35.i.mail.ru [94.100.177.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 9B2D86EC5E for ; Thu, 8 Apr 2021 16:41:37 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9B2D86EC5E Received: by smtp35.i.mail.ru with esmtpa (envelope-from ) id 1lUUue-0000gw-Lr; Thu, 08 Apr 2021 16:41:37 +0300 To: v.shpilevoy@tarantool.org, alexander.turenko@tarantool.org Date: Thu, 8 Apr 2021 16:38:39 +0300 Message-Id: <0feec24c50d302255a300e27678448577f30540b.1617888916.git.sergepetrenko@tarantool.org> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD912A3E3D5D4B49FC1CC94992626AE9EFE0A9192A937C653EE00894C459B0CD1B95C7EE81DC57EEAD3BB111EA81ED9080438DE5FFF3BE3010067236096E73D0E14 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE73F300A97FDD4E158EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063768D6DD405B71470F8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2FD4947C4974F4DB0C9355CF8ED35FCDB8E320D419CB56618D2E47CDBA5A96583C09775C1D3CA48CFA367EA73E0D98AAD117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE7A4F00A9E8C511CEB9FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA71A620F70A64A45A98AA50765F79006372E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89FB26E97DCB74E6252156CCFE7AF13BCA4B5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CD0035DD76F8A8A4FB9593F4A5BD77DC787F19454FD1924979C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF0417BEADF48D1460699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34F804B400765FFFF90AC01168E76C4816738A8D825A0394BB66E2CE87BDE0F1535AB5E0138A425D931D7E09C32AA3244CEC1F99FFF994552DBD96FE93D6F3F5FE3A76366E8A9DE7CA927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioju+jaMfvANXpiISklXinYnQ== X-Mailru-Sender: 3B9A0136629DC9125D61937A2360A4465E4806B976005D2A2E66B02F09C910F97649BC7681BBA911424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v2 3/5] feedback_daemon: send feedback on server start X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Send the first report as soon as instance's initial configuration finishes. Part of #5750 --- src/box/lua/feedback_daemon.lua | 10 ++++++++++ src/box/lua/load_cfg.lua | 34 ++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/box/lua/feedback_daemon.lua b/src/box/lua/feedback_daemon.lua index d00eedf39..43bbc1fa2 100644 --- a/src/box/lua/feedback_daemon.lua +++ b/src/box/lua/feedback_daemon.lua @@ -323,6 +323,12 @@ local function fill_in_feedback(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 }) @@ -333,6 +339,10 @@ local function feedback_loop(self) if msg == "stop" then break elseif feedback ~= nil then + if is_first_send then + fiber.sleep(10) + is_first_send = nil + end pcall(http.post, self.host, json.encode(feedback), {timeout=1}) end end diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua index 44bb95ed1..885a0cac1 100644 --- a/src/box/lua/load_cfg.lua +++ b/src/box/lua/load_cfg.lua @@ -626,6 +626,27 @@ 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 @@ -716,17 +737,8 @@ local function load_cfg(cfg) box_is_configured = true - -- 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 + on_initial_config() + end box.cfg = locked(load_cfg) -- 2.24.3 (Apple Git-128)