Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review
@ 2020-06-26 14:52 Cyrill Gorcunov
  2020-06-26 14:52 ` [Tarantool-patches] [PATCH 1/5] iproto: drop unused iproto_type_is_sync Cyrill Gorcunov
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Cyrill Gorcunov @ 2020-06-26 14:52 UTC (permalink / raw)
  To: tml; +Cc: Vladislav Shpilevoy

While been readin qsync code I spotted some places which worth
cleaning up. The review procedure is still in progress but I
think we should post patches early.

branch gorcunov/gh-4842-sync-replication
ci https://gitlab.com/tarantool/tarantool/-/pipelines/160514636

Cyrill Gorcunov (5):
  iproto: drop unused iproto_type_is_sync
  iproto: drop unused iproto_type_is_select
  iproto: drop unused iproto_type_is_request
  journal: drop unused destroy method
  txn: use txn_set_flag

 src/box/applier.cc         |  4 ++--
 src/box/box.cc             |  3 +--
 src/box/iproto_constants.h | 29 -----------------------------
 src/box/journal.h          |  9 +--------
 src/box/txn.h              | 10 ----------
 src/box/wal.c              |  3 +--
 6 files changed, 5 insertions(+), 53 deletions(-)


base-commit: 958f59dcdea04b9a69066621bcbbc39e6bac592d
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 1/5] iproto: drop unused iproto_type_is_sync
  2020-06-26 14:52 [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review Cyrill Gorcunov
@ 2020-06-26 14:52 ` Cyrill Gorcunov
  2020-06-26 14:52 ` [Tarantool-patches] [PATCH 2/5] iproto: drop unused iproto_type_is_select Cyrill Gorcunov
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Cyrill Gorcunov @ 2020-06-26 14:52 UTC (permalink / raw)
  To: tml; +Cc: Vladislav Shpilevoy

Introduced in 157beda5abb336c722f6f8256b5682797d79b640
but never used since.

In-scope-of #4842

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 src/box/iproto_constants.h | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/src/box/iproto_constants.h b/src/box/iproto_constants.h
index 45c8af236..ccdb48780 100644
--- a/src/box/iproto_constants.h
+++ b/src/box/iproto_constants.h
@@ -346,17 +346,6 @@ iproto_type_is_synchro_request(uint32_t type)
 	return type == IPROTO_CONFIRM || type == IPROTO_ROLLBACK;
 }
 
-/**
- * The request is "synchronous": no other requests
- * on this connection should be taken before this one
- * ends.
- */
-static inline bool
-iproto_type_is_sync(uint32_t type)
-{
-	return type == IPROTO_JOIN || type == IPROTO_SUBSCRIBE;
-}
-
 /** This is an error. */
 static inline bool
 iproto_type_is_error(uint32_t type)
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 2/5] iproto: drop unused iproto_type_is_select
  2020-06-26 14:52 [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review Cyrill Gorcunov
  2020-06-26 14:52 ` [Tarantool-patches] [PATCH 1/5] iproto: drop unused iproto_type_is_sync Cyrill Gorcunov
@ 2020-06-26 14:52 ` Cyrill Gorcunov
  2020-06-26 14:52 ` [Tarantool-patches] [PATCH 3/5] iproto: drop unused iproto_type_is_request Cyrill Gorcunov
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Cyrill Gorcunov @ 2020-06-26 14:52 UTC (permalink / raw)
  To: tml; +Cc: Vladislav Shpilevoy

Last time used in 1d979029177c2cfd869cbcf9f73884f6c00300fc

In-scope-of #4842

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 src/box/iproto_constants.h | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/src/box/iproto_constants.h b/src/box/iproto_constants.h
index ccdb48780..57ae56d83 100644
--- a/src/box/iproto_constants.h
+++ b/src/box/iproto_constants.h
@@ -321,17 +321,6 @@ dml_request_key_map(uint32_t type)
 	return iproto_body_key_map[type];
 }
 
-/**
- * A read only request, CALL is included since it
- * may be read-only, and there are separate checks
- * for all database requests issues from CALL.
- */
-static inline bool
-iproto_type_is_select(uint32_t type)
-{
-	return type <= IPROTO_SELECT || type == IPROTO_CALL || type == IPROTO_EVAL;
-}
-
 /** A common request with a mandatory and simple body (key, tuple, ops)  */
 static inline bool
 iproto_type_is_request(uint32_t type)
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 3/5] iproto: drop unused iproto_type_is_request
  2020-06-26 14:52 [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review Cyrill Gorcunov
  2020-06-26 14:52 ` [Tarantool-patches] [PATCH 1/5] iproto: drop unused iproto_type_is_sync Cyrill Gorcunov
  2020-06-26 14:52 ` [Tarantool-patches] [PATCH 2/5] iproto: drop unused iproto_type_is_select Cyrill Gorcunov
@ 2020-06-26 14:52 ` Cyrill Gorcunov
  2020-06-26 14:52 ` [Tarantool-patches] [PATCH 4/5] journal: drop unused destroy method Cyrill Gorcunov
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Cyrill Gorcunov @ 2020-06-26 14:52 UTC (permalink / raw)
  To: tml; +Cc: Vladislav Shpilevoy

Introduced in 157beda5abb336c722f6f8256b5682797d79b640
and never used since.

In-scope-of #4842

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 src/box/iproto_constants.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/src/box/iproto_constants.h b/src/box/iproto_constants.h
index 57ae56d83..6b850f101 100644
--- a/src/box/iproto_constants.h
+++ b/src/box/iproto_constants.h
@@ -321,13 +321,6 @@ dml_request_key_map(uint32_t type)
 	return iproto_body_key_map[type];
 }
 
-/** A common request with a mandatory and simple body (key, tuple, ops)  */
-static inline bool
-iproto_type_is_request(uint32_t type)
-{
-	return type > IPROTO_OK && type <= IPROTO_TYPE_STAT_MAX;
-}
-
 /** CONFIRM/ROLLBACK entries for synchronous replication. */
 static inline bool
 iproto_type_is_synchro_request(uint32_t type)
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 4/5] journal: drop unused destroy method
  2020-06-26 14:52 [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review Cyrill Gorcunov
                   ` (2 preceding siblings ...)
  2020-06-26 14:52 ` [Tarantool-patches] [PATCH 3/5] iproto: drop unused iproto_type_is_request Cyrill Gorcunov
@ 2020-06-26 14:52 ` Cyrill Gorcunov
  2020-06-26 14:52 ` [Tarantool-patches] [PATCH 5/5] txn: use txn_set_flag Cyrill Gorcunov
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Cyrill Gorcunov @ 2020-06-26 14:52 UTC (permalink / raw)
  To: tml; +Cc: Vladislav Shpilevoy

We never use this method so no need to waste space.

In-scope-of #4842

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 src/box/box.cc    | 3 +--
 src/box/journal.h | 9 +--------
 src/box/wal.c     | 3 +--
 3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/box/box.cc b/src/box/box.cc
index dfd7dcb5a..ad76f4f00 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -364,8 +364,7 @@ recovery_journal_create(struct vclock *v)
 {
 	static struct recovery_journal journal;
 	journal_create(&journal.base, recovery_journal_write_async,
-		       txn_complete_async,
-		       recovery_journal_write, NULL);
+		       txn_complete_async, recovery_journal_write);
 	journal.vclock = v;
 	journal_set(&journal.base);
 }
diff --git a/src/box/journal.h b/src/box/journal.h
index a3f3170ed..ebc5cb708 100644
--- a/src/box/journal.h
+++ b/src/box/journal.h
@@ -102,9 +102,6 @@ struct journal {
 	/** Synchronous write */
 	int (*write)(struct journal *journal,
 		     struct journal_entry *entry);
-
-	/** Journal destroy */
-	void (*destroy)(struct journal *journal);
 };
 
 /**
@@ -169,8 +166,6 @@ journal_write_async(struct journal_entry *entry)
 static inline void
 journal_set(struct journal *new_journal)
 {
-	if (current_journal && current_journal->destroy)
-		current_journal->destroy(current_journal);
 	current_journal = new_journal;
 }
 
@@ -180,13 +175,11 @@ journal_create(struct journal *journal,
 				  struct journal_entry *entry),
 	       void (*write_async_cb)(struct journal_entry *entry),
 	       int (*write)(struct journal *journal,
-			    struct journal_entry *entry),
-	       void (*destroy)(struct journal *journal))
+			    struct journal_entry *entry))
 {
 	journal->write_async	= write_async;
 	journal->write_async_cb	= write_async_cb;
 	journal->write		= write;
-	journal->destroy	= destroy;
 }
 
 /**
diff --git a/src/box/wal.c b/src/box/wal.c
index b979244e3..74cc74684 100644
--- a/src/box/wal.c
+++ b/src/box/wal.c
@@ -417,8 +417,7 @@ wal_writer_create(struct wal_writer *writer, enum wal_mode wal_mode,
 		       wal_write_none_async : wal_write_async,
 		       wall_async_cb,
 		       wal_mode == WAL_NONE ?
-		       wal_write_none : wal_write,
-		       NULL);
+		       wal_write_none : wal_write);
 
 	struct xlog_opts opts = xlog_opts_default;
 	opts.sync_is_async = true;
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 5/5] txn: use txn_set_flag
  2020-06-26 14:52 [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review Cyrill Gorcunov
                   ` (3 preceding siblings ...)
  2020-06-26 14:52 ` [Tarantool-patches] [PATCH 4/5] journal: drop unused destroy method Cyrill Gorcunov
@ 2020-06-26 14:52 ` Cyrill Gorcunov
  2020-06-26 14:55 ` [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review Cyrill Gorcunov
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Cyrill Gorcunov @ 2020-06-26 14:52 UTC (permalink / raw)
  To: tml; +Cc: Vladislav Shpilevoy

To operate with flags we've three helpers:
_set, _clear and _has. No need for additional
wrapper.

Same time it is more convenient to grep for
TXN_FORCE_ASYNC directly.

In-scope-of #4842

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 src/box/applier.cc |  4 ++--
 src/box/txn.h      | 10 ----------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/box/applier.cc b/src/box/applier.cc
index 2d1047d43..04b557051 100644
--- a/src/box/applier.cc
+++ b/src/box/applier.cc
@@ -219,7 +219,7 @@ apply_snapshot_row(struct xrow_header *row)
 	 * Do not wait for confirmation when fetching a snapshot.
 	 * Master only sends confirmed rows during join.
 	 */
-	txn_force_async(txn);
+	txn_set_flag(txn, TXN_FORCE_ASYNC);
 	if (txn_begin_stmt(txn, space) != 0)
 		goto rollback;
 	/* no access checks here - applier always works with admin privs */
@@ -336,7 +336,7 @@ apply_final_join_row(struct xrow_header *row)
 	 * Do not wait for confirmation while processing final
 	 * join rows. See apply_snapshot_row().
 	 */
-	txn_force_async(txn);
+	txn_set_flag(txn, TXN_FORCE_ASYNC);
 	if (apply_row(row) != 0) {
 		txn_rollback(txn);
 		fiber_gc();
diff --git a/src/box/txn.h b/src/box/txn.h
index d10c51f0f..c631d7033 100644
--- a/src/box/txn.h
+++ b/src/box/txn.h
@@ -287,16 +287,6 @@ txn_clear_flag(struct txn *txn, enum txn_flag flag)
 	txn->flags &= ~(1 << flag);
 }
 
-/**
- * Force async mode for transaction. It won't wait for acks
- * or confirmation.
- */
-static inline void
-txn_force_async(struct txn *txn)
-{
-	txn_set_flag(txn, TXN_FORCE_ASYNC);
-}
-
 /* Pointer to the current transaction (if any) */
 static inline struct txn *
 in_txn(void)
-- 
2.26.2

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

* Re: [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review
  2020-06-26 14:52 [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review Cyrill Gorcunov
                   ` (4 preceding siblings ...)
  2020-06-26 14:52 ` [Tarantool-patches] [PATCH 5/5] txn: use txn_set_flag Cyrill Gorcunov
@ 2020-06-26 14:55 ` Cyrill Gorcunov
  2020-06-28 16:55 ` Vladislav Shpilevoy
  2020-06-29 20:37 ` Vladislav Shpilevoy
  7 siblings, 0 replies; 9+ messages in thread
From: Cyrill Gorcunov @ 2020-06-26 14:55 UTC (permalink / raw)
  To: tml; +Cc: Vladislav Shpilevoy

On Fri, Jun 26, 2020 at 05:52:22PM +0300, Cyrill Gorcunov wrote:
> While been readin qsync code I spotted some places which worth
> cleaning up. The review procedure is still in progress but I
> think we should post patches early.
> 
> branch gorcunov/gh-4842-sync-replication
> ci https://gitlab.com/tarantool/tarantool/-/pipelines/160514636
> 

Strictly speaking patches 1-4 are appliable to vanilla master as well.

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

* Re: [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review
  2020-06-26 14:52 [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review Cyrill Gorcunov
                   ` (5 preceding siblings ...)
  2020-06-26 14:55 ` [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review Cyrill Gorcunov
@ 2020-06-28 16:55 ` Vladislav Shpilevoy
  2020-06-29 20:37 ` Vladislav Shpilevoy
  7 siblings, 0 replies; 9+ messages in thread
From: Vladislav Shpilevoy @ 2020-06-28 16:55 UTC (permalink / raw)
  To: Cyrill Gorcunov, tml

LGTM.

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

* Re: [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review
  2020-06-26 14:52 [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review Cyrill Gorcunov
                   ` (6 preceding siblings ...)
  2020-06-28 16:55 ` Vladislav Shpilevoy
@ 2020-06-29 20:37 ` Vladislav Shpilevoy
  7 siblings, 0 replies; 9+ messages in thread
From: Vladislav Shpilevoy @ 2020-06-29 20:37 UTC (permalink / raw)
  To: Cyrill Gorcunov, tml

First 4 comments are merged to master.

The last commit is squashed into the first commit where
TXN_FORCE_ASYNC appeared.

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

end of thread, other threads:[~2020-06-29 20:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-26 14:52 [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review Cyrill Gorcunov
2020-06-26 14:52 ` [Tarantool-patches] [PATCH 1/5] iproto: drop unused iproto_type_is_sync Cyrill Gorcunov
2020-06-26 14:52 ` [Tarantool-patches] [PATCH 2/5] iproto: drop unused iproto_type_is_select Cyrill Gorcunov
2020-06-26 14:52 ` [Tarantool-patches] [PATCH 3/5] iproto: drop unused iproto_type_is_request Cyrill Gorcunov
2020-06-26 14:52 ` [Tarantool-patches] [PATCH 4/5] journal: drop unused destroy method Cyrill Gorcunov
2020-06-26 14:52 ` [Tarantool-patches] [PATCH 5/5] txn: use txn_set_flag Cyrill Gorcunov
2020-06-26 14:55 ` [Tarantool-patches] [PATCH 0/5] qsync: Cleanups during review Cyrill Gorcunov
2020-06-28 16:55 ` Vladislav Shpilevoy
2020-06-29 20:37 ` Vladislav Shpilevoy

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