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 CE0646EC5B; Wed, 12 May 2021 22:59:52 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org CE0646EC5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1620849592; bh=4u+mWEtw48YYxri8vZYBSsilLFjisyuwR5/gSReMHmo=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=g+ZvgfW74XPtZfCOpngBUWqsaV5G2a8ainp6knV0n3yfiN/H5aLBdVqlxcUJNC0CW J3hlal7jVpGz0OfBBDMD2lX857K+ja2buDwBqG1C7IUwRC3ttWcNSFp6I5G66eTTln fnzHnEjrwbp7dpeHBcek/GihoRTdi0pGJ7VJk7uo= Received: from smtp47.i.mail.ru (smtp47.i.mail.ru [94.100.177.107]) (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 843046EC5B for ; Wed, 12 May 2021 22:59:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 843046EC5B Received: by smtp47.i.mail.ru with esmtpa (envelope-from ) id 1lgv1K-0003L5-CL; Wed, 12 May 2021 22:59:50 +0300 To: Cyrill Gorcunov , tml References: <20210506214132.533913-1-gorcunov@gmail.com> <20210506214132.533913-2-gorcunov@gmail.com> Message-ID: Date: Wed, 12 May 2021 21:59:49 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210506214132.533913-2-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD95978C26455E69BE0B2C7F7C3B0039F139F0EF8E3717E163C182A05F5380850403EAAF797BC58644A63ECD054D2AF1290087BA8BEE9FB3DFEC3FCE6513159B931 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7235646FAB97B4BEDEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637CD8995A08F41566CEA1F7E6F0F101C67CDEEF6D7F21E0D1D9295C2E9FA3191EE1B59CA4C82EFA65854D5BA2F0E049DA6AB25E86F11A6D76DF6B57BC7E64490618DEB871D839B73339E8FC8737B5C22498424CA1AAF98A6958941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B64854413538E1713FCC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C22498B372E35CF5A2D2DD32BA5DBAC0009BE395957E7521B51C20BC6067A898B09E4090A508E0FED6299176DF2183F8FC7C0CED1AC7440589732CD04E86FAF290E2D7E9C4E3C761E06A71DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6300D3B61E77C8D3B089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2368A440D3B0F6089093C9A16E5BC824A2A04A2ABAA09D25379311020FFC8D4ADD96B37CF62A76BCBFE99F73256C3A2DE X-C1DE0DAB: 0D63561A33F958A59840DF7CCE016BD375232A12A153E388BF18FB28E51152B4D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D342E8FEDBD32DECB6D6E6F23F3C2A9CCB910A9F62436F3E8D6724EFEF7F9F9A42969AB230B4708FEB11D7E09C32AA3244C6E2195869D5945B315ABE22B393C5AB024AF4FAF06DA24FD927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojo6y/qPNd2uwLE4t6zZCAOw== X-Mailru-Sender: 504CC1E875BF3E7D9BC0E5172ADA31101E56EA13ACEAD09CE273F7E98172B9BC75123642912A91CC07784C02288277CA03E0582D3806FB6A5317862B1921BA260ED6CFD6382C13A6112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v4 1/2] applier: send transaction's first row WAL time in the applier_writer_f 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for working on this! See 3 comments below. > diff --git a/src/box/applier.cc b/src/box/applier.cc > index 33181fdbf..3038ce05f 100644 > --- a/src/box/applier.cc > +++ b/src/box/applier.cc> @@ -789,6 +828,8 @@ apply_synchro_row_cb(struct journal_entry *entry) > if (entry->res < 0) { > applier_rollback_by_wal_io(); > } else { > + if (synchro_entry->wal_st != NULL) > + wal_stat_update(synchro_entry->wal_st); 1. You have 3 branches here: first in apply_synchro_row() where you check replica_id != 0, then here, and then in wal_stat_update() to check if the replica exists. You could make it 2 if would add wal_stat in apply_synchro_row() always. Anyway there is no replica with replica_id 0, so wal_state_update() won't do anything. > txn_limbo_process(&txn_limbo, synchro_entry->req); > trigger_run(&replicaset.applier.on_wal_write, NULL); > } > @@ -1088,11 +1151,14 @@ applier_apply_tx(struct applier *applier, struct stailq *rows) > * each other. > */ > assert(first_row == last_row); > - if ((rc = apply_synchro_row(first_row)) != 0) > + rc = apply_synchro_row(applier->instance_id, first_row); > + if (rc != 0) > + goto finish; > + } else { > + rc = apply_plain_tx(applier->instance_id, rows, > + replication_skip_conflict, true); > + if (rc != 0) > goto finish; 2. These 2 error checks are identical. You can move them out of if-else. > - } else if ((rc = apply_plain_tx(rows, replication_skip_conflict, > - true)) != 0) { > - goto finish; > } > vclock_follow(&replicaset.applier.vclock, last_row->replica_id, > last_row->lsn); > diff --git a/src/box/replication.h b/src/box/replication.h > index 2ad1cbf66..a40582cd3 100644 > --- a/src/box/replication.h > +++ b/src/box/replication.h > @@ -331,6 +331,10 @@ struct replica { > * separate from applier. > */ > enum applier_state applier_sync_state; > + /** > + * Applier's WAL related statistics. > + */ > + struct applier_wal_stat wal_st; 3. The stat object also stores replica_id which is useless to store in struct replica - you know its ID anyway. There is already replica->id. I would suggest to store only the timestamp, and move the stat declaration to .cc file.