[Tarantool-patches] [PATCH 2/2] xlog: do not sort sole entry

Cyrill Gorcunov gorcunov at gmail.com
Wed Mar 10 23:47:10 MSK 2021


In case if there only one snapshot or xlog file
there is no need to call sorting procedure at all.

In-scope-of #5806

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 src/box/xlog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/box/xlog.c b/src/box/xlog.c
index 974f460be..89df7e485 100644
--- a/src/box/xlog.c
+++ b/src/box/xlog.c
@@ -588,7 +588,7 @@ xdir_scan(struct xdir *dir, bool is_dir_required)
 		signatures[s_count++] = signature;
 	}
 	/** Sort the list of files */
-	if (s_count > 0)
+	if (s_count > 1)
 		qsort(signatures, s_count, sizeof(*signatures), cmp_i64);
 	/**
 	 * Update the log dir index with the current state:
-- 
2.29.2



More information about the Tarantool-patches mailing list