The Samba-Bugzilla – Attachment 6128 Details for
Bug 7610
winbindd_cache.tdb grows too large when scaled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix for 3.4.x.
winbindd_cache.patch (text/plain), 4.19 KB, created by
Jeremy Allison
on 2010-12-08 18:25:27 UTC
(
hide
)
Description:
Fix for 3.4.x.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2010-12-08 18:25:27 UTC
Size:
4.19 KB
patch
obsolete
>diff --git a/lib/tdb/common/io.c b/lib/tdb/common/io.c >index 661f761..2e53296 100644 >--- a/lib/tdb/common/io.c >+++ b/lib/tdb/common/io.c >@@ -306,10 +306,11 @@ int tdb_expand(struct tdb_context *tdb, tdb_off_t size) > /* must know about any previous expansions by another process */ > tdb->methods->tdb_oob(tdb, tdb->map_size + 1, 1); > >- /* always make room for at least 100 more records, and at >- least 25% more space. Round the database up to a multiple >+ /* always make room for at least tdb->record_number_expansion_factor more records, and at >+ least tdb->min_filesize_expansion_factor% more space. Round the database up to a multiple > of the page size */ >- new_size = MAX(tdb->map_size + size*100, tdb->map_size * 1.25); >+ new_size = MAX(tdb->map_size + size*tdb->record_number_expansion_factor, >+ tdb->map_size * tdb->min_filesize_expansion_factor); > size = TDB_ALIGN(new_size, tdb->page_size) - tdb->map_size; > > if (!(tdb->flags & TDB_INTERNAL)) >diff --git a/lib/tdb/common/open.c b/lib/tdb/common/open.c >index 49b8e85..53fee80 100644 >--- a/lib/tdb/common/open.c >+++ b/lib/tdb/common/open.c >@@ -180,6 +180,8 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, > } > > tdb->max_dead_records = (tdb_flags & TDB_VOLATILE) ? 5 : 0; >+ tdb->record_number_expansion_factor = TDB_DEFAULT_RECORD_NUMBER_EXPANSION_FACTOR; >+ tdb->min_filesize_expansion_factor = TDB_DEFAULT_MIN_FILESIZE_EXPANSION_FACTOR; > > if ((open_flags & O_ACCMODE) == O_WRONLY) { > TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: can't open tdb %s write-only\n", >@@ -405,6 +407,20 @@ void *tdb_get_logging_private(struct tdb_context *tdb) > return tdb->log.log_private; > } > >+void tdb_set_filesize_expansion_factor(struct tdb_context *tdb, >+ unsigned int record_number_expansion_factor, >+ double min_filesize_expansion_factor) >+{ >+ if (record_number_expansion_factor == 0) { >+ record_number_expansion_factor = TDB_DEFAULT_RECORD_NUMBER_EXPANSION_FACTOR; >+ } >+ tdb->record_number_expansion_factor = record_number_expansion_factor; >+ if (min_filesize_expansion_factor == 0.0) { >+ min_filesize_expansion_factor = TDB_DEFAULT_MIN_FILESIZE_EXPANSION_FACTOR; >+ } >+ tdb->min_filesize_expansion_factor = min_filesize_expansion_factor; >+} >+ > /* reopen a tdb - this can be used after a fork to ensure that we have an independent > seek pointer from our parent and to re-establish locks */ > int tdb_reopen(struct tdb_context *tdb) >diff --git a/lib/tdb/common/tdb_private.h b/lib/tdb/common/tdb_private.h >index ffac89f..4bf07cc 100644 >--- a/lib/tdb/common/tdb_private.h >+++ b/lib/tdb/common/tdb_private.h >@@ -63,6 +63,9 @@ typedef uint32_t tdb_off_t; > #define TDB_PAD_BYTE 0x42 > #define TDB_PAD_U32 0x42424242 > >+#define TDB_DEFAULT_RECORD_NUMBER_EXPANSION_FACTOR 100 >+#define TDB_DEFAULT_MIN_FILESIZE_EXPANSION_FACTOR 1.25 >+ > /* NB assumes there is a local variable called "tdb" that is the > * current context, also takes doubly-parenthesized print-style > * argument. */ >@@ -168,6 +171,8 @@ struct tdb_context { > int max_dead_records; > bool have_transaction_lock; > volatile sig_atomic_t *interrupt_sig_ptr; >+ unsigned int record_number_expansion_factor; >+ double min_filesize_expansion_factor; > }; > > >diff --git a/lib/tdb/include/tdb.h b/lib/tdb/include/tdb.h >index 94b5e36..2073b60 100644 >--- a/lib/tdb/include/tdb.h >+++ b/lib/tdb/include/tdb.h >@@ -140,6 +140,9 @@ void tdb_add_flags(struct tdb_context *tdb, unsigned flag); > void tdb_remove_flags(struct tdb_context *tdb, unsigned flag); > void tdb_enable_seqnum(struct tdb_context *tdb); > void tdb_increment_seqnum_nonblock(struct tdb_context *tdb); >+void tdb_set_filesize_expansion_factor(struct tdb_context *tdb, >+ unsigned int record_number_expansion_factor, >+ double min_filesize_expansion_factor); > > /* Low level locking functions: use with care */ > int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key); >diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c >index 141ceb1..5692671 100644 >--- a/source3/winbindd/winbindd_cache.c >+++ b/source3/winbindd/winbindd_cache.c >@@ -2547,6 +2547,7 @@ bool init_wcache(void) > return false; > } > >+ tdb_set_filesize_expansion_factor(wcache->tdb, 10, 1.0); > return true; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 7610
:
6128
|
6437