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=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by gnuweeb.org (Postfix) with ESMTPSA id 37787804FD for ; Fri, 28 Oct 2022 17:19:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1666977594; bh=tEADgaq1c03/x+LjgWEB9BYkYWJ3puIavqK+9rzgfTw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=mvd1LwFqjpDAjyJW4wk75uZD01bnJAjYYXCe+xBZTnhYN8bjkOqcWFKzwG9TFPRyB 8jL5KKpFptyQBHGC44ny8srJaMKjrkwvabViD0kt6IXGnoi4jp5fig/rwRnBMlfaM/ XJAKmW3/y3MVk9MPxhqUAH7I0RRKe7NP2E6shXslYtVL3v80fvTc7p+/LFPtB3RmeN lu/507SJsdbu9hUfBKF3niZ/2YRLakj5DgScQdmFnS+sw2Tb8htMP1POdjYxCH4jOf s7nV/Mqf9fvCZq4qslZ+e5eZWOwzXjnm0KGTiex8LWmBa8Rt3avajPozvKpb4+vDl0 mGjABxgHllAaQ== Received: by mail-pg1-f178.google.com with SMTP id h2so5387022pgp.4 for ; Fri, 28 Oct 2022 10:19:54 -0700 (PDT) X-Gm-Message-State: ACrzQf3UeTkPTtTshI8MKHTuhkpoiJ4m5ZJHFZZ6EizrBNKrJwYW4cu4 Ji9eHzFNpDjajQNiwR8vknwpQW9jKLgy3VGuwEs= X-Google-Smtp-Source: AMsMyM6w4ruozzJ5uJjKJemJLZcAr0NzcuK4kHkRmgLiO+MmnIeBm5J+8MWTHHRNyCboWGmNjrQTBnBEpnBnckK8UsY= X-Received: by 2002:a63:2a81:0:b0:43c:5fa6:1546 with SMTP id q123-20020a632a81000000b0043c5fa61546mr479093pgq.43.1666977593853; Fri, 28 Oct 2022 10:19:53 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <6aed0245-5156-7983-f4be-faf4d6cd7a13@gnuweeb.org> From: Ammar Faizi Date: Sat, 29 Oct 2022 00:19:37 +0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 2/2] daemon: telegram: Handle MySQL error To: Muhammad Rizki Cc: Alviro Iskandar Setiawan , "GNU/Weeb Mailing List" Content-Type: text/plain; charset="UTF-8" List-Id: On Sat, Oct 29, 2022 at 12:02 AM Muhammad Rizki wrote: > So, you want me to remove the autocommit = True and manual commit each > we want to insert and delete? Yes, but note that, not only manual commit, you have to make sure the operation is atomic. 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. 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. -- Ammar Faizi