From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,NO_DNS_FOR_FROM, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from [192.168.1.2] (unknown [101.128.126.183]) by gnuweeb.org (Postfix) with ESMTPSA id 67E02804FD; Fri, 28 Oct 2022 18:18:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1666981117; bh=Bfp2hD9+ZUG/AnWfmDKb1ID5L6nxs3fsJrQhKTdWeb4=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=hdm8YQBpLY+VZ6mb6+bkWaQ8FGBjIlwDxcWf6aYAaUzbZy9/oo6aJYva1I4wdeiCZ 7jUjZTVxps86UFrsvJAL+faOOXmlC1AmSZf/olZax23h75eHo6wVRAzgEcEkbpSIeY 1OGNVb1xJluo3RO3fLwj1Em0p+u5DwfDIYwdsWD8mUyjraHvG/18MHbDbe6WHH7Gb5 LqIVlPxEoG82PJJYOqfwwp7VxIdafRdoS9+sZGn87JJIWtnR3q2j+IDBIM8djk0iHA nQrquN8Ws3LdoTQVWUhmRyJodczgNLCYTcSop3Wo60uvndEJ7sn02vegB4Ys8dFFqj 49OJMUYQoEwwA== Message-ID: Date: Sat, 29 Oct 2022 01:18:33 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v1 2/2] daemon: telegram: Handle MySQL error Content-Language: en-US From: Muhammad Rizki To: Ammar Faizi Cc: Alviro Iskandar Setiawan , GNU/Weeb Mailing List References: <20221027150823.601914-1-ammarfaizi2@gnuweeb.org> <20221027150823.601914-3-ammarfaizi2@gnuweeb.org> <1d500d37-b11b-75fd-38e5-d7f8e0a9b1d4@gnuweeb.org> <3a79a587-ddee-9e25-2ac5-b573938b44a9@gnuweeb.org> <043f55c3-67d8-9130-aca4-73c59926d2af@gnuweeb.org> <6aed0245-5156-7983-f4be-faf4d6cd7a13@gnuweeb.org> <67f786d9-f5b8-5e4a-3944-260483db1c6b@gnuweeb.org> In-Reply-To: <67f786d9-f5b8-5e4a-3944-260483db1c6b@gnuweeb.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: On 29/10/22 01.15, Muhammad Rizki wrote: > On 29/10/22 00.19, Ammar Faizi wrote: >> >> For example: >>    begin_transaction() >>    insert_a  -> this is a success >>    insert_b  -> this is a success >>    insert_c  -> this is a fail, goto rollback >>    commit() -> this doesn't happen >> >> rollback: >>    rollback() // insert_a and insert_b are undone. > > This pseudo-code seems like C style. Anyway, the rollback() is from the > MySQL function? > >> >> Those 3 inserts are atomic and consistent. If one fails, all >> operations must also fail. No half-insert, no unisolated select, no >> missing cleanup, no temp file not deleted due to error in the middle >> operation, etc. >> > > This is a little bit confused me to implement it. 🤔 Anyway, I've ever wanted to refactor the DB using the SQLAlchemy and want to implement the clean-arch method too, but, IDK when to do that, maybe I could just re-create the daemon in my local and make the version 2 of it.