mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
8b648b0336
Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/buf/buf0buf.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/dict/dict0crea.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/dict/dict0dict.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/fil/fil0fil.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/fsp/fsp0fsp.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/include/fil0fil.h: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/include/fsp0fsp.h: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/include/log0recv.h: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/include/mtr0log.h: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/include/mtr0mtr.h: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/include/os0file.h: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/include/ut0dbg.h: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/include/ut0ut.h: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/include/ha0ha.ic: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/include/mtr0log.ic: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/log/log0log.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/log/log0recv.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/mem/mem0pool.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/os/os0file.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/pars/lexyy.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/row/row0mysql.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/row/row0sel.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/srv/srv0srv.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/srv/srv0start.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/ut/ut0rnd.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation innobase/ut/ut0ut.c: Merge with ibbackup; bug fix: .ibd files were extended 2 x the required amount; InnoDB does not create the small file inno_arch_log... any more at database creation
78 lines
1.4 KiB
C
78 lines
1.4 KiB
C
/*******************************************************************
|
|
Random numbers and hashing
|
|
|
|
(c) 1994, 1995 Innobase Oy
|
|
|
|
Created 5/11/1994 Heikki Tuuri
|
|
********************************************************************/
|
|
|
|
#include "ut0rnd.h"
|
|
|
|
#ifdef UNIV_NONINL
|
|
#include "ut0rnd.ic"
|
|
#endif
|
|
|
|
/* These random numbers are used in ut_find_prime */
|
|
#define UT_RANDOM_1 1.0412321
|
|
#define UT_RANDOM_2 1.1131347
|
|
#define UT_RANDOM_3 1.0132677
|
|
|
|
|
|
ulint ut_rnd_ulint_counter = 65654363;
|
|
|
|
/***************************************************************
|
|
Looks for a prime number slightly greater than the given argument.
|
|
The prime is chosen so that it is not near any power of 2. */
|
|
|
|
ulint
|
|
ut_find_prime(
|
|
/*==========*/
|
|
/* out: prime */
|
|
ulint n) /* in: positive number > 100 */
|
|
{
|
|
ulint pow2;
|
|
ulint i;
|
|
|
|
n += 100;
|
|
|
|
pow2 = 1;
|
|
while (pow2 * 2 < n) {
|
|
pow2 = 2 * pow2;
|
|
}
|
|
|
|
if ((double)n < 1.05 * (double)pow2) {
|
|
n = (ulint) ((double)n * UT_RANDOM_1);
|
|
}
|
|
|
|
pow2 = 2 * pow2;
|
|
|
|
if ((double)n > 0.95 * (double)pow2) {
|
|
n = (ulint) ((double)n * UT_RANDOM_2);
|
|
}
|
|
|
|
if (n > pow2 - 20) {
|
|
n += 30;
|
|
}
|
|
|
|
/* Now we have n far enough from powers of 2. To make
|
|
n more random (especially, if it was not near
|
|
a power of 2), we then multiply it by a random number. */
|
|
|
|
n = (ulint) ((double)n * UT_RANDOM_3);
|
|
|
|
for (;; n++) {
|
|
i = 2;
|
|
while (i * i <= n) {
|
|
if (n % i == 0) {
|
|
goto next_n;
|
|
}
|
|
i++;
|
|
}
|
|
|
|
/* Found a prime */
|
|
break;
|
|
next_n: ;
|
|
}
|
|
|
|
return(n);
|
|
}
|