Re: autobuild: intermittent test failure detected
Hi Metze, s4-test: use standard process model for 'dc' server this provides us with both 'standard' and 'single' process models in selftest, ensuring that we test the standard process model in the build farm Pair-Programmed-With: Andrew Bartlett abart...@samba.org I fear this change made autobuild a bit more unstable I saw the following error a few times today: The change really is quite important. We have previously only been testing S4 in single mode in the build farm, which doesn't represent how real users run it. A bug was introduced in tevent a while ago which broke standard mode, and we didn't even notice. If this has made some tests less stable then we need to fix those tests. Perhaps the timing is less predictable in standard mode. I also noticed that samba4 make test needs over 1h 20 now. It has needed well over an hour for a while now. The big jump was the change to run all the s3 tests in the top level build. Cheers, Tridge
Re: TALLOC_FREE()
Hi Jelmer, It would be nice to standardize on one or the other though rather than using a strange mix of both. Should we encourage the use of TALLOC_FREE() over talloc_free() ? They are different calls. We certainly should not deprecate the use of talloc_free(). A TALLOC_FREE() only makes sense at all when the variable you are freeing is long term. If it's a stack variable then it usually makes no sense. It also loses information. As someone already pointed out, we get a nice talloc double free report when you re-use a free ptr. That report includes the location of the first free, which is encoded in the memory block. If you use TALLOC_FREE() then the 2nd free becomes allowed (as talloc_free(NULL) does not abort). You may well end up with a segfault, which is also useful, but the backtrace from the segfault gives you no idea where the first free was, as you've wiped that information with TALLOC_FREE(). I've used that double free error - first free may be at xxx.c:yyy report to find many subtle bugs. I know some people are committed to TALLOC_FREE(), and that's fine, but let's please not go so far as to deprecate the function that gives us better debugging ability. Cheers, Tridge
Re: [SCM] Samba Shared Repository - branch master updated
Author: Andrew Tridgell tri...@samba.org Date: Wed Apr 14 23:38:05 2010 +1000 Merge branch 'master' of ssh://git.samba.org/data/git/samba sorry, I forgot a --rebase on a git pull
Re: [SCM] Samba Shared Repository - branch master updated
Hi Jeremy, Would you mind reverting 38c50c7027d2a2a9a3df060b74b2a2efce4d9e6f ? We want s4 to work with older s3 systems, plus with samba based NAS boxes etc. I don't mind a config option to enable the padding, but I don't think we want this on by default. Cheers, Tridge
svn commit: samba-web r1363 - in trunk: . news
Author: tridge Date: 2010-02-05 14:48:36 -0700 (Fri, 05 Feb 2010) New Revision: 1363 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=samba-webrev=1363 Log: add response to symlink attack Added: trunk/news/symlink_attack.html Modified: trunk/index.html Changeset: Modified: trunk/index.html === --- trunk/index.html2010-02-01 18:57:40 UTC (rev 1362) +++ trunk/index.html2010-02-05 21:48:36 UTC (rev 1363) @@ -24,6 +24,12 @@ h2Latest News/h2 !--#include virtual=/samba/news/headlines.html -- +h45 February 2010/h4 +p class=headlineSamba response to reported security hole/p + +pThe Samba Team has a href=news/symlink_attack.htmlposted a +response/a to the widely reported symlink attack./p + h426 January 2010/h4 p class=headlineSamba 3.5.0rc2 Available for Download/p Added: trunk/news/symlink_attack.html === --- trunk/news/symlink_attack.html (rev 0) +++ trunk/news/symlink_attack.html 2010-02-05 21:48:36 UTC (rev 1363) @@ -0,0 +1,79 @@ +!--#include virtual=/samba/header.html -- + titleSymlink attack/title +!--#include virtual=/samba/header_columns.html -- + + +h45 February 2010/h4 +p class=headlineClaimed Zero Day exploit in Samba/p + +pA user named kcopedarookie posted what they claim to be a video +of a +zero-day a href=http://www.youtube.com/watch?v=NN50RtZ2N74aia=true;exploit +in Samba/a on youtube yesterday./p + +pThe video shows modifications to smbclient allowing +/etc/passwd to be downloaded from a remote server./p + +pThe issue is actually a default insecure configuration +in Samba./p + +h5Quick FAQ: What do I do !/h5 + +pSet: +pre + wide links = no +/pre +in the [global] section of your smb.conf and restart +smbd to eliminate this problem./p + +h5Longer FAQ: The real issue/h5 + +pThe problem comes from a combination of two features in Samba, each +of which on their own are useful to Administrators, but in combination +allow users to access any file on the system that their logged in +username has permissions to read (this is not a privilege escalation +problem)./p + +pBy default Samba ships with the parameter wide links = yes, which +allows Administrators to locally (on the server) add a symbolic link +inside an exported share which SMB/CIFS clients will follow./p + +pAs an example, given a share definition: +pre + [tmp] + path = /tmp + read only = no + guest ok = yes +/pre/p + +pThe administrator could add a symlink: + +pre + $ ln -s /etc/passwd /tmp/passwd +/pre + +and SMB/CIFS clients would then see a file called passwd within +the [tmp] share that could be read and would allow clients to read +/etc/passwd./p + +pIf the wide links parameter is set to no, any attempt +to read this file will fail with an access denied error./p + +pThe problem occurs as Samba allows clients using the UNIX +extensions (which are also turned on by default) to create +symlinks on remotely mounted shares on which they have write +access that point to any path on the file system./p + +pThis is by design, as applications running on UNIX clients may have +good reasons to create symlinks anywhere on the filesystem they have +write access that point to local files (such as /etc/passwd)./p + +pUNIX clients will resolve these links locally, but Windows +clients will resolve them on the server. It is this combination +that causes the problem./p + +pAll future versions of Samba will have the parameter wide links +set to no by default, and the manual pages will be updated to +explain this issue./p + +!--#include virtual=/samba/footer.html --
svn commit: samba-web r1364 - in trunk: .
Author: tridge Date: 2010-02-05 14:49:33 -0700 (Fri, 05 Feb 2010) New Revision: 1364 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=samba-webrev=1364 Log: fixed link Modified: trunk/index.html Changeset: Modified: trunk/index.html === --- trunk/index.html2010-02-05 21:48:36 UTC (rev 1363) +++ trunk/index.html2010-02-05 21:49:33 UTC (rev 1364) @@ -27,7 +27,7 @@ h45 February 2010/h4 p class=headlineSamba response to reported security hole/p -pThe Samba Team has a href=news/symlink_attack.htmlposted a +pThe Samba Team has a href=/samba/news/symlink_attack.htmlposted a response/a to the widely reported symlink attack./p h426 January 2010/h4
svn commit: samba-web r1365 - in trunk/news: .
Author: tridge Date: 2010-02-05 14:54:11 -0700 (Fri, 05 Feb 2010) New Revision: 1365 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=samba-webrev=1365 Log: improve layout Modified: trunk/news/symlink_attack.html Changeset: Modified: trunk/news/symlink_attack.html === --- trunk/news/symlink_attack.html 2010-02-05 21:49:33 UTC (rev 1364) +++ trunk/news/symlink_attack.html 2010-02-05 21:54:11 UTC (rev 1365) @@ -8,7 +8,7 @@ pA user named kcopedarookie posted what they claim to be a video of a -zero-day a href=http://www.youtube.com/watch?v=NN50RtZ2N74aia=true;exploit +zero-day a href=http://www.youtube.com/watch?v=NN50RtZ2N74amp;aia=true;exploit in Samba/a on youtube yesterday./p pThe video shows modifications to smbclient allowing @@ -25,6 +25,7 @@ /pre in the [global] section of your smb.conf and restart smbd to eliminate this problem./p +p/p h5Longer FAQ: The real issue/h5 @@ -38,21 +39,21 @@ allows Administrators to locally (on the server) add a symbolic link inside an exported share which SMB/CIFS clients will follow./p -pAs an example, given a share definition: +pAs an example, given a share definition:/p pre [tmp] path = /tmp read only = no guest ok = yes -/pre/p +/pre -pThe administrator could add a symlink: +pThe administrator could add a symlink:/p pre $ ln -s /etc/passwd /tmp/passwd /pre -and SMB/CIFS clients would then see a file called passwd within +pand SMB/CIFS clients would then see a file called passwd within the [tmp] share that could be read and would allow clients to read /etc/passwd./p
svn commit: samba-web r1366 - in trunk/news: .
Author: tridge Date: 2010-02-05 14:56:08 -0700 (Fri, 05 Feb 2010) New Revision: 1366 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=samba-webrev=1366 Log: improve layout2 Modified: trunk/news/symlink_attack.html Changeset: Modified: trunk/news/symlink_attack.html === --- trunk/news/symlink_attack.html 2010-02-05 21:54:11 UTC (rev 1365) +++ trunk/news/symlink_attack.html 2010-02-05 21:56:08 UTC (rev 1366) @@ -19,11 +19,11 @@ h5Quick FAQ: What do I do !/h5 -pSet: +pSet:/p pre wide links = no /pre -in the [global] section of your smb.conf and restart +pin the [global] section of your smb.conf and restart smbd to eliminate this problem./p p/p
svn commit: samba-web r1342 - in trunk/download: .
Author: tridge Date: 2009-11-17 14:40:59 -0700 (Tue, 17 Nov 2009) New Revision: 1342 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=samba-webrev=1342 Log: removed incorrect mirror list Removed: trunk/download/ftp_mirrors.html Modified: trunk/download/index.html Changeset: Deleted: trunk/download/ftp_mirrors.html === --- trunk/download/ftp_mirrors.html 2009-11-11 20:26:58 UTC (rev 1341) +++ trunk/download/ftp_mirrors.html 2009-11-17 21:40:59 UTC (rev 1342) @@ -1,12 +0,0 @@ -!--#include virtual=/samba/header.html -- - titleSamba Download Sites/title -!--#include virtual=/samba/header_wide.html -- - -h2ftp Mirror Sites/h2 - -pThe following sites are ftp mirror sites. These sites contain the source and binary distributions but not the web pages./p - -!--#include virtual=/samba/ftp_hosts.html -- - - -!--#include virtual=/samba/footer.html -- Modified: trunk/download/index.html === --- trunk/download/index.html 2009-11-11 20:26:58 UTC (rev 1341) +++ trunk/download/index.html 2009-11-17 21:40:59 UTC (rev 1342) @@ -4,8 +4,7 @@ h2Download/h2 pThe Samba source code is distributed via ftp and http. View the download -area a href=/samba/ftp/via HTTP/a. Also, see the complete list of -a href=ftp_mirrors.htmldownload mirrors/a. The file you probably want +area a href=/samba/ftp/via HTTP/a. The file you probably want is called a href=/samba/ftp/samba-latest.tar.gzsamba-latest.tar.gz/a. Old releases are available in the a href=/samba/ftp/old-versions/Samba archives/a./p @@ -34,8 +33,7 @@ td h3 align=centerBinaries/h3 Samba binaries are available for many popular platforms. You can download - them via http a href=/samba/ftp/Binary_Packageshere/a or from one of - several a href=/samba/download/ftp_mirrors.htmlmirror sites/a. Note + them via http a href=/samba/ftp/Binary_Packageshere/a. Note that the latest version may not always be available for every platform. pa href=http://enterprisesamba.com/;http://enterprisesamba.com//a
Re: root_fid changes...
Hi Metze, root_fid is a union, you can't set two union arms at the same time. It's really confusing to read this code... thanks for spotting this. The problem I was trying (and failing) to fix is the CIFS NTVFS backend, which needs to send the fnum along to the target server. I'll see if I can find the right fix. Cheers, Tridge
svn commit: samba-web r1320 - in trunk: .
Author: tridge Date: 2009-08-28 19:28:46 -0600 (Fri, 28 Aug 2009) New Revision: 1320 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=samba-webrev=1320 Log: put the local footer on the main page too Modified: trunk/redirect_us.html Changeset: Modified: trunk/redirect_us.html === --- trunk/redirect_us.html 2009-08-21 13:38:24 UTC (rev 1319) +++ trunk/redirect_us.html 2009-08-29 01:28:46 UTC (rev 1320) @@ -42,6 +42,7 @@ h4For download ftp sites:/h4 !--#include virtual=/samba/ftp_hosts.html -- /noscript +!--#include virtual=/samba/local_footer.html -- /body /html
Re: [SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-557-gd380c49
Hi Metze, tevent_loop_wait() calls tevent_loop_once() internally, see the tevent_common_loop_once() function. I missed that, though it only seems to be true for the main backends. The liboop backend doesn't call tevent_common_loop_once. We're tying ourselves in a pretty set of knots here :-) Cheers, Tridge
Re: [SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-557-gd380c49
Hi Metze, fixed a logic bug in the tevent nesting code The event nesting code never triggered as nesting.level was never greater than 1. The main event loop needs to increase the nesting level by 1. That was desired, why do you want to be called if there's no nesting? you do if (unixuid_nesting_level == 0) return; anyway. The code as it was previously would only call the hook if we had two levels of nesting. ie. it would call it when we had this: - main loop - call to event_loop_once - call to event_loop_once - calls hook It was just a simple off by 1 error, as the check was for 1, which meant it only triggered when the nesting was 2 or greater. It started at zero. If we change it to call the hook at level 0, we should change that in tevent_loop_once() and not in tevent_loop_wait(). no, because then we'll get the hook code called in top level code that calls event_loop_once, such as the smbtorture code. I also added a paranoia check to the nesting setup call. The API as currently written cannot support multiple nesting hooks, so we need to abort if multiple hooks are tried. I think we should have global in vfs_unixid.c which remembers that we already set the hook and not reset it on each tree connect. The point of that paranoia check was not for the existing vfs code, it was for future uses of that API. The API is now a public part of tevent, and may be used by other libraries or modules. The first time we used a library like that we would have had silent corruption. It would be perfectly possible to re-do the implementation of this function so that it can cope with multiple pieces of code on the same event context that need a hook (we could have a linked list of hooks). By having this paranoia check we will know when we need to re-do the implementation when we first hit this situation. Cheers, Tridge
svn commit: samba-web r1232 - in trunk/devel: .
Author: tridge Date: 2008-09-05 02:54:41 + (Fri, 05 Sep 2008) New Revision: 1232 WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=samba-webrev=1232 Log: update to copyright policy information to give copyright assignment alternative Modified: trunk/devel/copyright-policy.html trunk/devel/index.html Changeset: Modified: trunk/devel/copyright-policy.html === --- trunk/devel/copyright-policy.html 2008-08-27 18:59:58 UTC (rev 1231) +++ trunk/devel/copyright-policy.html 2008-09-05 02:54:41 UTC (rev 1232) @@ -24,4 +24,12 @@ have an interest in Samba./li /ol +h2Copyright assignment/h2 + +pIf personal copyright is not feasible for a contribution you wish + to make, then we can also accept contributions which have copyright + assigned to the Software Freedom Conservancy. Please contact a Samba + Team member for more information on copyright assignment. + + !--#include virtual=/samba/footer.html -- Modified: trunk/devel/index.html === --- trunk/devel/index.html 2008-08-27 18:59:58 UTC (rev 1231) +++ trunk/devel/index.html 2008-09-05 02:54:41 UTC (rev 1232) @@ -100,6 +100,8 @@ pPlease coordinate all development efforts on the a href=mailto:[EMAIL PROTECTED]samba-technical/a mailing list. For more information about the list, or to join the list, go to the a href=http://lists.samba.org/mailman/listinfo/samba-technical;samba technical mailing list/a page. The main samba development channel on IRC is i#samba-technical/i, server iirc.freenode.net/i. Please don't ask user questions in this channel (users see i#samba/i). Channel logs are available a href=http://irc.vernstok.nl/samba-technical.php;here/a./p +h3Copyright Policy/h3 + pAlso, please see our policy concerning a href=/samba/devel/copyright-policy.htmlcontributor copyright/a./p br /
Re: [SCM] Samba Shared Repository - branch v3-0-test updated - release-3-0-32-11-g0b39c04
Hi Simo, The msync manpage reports that msync *must* be called before munmap. Failure to do so may result in lost data. Fix an ifdef check, I really think we meant to check HAVE_MMAP here. Please revert this change immediately. That change would slow down tdb by a couple of orders or magnitude for our temporary databases. The msync map page if referring to losing data if the machine crashes before the data is flushed. If we want safety against that we should use tdb transactions, which do all the right calls (and no, just doing a msync like that is NOT enough). and please check with somebody who knows systems programming before making a change like this. Cheers, Tridge
Re: [SCM] Samba Shared Repository - branch v3-0-test updated - release-3-0-32-11-g0b39c04
Hi Simo, Please revert this change immediately. That change would slow down tdb by a couple of orders or magnitude for our temporary databases. actually this will only slow us down each time we attach/detach to the tdb or we expand it (as expand uses munmap/mmap). I guess the question is how often we expand our temporary tdb's. A simple change would be for this not to apply if TDB_CLEAR_IF_FIRST is set. Cheers, Tridge
Re: [SCM] Samba Shared Repository - branch v3-0-test updated - release-3-0-32-11-g0b39c04
Hi Simo, and please check with somebody who knows systems programming before making a change like this. also, my apologies for this. Kai and Andrew have now pointed me at the thread where you asked about this, and got an ack from Jeremy. It seems I'm not getting samba-technical email at the moment. I'm trying to find out why. Cheers, Tridge
Re: svn commit: samba r22638 - in tags: .
Jelmer, The sourceforge project with TDB and the package in Debian both use 1.0.1 as version number. I figured the support for transactions and the other improvements qualified for a new minor release. I'd vote for 2.0 - tdb has really improved a lot since the sourceforge project split off. Cheers, Tridge
Rev 692: dmapi got into a state on a test cluster where dm_get_dmattr returned in http://samba.org/~tridge/3_0-ctdb
revno: 692 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: s3-ctdb-tridge timestamp: Mon 2008-01-21 23:24:50 +1100 message: dmapi got into a state on a test cluster where dm_get_dmattr returned -1/EINVAL but it was impossible to delete the stale session, and the session still showed up in dm_getall_sessions(). This patch copes with that by changing to a new session name when the error occurs. modified: source/modules/vfs_tsmsm.c vfs_tsmsm.c-20070827024912-m3pirz28sej5g6pz-1 source/smbd/dmapi.cdmapi.c-20070210173807-1wjifrbwaz6xnmgl-1002 === modified file 'source/modules/vfs_tsmsm.c' --- a/source/modules/vfs_tsmsm.c2008-01-17 04:09:18 + +++ b/source/modules/vfs_tsmsm.c2008-01-21 12:24:50 + @@ -107,6 +107,7 @@ tsmd-attrib_name = lp_parm_talloc_string(SNUM(handle-conn), tsmsm, dmapi attribute, DM_ATTRIB_OBJECT); + talloc_steal(tsmd, tsmd-attrib_name); fres = lp_parm_const_string(SNUM(handle-conn), tsmsm, online ratio, NULL); if (fres == NULL) { @@ -139,6 +140,7 @@ dm_attrname_t dmname; int ret; const dm_sessid_t *sessionp; + char buf[1]; /* if the file has more than FILE_IS_ONLINE_RATIO of blocks available, then assume it is not offline (it may not be 100%, as it could be sparse) */ @@ -171,8 +173,17 @@ memset(dmname, 0, sizeof(dmname)); strlcpy((char *)dmname.an_chars[0], tsmd-attrib_name, sizeof(dmname.an_chars)); +again: ret = dm_get_dmattr(*sessionp, dmhandle, dmhandle_len, - DM_NO_TOKEN, dmname, 0, NULL, rlen); + DM_NO_TOKEN, dmname, sizeof(buf), buf, rlen); + + if (ret == -1 errno == EINVAL) { + DEBUG(0,(Stale DMAPI session - recreating\n)); + if (dmapi_new_session()) { + sessionp = dmapi_get_current_session(); + goto again; + } + } /* its offline if the dmapi attribute exists */ *offline = (ret == 0 || (ret == -1 errno == E2BIG)); === modified file 'source/smbd/dmapi.c' --- a/source/smbd/dmapi.c 2008-01-17 04:09:18 + +++ b/source/smbd/dmapi.c 2008-01-21 12:24:50 + @@ -48,7 +48,7 @@ #define DMAPI_TRACE 10 static dm_sessid_t samba_dmapi_session = DM_NO_SESSION; - +static unsigned session_num; /* Initialise DMAPI session. The session is persistant kernel state, @@ -63,9 +63,24 @@ dm_sessid_t *sessions = NULL; int i, err; char *version; + char *session_name; + TALLOC_CTX *tmp_ctx = talloc_new(NULL); + + if (session_num == 0) { + session_name = DMAPI_SESSION_NAME; + } else { + session_name = talloc_asprintf(tmp_ctx, %s%u, DMAPI_SESSION_NAME, + session_num); + } + if (session_name == NULL) { + DEBUG(0,(Out of memory in dmapi_init_session\n)); + talloc_free(tmp_ctx); + return -1; + } if (dm_init_service(version) 0) { DEBUG(0,(dm_init_service failed - disabling DMAPI\n)); + talloc_free(tmp_ctx); return -1; } @@ -74,10 +89,10 @@ do { dm_sessid_t *new_sessions; nsessions *= 2; - new_sessions = TALLOC_REALLOC_ARRAY(NULL, sessions, + new_sessions = TALLOC_REALLOC_ARRAY(tmp_ctx, sessions, dm_sessid_t, nsessions); if (new_sessions == NULL) { - talloc_free(sessions); + talloc_free(tmp_ctx); return -1; } sessions = new_sessions; @@ -88,14 +103,14 @@ DEBUGADD(DMAPI_TRACE, (failed to retrieve DMAPI sessions: %s\n, strerror(errno))); - talloc_free(sessions); + talloc_free(tmp_ctx); return -1; } for (i = 0; i nsessions; ++i) { err = dm_query_session(sessions[i], sizeof(buf), buf, buflen); buf[sizeof(buf) - 1] = '\0'; - if (err == 0 strcmp(DMAPI_SESSION_NAME, buf) == 0) { + if (err == 0 strcmp(session_name, buf) == 0) { samba_dmapi_session = sessions[i]; DEBUGADD(DMAPI_TRACE, (attached to existing DMAPI session @@ -104,32 +119,28 @@ } } - talloc_free(sessions); - /* No session already defined. */ if (samba_dmapi_session == DM_NO_SESSION) { - err = dm_create_session(DM_NO_SESSION
Rev 776: make ctdb dumpmemory work remotely, and dump the talloc in http://samba.org/~tridge/ctdb
revno: 776 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Tue 2008-01-22 14:22:41 +1100 message: make ctdb dumpmemory work remotely, and dump the talloc memory tree to stdout. This is much more useful than putting it in the log, and also fixes a bug where the pipe would overflow internally and cause ctdbd to lockup modified: doc/ctdb.1 ctdb.1-20070609004027-2618fsab2br6vqha-1 doc/ctdb.1.htmlctdb.1.html-20070609004024-w2r7qblwi5s3iw4a-1 doc/ctdb.1.xml ctdb.1.xml-20070608070258-bjuf7701h1qc1b05-2 server/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 tools/ctdb.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 Diff too large for email (947, the limit is 200).
Rev 775: merged 60.nfs changes from ronnie in http://samba.org/~tridge/ctdb
revno: 775 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Mon 2008-01-21 12:46:11 +1100 message: merged 60.nfs changes from ronnie modified: config/events.d/60.nfs nfs-20070601141008-hy3h4qgbk1jd2jci-1 === modified file 'config/events.d/60.nfs' --- a/config/events.d/60.nfs2008-01-16 11:06:44 + +++ b/config/events.d/60.nfs2008-01-21 01:46:11 + @@ -18,6 +18,8 @@ /bin/mkdir -p $CTDB_BASE/state/statd/ip /bin/mkdir -p $STATD_SHARED_DIRECTORY + /bin/rm -f $CTDB_BASE/state/statd/statd.restart /dev/null 2/dev/null + # make sure nfs is stopped before we start it, or it may get a bind error service nfs stop /dev/null 21 service nfslock stop /dev/null 21 @@ -68,6 +70,31 @@ ;; monitor) + # check that statd responds to rpc requests + # if statd is not running we try to restart it once and wait + # for the next monitoring event to verify if it is running or not + # if it still fails we fail and mark the node as UNHEALTHY + if [ -f $CTDB_BASE/state/statd/statd.restart ]; then + # statd was restarted, see if it came up ok + rpcinfo -u localhost 100024 1 /dev/null || { + echo ERROR: Failed to restart STATD + exit 1 + } + echo STATD successfully restarted. + /bin/rm -f $CTDB_BASE/state/statd/statd.restart + else + rpcinfo -u localhost 100024 1 /dev/null || { + RPCSTATDOPTS= + [ -n $STATD_HOSTNAME ] RPCSTATDOPTS=$RPCSTATDOPTS -n $STATD_HOSTNAME + [ -n $STATD_PORT ] RPCSTATDOPTS=$RPCSTATDOPTS -p $STATD_PORT + [ -n $STATD_OUTGOING_PORT ] RPCSTATDOPTS=$RPCSTATDOPTS -o $STATD_OUTGOING_PORT + rpc.statd $RPCSTATDOPTS + echo ERROR: STATD is not responding. Trying to restart it. [rpc.statd $RPCSTATDOPTS] + touch $CTDB_BASE/state/statd/statd.restart + } + fi + + # check that NFS responds to rpc requests ctdb_check_rpc NFS 13 3 @@ -76,7 +103,6 @@ ctdb_check_directories nfs $nfs_dirs # check that lockd responds to rpc requests - ctdb_check_rpc statd 100024 1 ctdb_check_rpc lockd 100021 1 ctdb_check_directories statd $STATD_SHARED_DIRECTORY
Rev 691: update for release in http://samba.org/~tridge/3_0-ctdb
revno: 691 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: s3-ctdb-tridge timestamp: Sat 2008-01-19 07:25:03 +1100 message: update for release modified: packaging/RHEL4-CTDB/samba.spec samba.spec-20070530192107-og9sp62ho5xuaaer-4 === modified file 'packaging/RHEL4-CTDB/samba.spec' --- a/packaging/RHEL4-CTDB/samba.spec 2008-01-08 21:53:29 + +++ b/packaging/RHEL4-CTDB/samba.spec 2008-01-18 20:25:03 + @@ -6,7 +6,7 @@ Packager: Samba Team [EMAIL PROTECTED] Name: samba Version: 3.0.25 -Release: ctdb.14 +Release: ctdb.15 Epoch:0 License: GNU GPL version 2 Group: System Environment/Daemons @@ -529,6 +529,9 @@ %endif %changelog +* Sat Jan 19 2008 : Version 3.0.25-ctdb.15 + - fixed memory leak in dmapi code + - updated to latest tdb * Wed Jan 09 2008 : Version 3.0.25-ctdb.14 - updated to new tdb from ctdb * Thu Nov 29 2007 : Version 3.0.25-ctdb.13
Rev 773: more efficient freelist allocation in http://samba.org/~tridge/ctdb
revno: 773 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Fri 2008-01-18 13:32:54 +1100 message: more efficient freelist allocation This takes advantage of the fact that we can do left merges but not right merges By allocating data from the end of the freelist entry rather than the beginning we can guarantee that if we immediately free the record again it will be merged with the previous freelist entry, reducing fragmentation modified: lib/tdb/common/freelist.c freelist.c-20070220022425-m1wibgjq7n5hahs6-4 lib/tdb/common/tdb_private.h tdb_private.h-20070220022425-m1wibgjq7n5hahs6-10 === modified file 'lib/tdb/common/freelist.c' --- a/lib/tdb/common/freelist.c 2008-01-09 22:42:44 + +++ b/lib/tdb/common/freelist.c 2008-01-18 02:32:54 + @@ -208,62 +208,61 @@ } + /* the core of tdb_allocate - called when we have decided which free list entry to use + + Note that we try to allocate by grabbing data from the end of an existing record, + not the beginning. This is so the left merge in a free is more likely to be + able to free up the record without fragmentation */ -static tdb_off_t tdb_allocate_ofs(struct tdb_context *tdb, tdb_len_t length, tdb_off_t rec_ptr, - struct list_struct *rec, tdb_off_t last_ptr) +static tdb_off_t tdb_allocate_ofs(struct tdb_context *tdb, + tdb_len_t length, tdb_off_t rec_ptr, + struct list_struct *rec, tdb_off_t last_ptr) { - struct list_struct newrec; - tdb_off_t newrec_ptr; - - memset(newrec, '\0', sizeof(newrec)); - - /* found it - now possibly split it up */ - if (rec-rec_len length + MIN_REC_SIZE) { - /* Length of left piece */ - length = TDB_ALIGN(length, TDB_ALIGNMENT); - - /* Right piece to go on free list */ - newrec.rec_len = rec-rec_len - (sizeof(*rec) + length); - newrec_ptr = rec_ptr + sizeof(*rec) + length; - - /* And left record is shortened */ - rec-rec_len = length; - } else { - newrec_ptr = 0; - } - - /* Remove allocated record from the free list */ - if (tdb_ofs_write(tdb, last_ptr, rec-next) == -1) { - return 0; - } - - /* Update header: do this before we drop alloc - lock, otherwise tdb_free() might try to - merge with us, thinking we're free. - (Thanks Jeremy Allison). */ +#define MIN_REC_SIZE (sizeof(struct list_struct) + sizeof(tdb_off_t) + 8) + + if (rec-rec_len length + MIN_REC_SIZE) { + /* we have to grab the whole record */ + + /* unlink it from the previous record */ + if (tdb_ofs_write(tdb, last_ptr, rec-next) == -1) { + return 0; + } + + /* mark it not free */ + rec-magic = TDB_MAGIC; + if (tdb_rec_write(tdb, rec_ptr, rec) == -1) { + return 0; + } + return rec_ptr; + } + + /* we're going to just shorten the existing record */ + rec-rec_len -= (length + sizeof(*rec)); + if (tdb_rec_write(tdb, rec_ptr, rec) == -1) { + return 0; + } + if (update_tailer(tdb, rec_ptr, rec) == -1) { + return 0; + } + + /* and setup the new record */ + rec_ptr += sizeof(*rec) + rec-rec_len; + + memset(rec, '\0', sizeof(*rec)); + rec-rec_len = length; rec-magic = TDB_MAGIC; + if (tdb_rec_write(tdb, rec_ptr, rec) == -1) { return 0; } - - /* Did we create new block? */ - if (newrec_ptr) { - /* Update allocated record tailer (we - shortened it). */ - if (update_tailer(tdb, rec_ptr, rec) == -1) { - return 0; - } - - /* Free new record */ - if (tdb_free(tdb, newrec_ptr, newrec) == -1) { - return 0; - } + + if (update_tailer(tdb, rec_ptr, rec) == -1) { + return 0; } - - /* all done - return the new record offset */ + return rec_ptr; } @@ -287,6 +286,7 @@ /* Extra bytes required for tailer */ length += sizeof(tdb_off_t); + length = TDB_ALIGN(length, TDB_ALIGNMENT); again: last_ptr = FREELIST_TOP; @@ -343,7 +343,8 @@ goto fail; } - newrec_ptr = tdb_allocate_ofs(tdb, length, bestfit.rec_ptr, rec, bestfit.last_ptr); + newrec_ptr = tdb_allocate_ofs(tdb, length, bestfit.rec_ptr, +
Rev 690: merge from samba4 in http://samba.org/~tridge/3_0-ctdb
revno: 690 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: s3-ctdb-tridge timestamp: Fri 2008-01-18 15:50:15 +1100 message: merge from samba4 modified: source/lib/tdb/common/freelist.c freelist.c-20070416112700-wu1jh7in2kvfbr2w-16 source/lib/tdb/common/open.c open.c-20070416112700-wu1jh7in2kvfbr2w-20 source/lib/tdb/common/tdb_private.h tdb_private.h-20070416112700-wu1jh7in2kvfbr2w-22 source/lib/tdb/common/transaction.c transaction.c-20070416112700-wu1jh7in2kvfbr2w-24 source/lib/tdb/common/traverse.c traverse.c-20070416112700-wu1jh7in2kvfbr2w-25 source/lib/tdb/docs/README readme-20070416112700-wu1jh7in2kvfbr2w-26 source/lib/tdb/include/tdb.h tdb.h-20070416112700-wu1jh7in2kvfbr2w-28 source/lib/tdb/tools/tdbtool.c tdbtool.c-20070416112700-wu1jh7in2kvfbr2w-36 Diff too large for email (259, the limit is 200).
Rev 774: merge from samba4 in http://samba.org/~tridge/ctdb
revno: 774 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Fri 2008-01-18 15:48:36 +1100 message: merge from samba4 modified: lib/tdb/common/open.c open.c-20070220022425-m1wibgjq7n5hahs6-8 lib/tdb/common/tdb.c tdb.c-20070220022425-m1wibgjq7n5hahs6-9 lib/tdb/common/tdb_private.h tdb_private.h-20070220022425-m1wibgjq7n5hahs6-10 lib/tdb/common/transaction.c transaction.c-20070220022425-m1wibgjq7n5hahs6-11 lib/tdb/common/traverse.c traverse.c-20070220022425-m1wibgjq7n5hahs6-12 lib/tdb/docs/READMEreadme-20070125040949-7t3f5zdl1q4z9hyv-98 lib/tdb/include/tdb.h tdb.h-20070125040949-7t3f5zdl1q4z9hyv-101 lib/tdb/tools/tdbtool.ctdbtool.c-20070125040949-7t3f5zdl1q4z9hyv-108 === modified file 'lib/tdb/common/open.c' --- a/lib/tdb/common/open.c 2008-01-05 06:41:41 + +++ b/lib/tdb/common/open.c 2008-01-18 04:48:36 + @@ -179,9 +179,7 @@ tdb-page_size = 0x2000; } - if (open_flags TDB_VOLATILE) { - tdb-max_dead_records = 5; - } + tdb-max_dead_records = (tdb_flags TDB_VOLATILE) ? 5 : 0; if ((open_flags O_ACCMODE) == O_WRONLY) { TDB_LOG((tdb, TDB_DEBUG_ERROR, tdb_open_ex: can't open tdb %s write-only\n, @@ -229,6 +227,7 @@ /* we need to zero database if we are the only one with it open */ if ((tdb_flags TDB_CLEAR_IF_FIRST) + (!tdb-read_only) (locked = (tdb-methods-tdb_brlock(tdb, ACTIVE_LOCK, F_WRLCK, F_SETLK, 0, 1) == 0))) { open_flags |= O_CREAT; if (ftruncate(tdb-fd, 0) == -1) { @@ -288,7 +287,6 @@ tdb-map_size = st.st_size; tdb-device = st.st_dev; tdb-inode = st.st_ino; - tdb-max_dead_records = 0; tdb_mmap(tdb); if (locked) { if (tdb-methods-tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0, 1) == -1) { === modified file 'lib/tdb/common/tdb.c' --- a/lib/tdb/common/tdb.c 2008-01-14 04:11:10 + +++ b/lib/tdb/common/tdb.c 2008-01-18 04:48:36 + @@ -743,45 +743,3 @@ tdb_unlockall(tdb); return -1; } - - -/* - validate the integrity of all tdb hash chains. Useful when debugging - */ -int tdb_validate(struct tdb_context *tdb) -{ - int h; - for (h=-1;h(int)tdb-header.hash_size;h++) { - tdb_off_t rec_ptr; - uint32_t count = 0; - if (tdb_ofs_read(tdb, TDB_HASH_TOP(h), rec_ptr) == -1) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_validate: failed ofs_read at top of hash %d\n, h)); - return -1; - } - while (rec_ptr) { - struct list_struct r; - tdb_off_t size; - - if (tdb_rec_read(tdb, rec_ptr, r) == -1) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_validate: failed rec_read h=%d rec_ptr=%u count=%u\n, -h, rec_ptr, count)); - return -1; - } - if (tdb_ofs_read(tdb, rec_ptr + sizeof(r) + r.rec_len - sizeof(tdb_off_t), size) == -1) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_validate: failed ofs_read h=%d rec_ptr=%u count=%u\n, -h, rec_ptr, count)); - return -1; - } - if (size != r.rec_len + sizeof(r)) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_validate: failed size check size=%u h=%d rec_ptr=%u count=%u\n, -size, h, rec_ptr, count)); - return -1; - } - rec_ptr = r.next; - count++; - } - } - return 0; -} - - === modified file 'lib/tdb/common/tdb_private.h' --- a/lib/tdb/common/tdb_private.h 2008-01-18 02:32:54 + +++ b/lib/tdb/common/tdb_private.h 2008-01-18 04:48:36 + @@ -177,6 +177,7 @@ int tdb_munmap(struct tdb_context *tdb); void tdb_mmap(struct tdb_context *tdb); int tdb_lock(struct tdb_context *tdb, int list, int ltype); +int tdb_lock_nonblock(struct tdb_context *tdb, int list, int ltype); int tdb_unlock(struct tdb_context *tdb, int list, int ltype); int tdb_brlock(struct tdb_context *tdb, tdb_off_t offset, int rw_type, int lck_type, int probe, size_t len); int tdb_transaction_lock(struct tdb_context *tdb, int ltype); === modified file 'lib/tdb/common/transaction.c' --- a/lib/tdb/common/transaction.c 2008-01-15 04:28:07 + +++ b/lib/tdb/common/transaction.c 2008-01-18 04:48:36 + @@ -219,9 +219,12 @@ uint8_t
Rev 769: update for release in http://samba.org/~tridge/ctdb
revno: 769 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-16 22:23:10 +1100 message: update for release modified: packaging/RPM/ctdb.specctdb.spec-20070527204758-biuh7znabuwan3zn-3 === modified file 'packaging/RPM/ctdb.spec' --- a/packaging/RPM/ctdb.spec 2008-01-15 22:47:43 + +++ b/packaging/RPM/ctdb.spec 2008-01-16 11:23:10 + @@ -5,7 +5,7 @@ Packager: Samba Team [EMAIL PROTECTED] Name: ctdb Version: 1.0 -Release: 23 +Release: 24 Epoch: 0 License: GNU GPL version 3 Group: System Environment/Daemons @@ -119,6 +119,9 @@ %{_includedir}/ctdb_private.h %changelog +* Wed Jan 16 2008 : Version 1.0.24 + - added syslog support + - documentation updates * Wed Jan 16 2008 : Version 1.0.23 - fixed a memory leak in the recoveryd - fixed a corruption bug in the new transaction code
Rev 766: the event scripts no longer need to show a date, as its done by the main ctdbd logging function in http://samba.org/~tridge/ctdb
revno: 766 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-16 22:06:44 +1100 message: the event scripts no longer need to show a date, as its done by the main ctdbd logging function modified: config/events.d/00.ctdbevents-20070529030121-04fjh63cxfh8v1pj-1 config/events.d/10.interface 10.interface-20070604050809-s21zslfirn07zjt8-1 config/events.d/50.samba samba-20070601105340-vlcvnp6euoj3zdwy-3 config/events.d/60.nfs nfs-20070601141008-hy3h4qgbk1jd2jci-1 config/events.d/61.nfstickle 61.nfstickle-20070706005204-6etuzuk8b86aoua5-1 config/functions functions-20070601105405-gajwirydr5a9zd6x-1 Diff too large for email (283, the limit is 200).
Rev 765: added syslog support, and use a pipe to catch logging from child processes to the ctdbd logging functions in http://samba.org/~tridge/ctdb
revno: 765 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-16 22:03:01 +1100 message: added syslog support, and use a pipe to catch logging from child processes to the ctdbd logging functions added: server/ctdb_logging.c ctdb_logging.c-20080116110143-ua6l03e8hednumk9-1 modified: Makefile.inmakefile.in-20061117234101-o3qt14umlg9en8z0-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 lib/util/debug.c debug.c-20070417155854-2i3crb0irl716qft-1 lib/util/debug.h debug.h-20070417155854-2i3crb0irl716qft-2 server/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 server/ctdb_server.c ctdb.c-20061127094323-t50f58d65iaao5of-2 server/ctdbd.c ctdbd.c-20070411085044-dqmhr6mfeexnyt4m-1 tests/events.d/00.test events-20070601105359-jc8p0xp6iq7phful-1 Diff too large for email (429, the limit is 200).
Rev 767: The recovery daemon does not need to be a realtime task in http://samba.org/~tridge/ctdb
revno: 767 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-16 22:08:33 +1100 message: The recovery daemon does not need to be a realtime task modified: server/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 === modified file 'server/ctdb_recoverd.c' --- a/server/ctdb_recoverd.c2008-01-15 23:23:26 + +++ b/server/ctdb_recoverd.c2008-01-16 11:08:33 + @@ -2508,6 +2508,11 @@ srandom(getpid() ^ time(NULL)); + /* the recovery daemon does not need to be realtime */ + if (ctdb-do_setsched) { + ctdb_restore_scheduler(ctdb); + } + /* initialise ctdb */ ret = ctdb_socket_connect(ctdb); if (ret != 0) {
Rev 770: fixed handling of \r from stdout of subprocesses in http://samba.org/~tridge/ctdb
revno: 770 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-16 22:40:01 +1100 message: fixed handling of \r from stdout of subprocesses modified: server/ctdb_logging.c ctdb_logging.c-20080116110143-ua6l03e8hednumk9-1 === modified file 'server/ctdb_logging.c' --- a/server/ctdb_logging.c 2008-01-16 11:16:15 + +++ b/server/ctdb_logging.c 2008-01-16 11:40:01 + @@ -106,17 +106,17 @@ uint16_t flags, void *private) { struct ctdb_context *ctdb = talloc_get_type(private, struct ctdb_context); - ssize_t n; + int n1, n2; char *p; if (!(flags EVENT_FD_READ)) { return; } - n = read(ctdb-log-pfd, ctdb-log-buf[ctdb-log-buf_used], + n1 = read(ctdb-log-pfd, ctdb-log-buf[ctdb-log-buf_used], sizeof(ctdb-log-buf) - ctdb-log-buf_used); - if (n 0) { - ctdb-log-buf_used += n; + if (n1 0) { + ctdb-log-buf_used += n1; } if (ctdb-log-buf_used == sizeof(ctdb-log-buf)) { @@ -131,10 +131,15 @@ return; } - n = (p - ctdb-log-buf)+1; - do_debug(%*.*s, (int)n, (int)n, ctdb-log-buf); - memmove(ctdb-log-buf, ctdb-log-buf+n, sizeof(ctdb-log-buf) - n); - ctdb-log-buf_used -= n; + n1 = (p - ctdb-log-buf)+1; + n2 = n1 - 1; + /* swallow \r from child processes */ + if (n2 0 ctdb-log-buf[n2-1] == '\r') { + n2--; + } + do_debug(%*.*s\n, n2, n2, ctdb-log-buf); + memmove(ctdb-log-buf, p+1, sizeof(ctdb-log-buf) - n1); + ctdb-log-buf_used -= n1; }
Rev 768: fixed two 64bit warnings in http://samba.org/~tridge/ctdb
revno: 768 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-16 22:16:15 +1100 message: fixed two 64bit warnings modified: server/ctdb_logging.c ctdb_logging.c-20080116110143-ua6l03e8hednumk9-1 === modified file 'server/ctdb_logging.c' --- a/server/ctdb_logging.c 2008-01-16 11:03:01 + +++ b/server/ctdb_logging.c 2008-01-16 11:16:15 + @@ -120,7 +120,8 @@ } if (ctdb-log-buf_used == sizeof(ctdb-log-buf)) { - do_debug(%*.*s\n, ctdb-log-buf_used, ctdb-log-buf_used, ctdb-log-buf); + do_debug(%*.*s\n, +(int)ctdb-log-buf_used, (int)ctdb-log-buf_used, ctdb-log-buf); ctdb-log-buf_used = 0; return; } @@ -131,7 +132,7 @@ } n = (p - ctdb-log-buf)+1; - do_debug(%*.*s, n, n, ctdb-log-buf); + do_debug(%*.*s, (int)n, (int)n, ctdb-log-buf); memmove(ctdb-log-buf, ctdb-log-buf+n, sizeof(ctdb-log-buf) - n); ctdb-log-buf_used -= n; }
Rev 771: cope better with large debug dumps in http://samba.org/~tridge/ctdb
revno: 771 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-16 23:06:37 +1100 message: cope better with large debug dumps modified: server/ctdb_logging.c ctdb_logging.c-20080116110143-ua6l03e8hednumk9-1 === modified file 'server/ctdb_logging.c' --- a/server/ctdb_logging.c 2008-01-16 11:40:01 + +++ b/server/ctdb_logging.c 2008-01-16 12:06:37 + @@ -119,15 +119,13 @@ ctdb-log-buf_used += n1; } - if (ctdb-log-buf_used == sizeof(ctdb-log-buf)) { - do_debug(%*.*s\n, -(int)ctdb-log-buf_used, (int)ctdb-log-buf_used, ctdb-log-buf); - ctdb-log-buf_used = 0; - return; - } - p = memchr(ctdb-log-buf, '\n', ctdb-log-buf_used); if (!p) { + if (ctdb-log-buf_used == sizeof(ctdb-log-buf)) { + do_debug(%*.*s\n, +(int)ctdb-log-buf_used, (int)ctdb-log-buf_used, ctdb-log-buf); + ctdb-log-buf_used = 0; + } return; }
Rev 687: fixed an error handling condition in the dmapi code in http://samba.org/~tridge/3_0-ctdb
revno: 687 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: s3-ctdb-tridge timestamp: Thu 2008-01-17 13:52:01 +1100 message: fixed an error handling condition in the dmapi code modified: source/smbd/dmapi.cdmapi.c-20070210173807-1wjifrbwaz6xnmgl-1002 === modified file 'source/smbd/dmapi.c' --- a/source/smbd/dmapi.c 2007-08-27 02:51:20 + +++ b/source/smbd/dmapi.c 2008-01-17 02:52:01 + @@ -228,7 +228,7 @@ if (dmapi_have_session() !attached) { attached++; if (reattach_dmapi_session() 0) { - return DM_NO_SESSION; + return NULL; } } return samba_dmapi_session; @@ -240,13 +240,17 @@ int err; dm_eventset_t events = {0}; uintnevents; - + void *session_ptr; void*dm_handle; size_t dm_handle_len; - uint32 flags = 0; - dmapi_session = *(dm_sessid_t*) dmapi_get_current_session(); + session_ptr = dmapi_get_current_session(); + if (session_ptr == NULL) { + return 0; + } + + dmapi_session = *(dm_sessid_t*)session_ptr; if (dmapi_session == DM_NO_SESSION) { return 0; }
Rev 688: Clean up the dmapi support to some extent. This should fix the memory in http://samba.org/~tridge/3_0-ctdb
revno: 688 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: s3-ctdb-tridge timestamp: Thu 2008-01-17 15:09:18 +1100 message: Clean up the dmapi support to some extent. This should fix the memory leak in the tsmsm module, and also means we now don't create a dmapi session in the main smbd parent. The interface to use the dmapi code from elsewhere in Samba is also now simplified. Other changes - allow the dmapi attribute name that tsmsm looks for to be configured. It defaults to the name that GPFS uses. - don't require a hsmscript to be specified Alexander, can you have a look at this patch and tell me if you think it's OK ? modified: source/modules/vfs_tsmsm.c vfs_tsmsm.c-20070827024912-m3pirz28sej5g6pz-1 source/smbd/dmapi.cdmapi.c-20070210173807-1wjifrbwaz6xnmgl-1002 source/smbd/server.c server.c-20070210173807-1wjifrbwaz6xnmgl-1036 Diff too large for email (483, the limit is 200).
Rev 772: merge from ronnie in http://samba.org/~tridge/ctdb
revno: 772 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Thu 2008-01-17 16:46:56 +1100 message: merge from ronnie added: server/ctdb_uptime.c ctdb_uptime.c-20080117053701-3wglusv6t83c73re-1 modified: Makefile.inmakefile.in-20061117234101-o3qt14umlg9en8z0-1 client/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 server/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 server/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 server/ctdbd.c ctdbd.c-20070411085044-dqmhr6mfeexnyt4m-1 tools/ctdb.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 revno: 728.1.23 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2008-01-17 16:37:05 +1100 message: add ctdb_uptime.c added: server/ctdb_uptime.c ctdb_uptime.c-20080117053701-3wglusv6t83c73re-1 revno: 728.1.22 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2008-01-17 11:33:23 +1100 message: add a ctdb uptime command that prints when ctdb was started and when the last recovery occured modified: Makefile.in makefile.in-20061117234101-o3qt14umlg9en8z0-1 client/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 server/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 server/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 server/ctdbd.c ctdbd.c-20070411085044-dqmhr6mfeexnyt4m-1 tools/ctdb.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 revno: 728.1.21 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Thu 2008-01-17 09:39:16 +1100 message: merge from tridge added: server/ctdb_logging.c ctdb_logging.c-20080116110143-ua6l03e8hednumk9-1 modified: Makefile.in makefile.in-20061117234101-o3qt14umlg9en8z0-1 config/events.d/00.ctdbevents-20070529030121-04fjh63cxfh8v1pj-1 config/events.d/10.interface 10.interface-20070604050809-s21zslfirn07zjt8-1 config/events.d/50.samba samba-20070601105340-vlcvnp6euoj3zdwy-3 config/events.d/60.nfs nfs-20070601141008-hy3h4qgbk1jd2jci-1 config/events.d/61.nfstickle 61.nfstickle-20070706005204-6etuzuk8b86aoua5-1 config/functions functions-20070601105405-gajwirydr5a9zd6x-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 lib/util/debug.c debug.c-20070417155854-2i3crb0irl716qft-1 lib/util/debug.h debug.h-20070417155854-2i3crb0irl716qft-2 server/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 server/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 server/ctdb_server.c ctdb.c-20061127094323-t50f58d65iaao5of-2 server/ctdbd.c ctdbd.c-20070411085044-dqmhr6mfeexnyt4m-1 tests/events.d/00.test events-20070601105359-jc8p0xp6iq7phful-1 revno: 728.1.20 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2008-01-16 14:32:29 +1100 message: merge from tridge Diff too large for email (295, the limit is 200).
Rev 689: merge from ctdb in http://samba.org/~tridge/3_0-ctdb
revno: 689 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: s3-ctdb-tridge timestamp: Thu 2008-01-17 17:07:06 +1100 message: merge from ctdb modified: source/lib/tdb/common/transaction.c transaction.c-20070416112700-wu1jh7in2kvfbr2w-24 === modified file 'source/lib/tdb/common/transaction.c' --- a/source/lib/tdb/common/transaction.c 2008-01-15 02:31:13 + +++ b/source/lib/tdb/common/transaction.c 2008-01-17 06:07:06 + @@ -316,25 +316,15 @@ return 0; } + if (blk == tdb-transaction-num_blocks-1 + off + len tdb-transaction-last_block_size) { + len = tdb-transaction-last_block_size - off; + } + /* overwrite part of an existing block */ - if (buf == NULL) { - memset(tdb-transaction-blocks[blk] + off, 0, len); - } else { - memcpy(tdb-transaction-blocks[blk] + off, buf, len); - } - if (blk == tdb-transaction-num_blocks-1) { - if (len + off tdb-transaction-last_block_size) { - tdb-transaction-last_block_size = len + off; - } - } + memcpy(tdb-transaction-blocks[blk] + off, buf, len); return 0; - -fail: - TDB_LOG((tdb, TDB_DEBUG_FATAL, transaction_write: failed at off=%d len=%d\n, -(blk*tdb-transaction-block_size) + off, len)); - tdb-transaction-transaction_error = 1; - return -1; }
Rev 761: fixed a memory leak in the recovery daemon in http://samba.org/~tridge/ctdb
revno: 761 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Tue 2008-01-15 20:11:44 +1100 message: fixed a memory leak in the recovery daemon modified: server/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 === modified file 'server/ctdb_recoverd.c' --- a/server/ctdb_recoverd.c2008-01-08 23:22:20 + +++ b/server/ctdb_recoverd.c2008-01-15 09:11:44 + @@ -756,7 +756,13 @@ } data = tdb_fetch(v-ctdb_db-ltdb-tdb, call.key); - if (data.dptr == NULL || data.dsize sizeof(struct ctdb_ltdb_header)) { + if (data.dptr == NULL) { + tdb_chainunlock(v-ctdb_db-ltdb-tdb, call.key); + continue; + } + + if (data.dsize sizeof(struct ctdb_ltdb_header)) { + free(data.dptr); tdb_chainunlock(v-ctdb_db-ltdb-tdb, call.key); continue; } @@ -764,10 +770,13 @@ hdr = (struct ctdb_ltdb_header *)data.dptr; if (hdr-dmaster == v-rec-ctdb-pnn) { /* its already local */ + free(data.dptr); tdb_chainunlock(v-ctdb_db-ltdb-tdb, call.key); continue; } + free(data.dptr); + state = ctdb_call_send(v-ctdb_db, call); tdb_chainunlock(v-ctdb_db-ltdb-tdb, call.key); if (state == NULL) {
Rev 763: update for release in http://samba.org/~tridge/ctdb
revno: 763 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-16 09:47:43 +1100 message: update for release modified: packaging/RPM/ctdb.specctdb.spec-20070527204758-biuh7znabuwan3zn-3 === modified file 'packaging/RPM/ctdb.spec' --- a/packaging/RPM/ctdb.spec 2008-01-10 23:44:16 + +++ b/packaging/RPM/ctdb.spec 2008-01-15 22:47:43 + @@ -5,7 +5,7 @@ Packager: Samba Team [EMAIL PROTECTED] Name: ctdb Version: 1.0 -Release: 22 +Release: 23 Epoch: 0 License: GNU GPL version 3 Group: System Environment/Daemons @@ -119,6 +119,12 @@ %{_includedir}/ctdb_private.h %changelog +* Wed Jan 16 2008 : Version 1.0.23 + - fixed a memory leak in the recoveryd + - fixed a corruption bug in the new transaction code + - fixed a case where an packet for a disconnected client could be processed + - added http event script + - updated documentation * Thu Jan 10 2008 : Version 1.0.22 - auto-run vacuum and repack ops * Wed Jan 09 2008 : Version 1.0.21
Rev 762: - catch a case where the client disconnects during a call in http://samba.org/~tridge/ctdb
revno: 762 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-16 09:44:48 +1100 message: - catch a case where the client disconnects during a call - track all talloc memory, using NULL context modified: server/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 server/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 server/ctdbd.c ctdbd.c-20070411085044-dqmhr6mfeexnyt4m-1 === modified file 'server/ctdb_control.c' --- a/server/ctdb_control.c 2008-01-14 21:42:12 + +++ b/server/ctdb_control.c 2008-01-15 22:44:48 + @@ -71,7 +71,7 @@ case CTDB_CONTROL_STATISTICS: { CHECK_CONTROL_DATA_SIZE(0); - ctdb-statistics.memory_used = talloc_total_size(ctdb); + ctdb-statistics.memory_used = talloc_total_size(NULL); ctdb-statistics.frozen = (ctdb-freeze_mode == CTDB_FREEZE_FROZEN); ctdb-statistics.recovering = (ctdb-recovery_mode == CTDB_RECOVERY_ACTIVE); outdata-dptr = (uint8_t *)ctdb-statistics; === modified file 'server/ctdb_daemon.c' --- a/server/ctdb_daemon.c 2008-01-14 21:42:12 + +++ b/server/ctdb_daemon.c 2008-01-15 22:44:48 + @@ -288,9 +288,37 @@ client-ctdb-statistics.pending_calls--; } - -static void daemon_request_call_from_client(struct ctdb_client *client, - struct ctdb_req_call *c); +struct ctdb_daemon_packet_wrap { + struct ctdb_context *ctdb; + uint32_t client_id; +}; + +/* + a wrapper to catch disconnected clients + */ +static void daemon_incoming_packet_wrap(void *p, struct ctdb_req_header *hdr) +{ + struct ctdb_client *client; + struct ctdb_daemon_packet_wrap *w = talloc_get_type(p, + struct ctdb_daemon_packet_wrap); + if (w == NULL) { + DEBUG(0,(__location__ Bad packet type '%s'\n, talloc_get_name(p))); + return; + } + + client = ctdb_reqid_find(w-ctdb, w-client_id, struct ctdb_client); + if (client == NULL) { + DEBUG(0,(__location__ Packet for disconnected client %u\n, +w-client_id)); + talloc_free(w); + return; + } + talloc_free(w); + + /* process it */ + daemon_incoming_packet(client, hdr); +} + /* this is called when the ctdb daemon received a ctdb request call @@ -307,6 +335,7 @@ TDB_DATA key, data; int ret; struct ctdb_context *ctdb = client-ctdb; + struct ctdb_daemon_packet_wrap *w; ctdb-statistics.total_calls++; ctdb-statistics.pending_calls++; @@ -322,15 +351,23 @@ key.dptr = c-data; key.dsize = c-keylen; + w = talloc(ctdb, struct ctdb_daemon_packet_wrap); + CTDB_NO_MEMORY_VOID(ctdb, w); + + w-ctdb = ctdb; + w-client_id = client-client_id; + ret = ctdb_ltdb_lock_fetch_requeue(ctdb_db, key, header, (struct ctdb_req_header *)c, data, - daemon_incoming_packet, client, True); + daemon_incoming_packet_wrap, w, True); if (ret == -2) { /* will retry later */ ctdb-statistics.pending_calls--; return; } + talloc_free(w); + if (ret != 0) { DEBUG(0,(__location__ Unable to fetch record\n)); ctdb-statistics.pending_calls--; === modified file 'server/ctdbd.c' --- a/server/ctdbd.c2008-01-10 03:40:56 + +++ b/server/ctdbd.c2008-01-15 22:44:48 + @@ -137,6 +137,8 @@ exit(1); } + talloc_enable_null_tracking(); + ctdb_block_signal(SIGPIPE); ev = event_context_init(NULL);
Rev 764: merge from ronnie in http://samba.org/~tridge/ctdb
recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 tools/ctdb_vacuum.c ctdb_vacuum.c-20080108053634-3zs2bdddzs4r1e1t-1 revno: 728.1.12 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2008-01-16 10:18:26 +1100 message: merge from tridge modified: packaging/RPM/ctdb.specctdb.spec-20070527204758-biuh7znabuwan3zn-3 server/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 server/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 server/ctdbd.c ctdbd.c-20070411085044-dqmhr6mfeexnyt4m-1 revno: 728.1.11 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Ronnie Sahlberg [EMAIL PROTECTED] branch nick: ctdb timestamp: Wed 2008-01-16 08:00:51 +1100 message: merge from tridge modified: lib/tdb/common/tdb.c tdb.c-20070220022425-m1wibgjq7n5hahs6-9 lib/tdb/common/transaction.c transaction.c-20070220022425-m1wibgjq7n5hahs6-11 lib/tdb/include/tdb.h tdb.h-20070125040949-7t3f5zdl1q4z9hyv-101 server/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 Diff too large for email (1209, the limit is 200).
Rev 686: merge tdb fixes from ctdb branch in http://samba.org/~tridge/3_0-ctdb
revno: 686 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: s3-ctdb-tridge timestamp: Tue 2008-01-15 13:31:13 +1100 message: merge tdb fixes from ctdb branch modified: source/lib/tdb/common/tdb.ctdb.c-20070416112700-wu1jh7in2kvfbr2w-21 source/lib/tdb/common/transaction.c transaction.c-20070416112700-wu1jh7in2kvfbr2w-24 === modified file 'source/lib/tdb/common/tdb.c' --- a/source/lib/tdb/common/tdb.c 2008-01-08 21:52:16 + +++ b/source/lib/tdb/common/tdb.c 2008-01-15 02:31:13 + @@ -715,6 +715,11 @@ goto failed; } + if (tdb_ofs_write(tdb, TDB_RECOVERY_HEAD, offset) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL,tdb_wipe_all: failed to write recovery head\n)); + goto failed; + } + /* add all the rest of the file to the freelist */ data_len = (tdb-map_size - TDB_DATA_START(tdb-header.hash_size)) - sizeof(struct list_struct); if (data_len 0) { === modified file 'source/lib/tdb/common/transaction.c' --- a/source/lib/tdb/common/transaction.c 2008-01-08 21:52:16 + +++ b/source/lib/tdb/common/transaction.c 2008-01-15 02:31:13 + @@ -87,6 +87,7 @@ */ + /* hold the context of any current transaction */ @@ -280,6 +281,63 @@ return -1; } + +/* + write while in a transaction - this varient never expands the transaction blocks, it only + updates existing blocks. This means it cannot change the recovery size +*/ +static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off, + const void *buf, tdb_len_t len) +{ + uint32_t blk; + + /* break it up into block sized chunks */ + while (len + (off % tdb-transaction-block_size) tdb-transaction-block_size) { + tdb_len_t len2 = tdb-transaction-block_size - (off % tdb-transaction-block_size); + if (transaction_write_existing(tdb, off, buf, len2) != 0) { + return -1; + } + len -= len2; + off += len2; + if (buf != NULL) { + buf = (const void *)(len2 + (const char *)buf); + } + } + + if (len == 0) { + return 0; + } + + blk = off / tdb-transaction-block_size; + off = off % tdb-transaction-block_size; + + if (tdb-transaction-num_blocks = blk || + tdb-transaction-blocks[blk] == NULL) { + return 0; + } + + /* overwrite part of an existing block */ + if (buf == NULL) { + memset(tdb-transaction-blocks[blk] + off, 0, len); + } else { + memcpy(tdb-transaction-blocks[blk] + off, buf, len); + } + if (blk == tdb-transaction-num_blocks-1) { + if (len + off tdb-transaction-last_block_size) { + tdb-transaction-last_block_size = len + off; + } + } + + return 0; + +fail: + TDB_LOG((tdb, TDB_DEBUG_FATAL, transaction_write: failed at off=%d len=%d\n, +(blk*tdb-transaction-block_size) + off, len)); + tdb-transaction-transaction_error = 1; + return -1; +} + + /* accelerated hash chain head search, using the cached hash heads */ @@ -629,6 +687,10 @@ TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_recovery_allocate: failed to write recovery head\n)); return -1; } + if (transaction_write_existing(tdb, TDB_RECOVERY_HEAD, recovery_head, sizeof(tdb_off_t)) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_recovery_allocate: failed to write recovery head\n)); + return -1; + } return 0; } @@ -726,6 +788,12 @@ tdb-ecode = TDB_ERR_IO; return -1; } + if (transaction_write_existing(tdb, recovery_offset, data, sizeof(*rec) + recovery_size) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_transaction_setup_recovery: failed to write secondary recovery data\n)); + free(data); + tdb-ecode = TDB_ERR_IO; + return -1; + } /* as we don't have ordered writes, we have to sync the recovery data before we update the magic to indicate that the recovery @@ -747,6 +815,11 @@ tdb-ecode = TDB_ERR_IO; return -1; } + if (transaction_write_existing(tdb, *magic_offset, magic, sizeof(magic)) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_transaction_setup_recovery: failed to write secondary recovery magic\n)); + tdb-ecode = TDB_ERR_IO; + return -1; + } /* ensure the recovery magic marker is on disk */ if (transaction_sync(tdb, *magic_offset, sizeof(magic)) == -1) { @@ -778,6 +851,7
Rev 686: merge tdb fixes from ctdb branch in http://samba.org/~tridge/3_0-ctdb
revno: 686 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: s3-ctdb-tridge timestamp: Tue 2008-01-15 13:31:13 +1100 message: merge tdb fixes from ctdb branch modified: source/lib/tdb/common/tdb.ctdb.c-20070416112700-wu1jh7in2kvfbr2w-21 source/lib/tdb/common/transaction.c transaction.c-20070416112700-wu1jh7in2kvfbr2w-24 === modified file 'source/lib/tdb/common/tdb.c' --- a/source/lib/tdb/common/tdb.c 2008-01-08 21:52:16 + +++ b/source/lib/tdb/common/tdb.c 2008-01-15 02:31:13 + @@ -715,6 +715,11 @@ goto failed; } + if (tdb_ofs_write(tdb, TDB_RECOVERY_HEAD, offset) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL,tdb_wipe_all: failed to write recovery head\n)); + goto failed; + } + /* add all the rest of the file to the freelist */ data_len = (tdb-map_size - TDB_DATA_START(tdb-header.hash_size)) - sizeof(struct list_struct); if (data_len 0) { === modified file 'source/lib/tdb/common/transaction.c' --- a/source/lib/tdb/common/transaction.c 2008-01-08 21:52:16 + +++ b/source/lib/tdb/common/transaction.c 2008-01-15 02:31:13 + @@ -87,6 +87,7 @@ */ + /* hold the context of any current transaction */ @@ -280,6 +281,63 @@ return -1; } + +/* + write while in a transaction - this varient never expands the transaction blocks, it only + updates existing blocks. This means it cannot change the recovery size +*/ +static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off, + const void *buf, tdb_len_t len) +{ + uint32_t blk; + + /* break it up into block sized chunks */ + while (len + (off % tdb-transaction-block_size) tdb-transaction-block_size) { + tdb_len_t len2 = tdb-transaction-block_size - (off % tdb-transaction-block_size); + if (transaction_write_existing(tdb, off, buf, len2) != 0) { + return -1; + } + len -= len2; + off += len2; + if (buf != NULL) { + buf = (const void *)(len2 + (const char *)buf); + } + } + + if (len == 0) { + return 0; + } + + blk = off / tdb-transaction-block_size; + off = off % tdb-transaction-block_size; + + if (tdb-transaction-num_blocks = blk || + tdb-transaction-blocks[blk] == NULL) { + return 0; + } + + /* overwrite part of an existing block */ + if (buf == NULL) { + memset(tdb-transaction-blocks[blk] + off, 0, len); + } else { + memcpy(tdb-transaction-blocks[blk] + off, buf, len); + } + if (blk == tdb-transaction-num_blocks-1) { + if (len + off tdb-transaction-last_block_size) { + tdb-transaction-last_block_size = len + off; + } + } + + return 0; + +fail: + TDB_LOG((tdb, TDB_DEBUG_FATAL, transaction_write: failed at off=%d len=%d\n, +(blk*tdb-transaction-block_size) + off, len)); + tdb-transaction-transaction_error = 1; + return -1; +} + + /* accelerated hash chain head search, using the cached hash heads */ @@ -629,6 +687,10 @@ TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_recovery_allocate: failed to write recovery head\n)); return -1; } + if (transaction_write_existing(tdb, TDB_RECOVERY_HEAD, recovery_head, sizeof(tdb_off_t)) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_recovery_allocate: failed to write recovery head\n)); + return -1; + } return 0; } @@ -726,6 +788,12 @@ tdb-ecode = TDB_ERR_IO; return -1; } + if (transaction_write_existing(tdb, recovery_offset, data, sizeof(*rec) + recovery_size) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_transaction_setup_recovery: failed to write secondary recovery data\n)); + free(data); + tdb-ecode = TDB_ERR_IO; + return -1; + } /* as we don't have ordered writes, we have to sync the recovery data before we update the magic to indicate that the recovery @@ -747,6 +815,11 @@ tdb-ecode = TDB_ERR_IO; return -1; } + if (transaction_write_existing(tdb, *magic_offset, magic, sizeof(magic)) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_transaction_setup_recovery: failed to write secondary recovery magic\n)); + tdb-ecode = TDB_ERR_IO; + return -1; + } /* ensure the recovery magic marker is on disk */ if (transaction_sync(tdb, *magic_offset, sizeof(magic)) == -1) { @@ -778,6 +851,7
Rev 686: merge tdb fixes from ctdb branch in http://samba.org/~tridge/3_0-ctdb
revno: 686 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: s3-ctdb-tridge timestamp: Tue 2008-01-15 13:31:13 +1100 message: merge tdb fixes from ctdb branch modified: source/lib/tdb/common/tdb.ctdb.c-20070416112700-wu1jh7in2kvfbr2w-21 source/lib/tdb/common/transaction.c transaction.c-20070416112700-wu1jh7in2kvfbr2w-24 === modified file 'source/lib/tdb/common/tdb.c' --- a/source/lib/tdb/common/tdb.c 2008-01-08 21:52:16 + +++ b/source/lib/tdb/common/tdb.c 2008-01-15 02:31:13 + @@ -715,6 +715,11 @@ goto failed; } + if (tdb_ofs_write(tdb, TDB_RECOVERY_HEAD, offset) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL,tdb_wipe_all: failed to write recovery head\n)); + goto failed; + } + /* add all the rest of the file to the freelist */ data_len = (tdb-map_size - TDB_DATA_START(tdb-header.hash_size)) - sizeof(struct list_struct); if (data_len 0) { === modified file 'source/lib/tdb/common/transaction.c' --- a/source/lib/tdb/common/transaction.c 2008-01-08 21:52:16 + +++ b/source/lib/tdb/common/transaction.c 2008-01-15 02:31:13 + @@ -87,6 +87,7 @@ */ + /* hold the context of any current transaction */ @@ -280,6 +281,63 @@ return -1; } + +/* + write while in a transaction - this varient never expands the transaction blocks, it only + updates existing blocks. This means it cannot change the recovery size +*/ +static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off, + const void *buf, tdb_len_t len) +{ + uint32_t blk; + + /* break it up into block sized chunks */ + while (len + (off % tdb-transaction-block_size) tdb-transaction-block_size) { + tdb_len_t len2 = tdb-transaction-block_size - (off % tdb-transaction-block_size); + if (transaction_write_existing(tdb, off, buf, len2) != 0) { + return -1; + } + len -= len2; + off += len2; + if (buf != NULL) { + buf = (const void *)(len2 + (const char *)buf); + } + } + + if (len == 0) { + return 0; + } + + blk = off / tdb-transaction-block_size; + off = off % tdb-transaction-block_size; + + if (tdb-transaction-num_blocks = blk || + tdb-transaction-blocks[blk] == NULL) { + return 0; + } + + /* overwrite part of an existing block */ + if (buf == NULL) { + memset(tdb-transaction-blocks[blk] + off, 0, len); + } else { + memcpy(tdb-transaction-blocks[blk] + off, buf, len); + } + if (blk == tdb-transaction-num_blocks-1) { + if (len + off tdb-transaction-last_block_size) { + tdb-transaction-last_block_size = len + off; + } + } + + return 0; + +fail: + TDB_LOG((tdb, TDB_DEBUG_FATAL, transaction_write: failed at off=%d len=%d\n, +(blk*tdb-transaction-block_size) + off, len)); + tdb-transaction-transaction_error = 1; + return -1; +} + + /* accelerated hash chain head search, using the cached hash heads */ @@ -629,6 +687,10 @@ TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_recovery_allocate: failed to write recovery head\n)); return -1; } + if (transaction_write_existing(tdb, TDB_RECOVERY_HEAD, recovery_head, sizeof(tdb_off_t)) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_recovery_allocate: failed to write recovery head\n)); + return -1; + } return 0; } @@ -726,6 +788,12 @@ tdb-ecode = TDB_ERR_IO; return -1; } + if (transaction_write_existing(tdb, recovery_offset, data, sizeof(*rec) + recovery_size) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_transaction_setup_recovery: failed to write secondary recovery data\n)); + free(data); + tdb-ecode = TDB_ERR_IO; + return -1; + } /* as we don't have ordered writes, we have to sync the recovery data before we update the magic to indicate that the recovery @@ -747,6 +815,11 @@ tdb-ecode = TDB_ERR_IO; return -1; } + if (transaction_write_existing(tdb, *magic_offset, magic, sizeof(magic)) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, tdb_transaction_setup_recovery: failed to write secondary recovery magic\n)); + tdb-ecode = TDB_ERR_IO; + return -1; + } /* ensure the recovery magic marker is on disk */ if (transaction_sync(tdb, *magic_offset, sizeof(magic)) == -1) { @@ -778,6 +851,7
Rev 760: minor fix to transaction_write_existing in http://samba.org/~tridge/ctdb
revno: 760 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Tue 2008-01-15 15:28:07 +1100 message: minor fix to transaction_write_existing modified: lib/tdb/common/transaction.c transaction.c-20070220022425-m1wibgjq7n5hahs6-11 === modified file 'lib/tdb/common/transaction.c' --- a/lib/tdb/common/transaction.c 2008-01-14 04:11:10 + +++ b/lib/tdb/common/transaction.c 2008-01-15 04:28:07 + @@ -316,25 +316,15 @@ return 0; } + if (blk == tdb-transaction-num_blocks-1 + off + len tdb-transaction-last_block_size) { + len = tdb-transaction-last_block_size - off; + } + /* overwrite part of an existing block */ - if (buf == NULL) { - memset(tdb-transaction-blocks[blk] + off, 0, len); - } else { - memcpy(tdb-transaction-blocks[blk] + off, buf, len); - } - if (blk == tdb-transaction-num_blocks-1) { - if (len + off tdb-transaction-last_block_size) { - tdb-transaction-last_block_size = len + off; - } - } + memcpy(tdb-transaction-blocks[blk] + off, buf, len); return 0; - -fail: - TDB_LOG((tdb, TDB_DEBUG_FATAL, transaction_write: failed at off=%d len=%d\n, -(blk*tdb-transaction-block_size) + off, len)); - tdb-transaction-transaction_error = 1; - return -1; }
Rev 758: fixed the bug that caused tdbtorture to fail in http://samba.org/~tridge/ctdb
revno: 758 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Mon 2008-01-14 15:11:10 +1100 message: fixed the bug that caused tdbtorture to fail It was an error in the new transaction code modified: lib/tdb/common/tdb.c tdb.c-20070220022425-m1wibgjq7n5hahs6-9 lib/tdb/common/transaction.c transaction.c-20070220022425-m1wibgjq7n5hahs6-11 lib/tdb/include/tdb.h tdb.h-20070125040949-7t3f5zdl1q4z9hyv-101 Diff too large for email (203, the limit is 200).
Rev 758: fixed the bug that caused tdbtorture to fail in http://samba.org/~tridge/ctdb
revno: 758 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Mon 2008-01-14 15:11:10 +1100 message: fixed the bug that caused tdbtorture to fail It was an error in the new transaction code modified: lib/tdb/common/tdb.c tdb.c-20070220022425-m1wibgjq7n5hahs6-9 lib/tdb/common/transaction.c transaction.c-20070220022425-m1wibgjq7n5hahs6-11 lib/tdb/include/tdb.h tdb.h-20070125040949-7t3f5zdl1q4z9hyv-101 Diff too large for email (203, the limit is 200).
Rev 751: add a max runtime switch to ctdb tool in http://samba.org/~tridge/ctdb
revno: 751 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Thu 2008-01-10 08:04:54 +1100 message: add a max runtime switch to ctdb tool modified: tools/ctdb.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 === modified file 'tools/ctdb.c' --- a/tools/ctdb.c 2008-01-08 12:02:43 + +++ b/tools/ctdb.c 2008-01-09 21:04:54 + @@ -33,6 +33,7 @@ int timelimit; uint32_t pnn; int machinereadable; + int maxruntime; } options; #define TIMELIMIT() timeval_current_ofs(options.timelimit, 0) @@ -1094,6 +1095,12 @@ } +static void ctdb_alarm(int sig) +{ + printf(Maximum runtime exceeded - exiting\n); + _exit(0); +} + /* main program */ @@ -1107,6 +1114,7 @@ { timelimit, 't', POPT_ARG_INT, options.timelimit, 0, timelimit, integer }, { node, 'n', POPT_ARG_STRING, nodestring, 0, node, integer|all }, { machinereadable, 'Y', POPT_ARG_NONE, options.machinereadable, 0, enable machinereadable output, NULL }, + { maxruntime, 'T', POPT_ARG_INT, options.maxruntime, 0, die if runtime exceeds this limit (in seconds), integer }, POPT_TABLEEND }; int opt; @@ -1120,6 +1128,7 @@ setlinebuf(stdout); /* set some defaults */ + options.maxruntime = 0; options.timelimit = 3; options.pnn = CTDB_CURRENT_NODE; @@ -1145,6 +1154,11 @@ usage(); } + if (options.maxruntime != 0) { + signal(SIGALRM, ctdb_alarm); + alarm(options.maxruntime); + } + /* setup the node number to contact */ if (nodestring != NULL) { if (strcmp(nodestring, all) == 0) {
Rev 752: tdb_freelist_size was reporting 1 more than correct size in http://samba.org/~tridge/ctdb
revno: 752 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Thu 2008-01-10 09:42:44 +1100 message: tdb_freelist_size was reporting 1 more than correct size modified: lib/tdb/common/freelist.c freelist.c-20070220022425-m1wibgjq7n5hahs6-4 === modified file 'lib/tdb/common/freelist.c' --- a/lib/tdb/common/freelist.c 2008-01-09 04:33:10 + +++ b/lib/tdb/common/freelist.c 2008-01-09 22:42:44 + @@ -372,9 +372,8 @@ } ptr = FREELIST_TOP; - while (ptr != 0 tdb_ofs_read(tdb, ptr, ptr) == 0) { + while (tdb_ofs_read(tdb, ptr, ptr) == 0 ptr != 0) { count++; - } tdb_unlock(tdb, -1, F_RDLCK);
Rev 754: auto-run the vacuum and repack ops every 5 minutes by default in http://samba.org/~tridge/ctdb
revno: 754 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Thu 2008-01-10 10:04:03 +1100 message: auto-run the vacuum and repack ops every 5 minutes by default modified: config/events.d/00.ctdbevents-20070529030121-04fjh63cxfh8v1pj-1 === modified file 'config/events.d/00.ctdb' --- a/config/events.d/00.ctdb 2007-10-29 01:34:45 + +++ b/config/events.d/00.ctdb 2008-01-09 23:04:03 + @@ -18,6 +18,18 @@ cmd=$1 shift +# set default samba cleanup period - in minutes +[ -z $CTDB_VACUUM_PERIOD ] { +CTDB_VACUUM_PERIOD=5 +} + +### +# periodic vacuum function +periodic_vacuum() { +# this cleans up dead records and repacks the databases +( time ctdb vacuum 20 -T 30; time ctdb repack -T 30 ) $CTDB_BASE/state/vacuum.log 21 +} + case $cmd in startup) # make sure we have a blank state directory for the scripts to work with @@ -33,6 +45,19 @@ echo `date` Set $varname to $value done || exit 1 ;; + +monitor) + # Create a dummy file to track when we need to do periodic cleanup + # of samba databases + [ -f $CTDB_BASE/state/periodic_vacuum ] || { + touch $CTDB_BASE/state/periodic_vacuum + } + [ `/usr/bin/find $CTDB_BASE/state/periodic_vacuum -mmin +$CTDB_VACUUM_PERIOD | wc -l` -eq 1 ] { + # vacuum the databases + touch $CTDB_BASE/state/periodic_vacuum + periodic_vacuum + } + esac # all OK
Rev 755: increase version number in http://samba.org/~tridge/ctdb
revno: 755 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Thu 2008-01-10 10:05:33 +1100 message: increase version number modified: packaging/RPM/ctdb.specctdb.spec-20070527204758-biuh7znabuwan3zn-3 === modified file 'packaging/RPM/ctdb.spec' --- a/packaging/RPM/ctdb.spec 2008-01-08 21:29:19 + +++ b/packaging/RPM/ctdb.spec 2008-01-09 23:05:33 + @@ -5,7 +5,7 @@ Packager: Samba Team [EMAIL PROTECTED] Name: ctdb Version: 1.0 -Release: 21 +Release: 22 Epoch: 0 License: GNU GPL version 3 Group: System Environment/Daemons @@ -118,6 +118,8 @@ %{_includedir}/ctdb_private.h %changelog +* Thu Jan 10 2008 : Version 1.0.22 + - auto-run vacuum and repack ops * Wed Jan 09 2008 : Version 1.0.21 - added ctdb vacuum and ctdb repack code * Sun Jan 06 2008 : Version 1.0.20
Rev 685: merge tdb from ctdbd in http://samba.org/~tridge/3_0-ctdb
revno: 685 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: s3-ctdb-tridge timestamp: Thu 2008-01-10 09:45:02 +1100 message: merge tdb from ctdbd modified: source/lib/tdb/common/freelist.c freelist.c-20070416112700-wu1jh7in2kvfbr2w-16 === modified file 'source/lib/tdb/common/freelist.c' --- a/source/lib/tdb/common/freelist.c 2008-01-08 21:52:16 + +++ b/source/lib/tdb/common/freelist.c 2008-01-09 22:45:02 + @@ -280,6 +280,7 @@ tdb_off_t rec_ptr, last_ptr; tdb_len_t rec_len; } bestfit; + float multiplier = 1.0; if (tdb_lock(tdb, -1, F_WRLCK) == -1) return 0; @@ -314,13 +315,27 @@ bestfit.rec_len = rec-rec_len; bestfit.rec_ptr = rec_ptr; bestfit.last_ptr = last_ptr; - break; } } /* move to the next record */ last_ptr = rec_ptr; rec_ptr = rec-next; + + /* if we've found a record that is big enough, then + stop searching if its also not too big. The + definition of 'too big' changes as we scan + through */ + if (bestfit.rec_len 0 + bestfit.rec_len length * multiplier) { + break; + } + + /* this multiplier means we only extremely rarely + search more than 50 or so records. At 50 records we + accept records up to 11 times larger than what we + want */ + multiplier *= 1.05; } if (bestfit.rec_ptr != 0) { @@ -357,9 +372,8 @@ } ptr = FREELIST_TOP; - while (ptr != 0 tdb_ofs_read(tdb, ptr, ptr) == 0) { + while (tdb_ofs_read(tdb, ptr, ptr) == 0 ptr != 0) { count++; - } tdb_unlock(tdb, -1, F_RDLCK);
Rev 753: block alarm signals during critical sections of vacuum in http://samba.org/~tridge/ctdb
revno: 753 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Thu 2008-01-10 09:43:14 +1100 message: block alarm signals during critical sections of vacuum modified: common/ctdb_util.c ctdb_util.c-20061128065342-to93h6eejj5kon81-3 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 server/ctdbd.c ctdbd.c-20070411085044-dqmhr6mfeexnyt4m-1 tools/ctdb_vacuum.cctdb_vacuum.c-20080108053634-3zs2bdddzs4r1e1t-1 === modified file 'common/ctdb_util.c' --- a/common/ctdb_util.c2007-09-21 02:24:02 + +++ b/common/ctdb_util.c2008-01-09 22:43:14 + @@ -22,6 +22,7 @@ #include lib/tdb/include/tdb.h #include system/network.h #include system/filesys.h +#include system/wait.h #include ../include/ctdb_private.h int LogLevel; @@ -340,3 +341,21 @@ { return ctdb_same_ip(ip1, ip2) ip1-sin_port == ip2-sin_port; } + + + +void ctdb_block_signal(int signum) +{ + sigset_t set; + sigemptyset(set); + sigaddset(set,signum); + sigprocmask(SIG_BLOCK,set,NULL); +} + +void ctdb_unblock_signal(int signum) +{ + sigset_t set; + sigemptyset(set); + sigaddset(set,signum); + sigprocmask(SIG_UNBLOCK,set,NULL); +} === modified file 'include/ctdb_private.h' --- a/include/ctdb_private.h2008-01-08 10:28:42 + +++ b/include/ctdb_private.h2008-01-09 22:43:14 + @@ -1209,5 +1209,7 @@ int32_t ctdb_control_delete_record(struct ctdb_context *ctdb, TDB_DATA indata); +void ctdb_block_signal(int signum); +void ctdb_unblock_signal(int signum); #endif === modified file 'server/ctdbd.c' --- a/server/ctdbd.c2007-11-29 21:44:34 + +++ b/server/ctdbd.c2008-01-09 22:43:14 + @@ -26,18 +26,6 @@ #include cmdline.h #include ../include/ctdb_private.h -static void block_signal(int signum) -{ - struct sigaction act; - - memset(act, 0, sizeof(act)); - - act.sa_handler = SIG_IGN; - sigemptyset(act.sa_mask); - sigaddset(act.sa_mask, signum); - sigaction(signum, act, NULL); -} - static struct { const char *nlist; const char *transport; @@ -149,7 +137,7 @@ exit(1); } - block_signal(SIGPIPE); + ctdb_block_signal(SIGPIPE); ev = event_context_init(NULL); === modified file 'tools/ctdb_vacuum.c' --- a/tools/ctdb_vacuum.c 2008-01-08 21:28:18 + +++ b/tools/ctdb_vacuum.c 2008-01-09 22:43:14 + @@ -208,7 +208,9 @@ return 0; } + ctdb_block_signal(SIGALRM); tdb_delete(ctdb_db-ltdb-tdb, key); + ctdb_unblock_signal(SIGALRM); tdb_chainunlock(ctdb_db-ltdb-tdb, key); free(data.dptr);
Rev 756: exponential backoff in health monitoring for faster startup in http://samba.org/~tridge/ctdb
revno: 756 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Thu 2008-01-10 14:40:56 +1100 message: exponential backoff in health monitoring for faster startup modified: include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 server/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 server/ctdb_monitor.c ctdb_monitor.c-20070518100625-8jf4ft1mjzmb22ck-1 server/ctdb_tunables.c ctdb_tunables.c-20070604095258-4m34d7cm1qa7yos9-1 server/ctdbd.c ctdbd.c-20070411085044-dqmhr6mfeexnyt4m-1 Diff too large for email (271, the limit is 200).
Rev 757: get rid of monitor_retry as well in http://samba.org/~tridge/ctdb
revno: 757 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Thu 2008-01-10 14:49:43 +1100 message: get rid of monitor_retry as well modified: include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 server/ctdb_monitor.c ctdb_monitor.c-20070518100625-8jf4ft1mjzmb22ck-1 === modified file 'include/ctdb_private.h' --- a/include/ctdb_private.h2008-01-10 03:40:56 + +++ b/include/ctdb_private.h2008-01-10 03:49:43 + @@ -80,7 +80,6 @@ uint32_t election_timeout; uint32_t takeover_timeout; uint32_t monitor_interval; - uint32_t monitor_retry; uint32_t tickle_update_interval; uint32_t script_timeout; uint32_t recovery_grace_period; === modified file 'server/ctdb_monitor.c' --- a/server/ctdb_monitor.c 2008-01-10 03:40:56 + +++ b/server/ctdb_monitor.c 2008-01-10 03:49:43 + @@ -189,8 +189,9 @@ if (ret != 0) { DEBUG(0,(Unable to launch monitor event script\n)); + ctdb-monitor-next_interval = 1; event_add_timed(ctdb-ev, ctdb-monitor-monitor_context, - timeval_current_ofs(ctdb-tunable.monitor_retry, 0), + timeval_current_ofs(1, 0), ctdb_check_health, ctdb); } } @@ -253,7 +254,7 @@ CTDB_NO_MEMORY_FATAL(ctdb, te); te = event_add_timed(ctdb-ev, ctdb-monitor-monitor_context, -timeval_current_ofs(ctdb-tunable.monitor_retry, 0), +timeval_current_ofs(1, 0), ctdb_check_health, ctdb); CTDB_NO_MEMORY_FATAL(ctdb, te);
Rev 738: ensure the recovery daemon is not clagged up by vacuum calls in http://samba.org/~tridge/ctdb
revno: 738 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Tue 2008-01-08 21:28:42 +1100 message: ensure the recovery daemon is not clagged up by vacuum calls modified: client/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 server/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 tools/ctdb_vacuum.cctdb_vacuum.c-20080108053634-3zs2bdddzs4r1e1t-1 Diff too large for email (330, the limit is 200).
Rev 740: this is not an error - it just means the record was busy in http://samba.org/~tridge/ctdb
revno: 740 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Tue 2008-01-08 22:36:44 +1100 message: this is not an error - it just means the record was busy modified: tools/ctdb_vacuum.cctdb_vacuum.c-20080108053634-3zs2bdddzs4r1e1t-1 === modified file 'tools/ctdb_vacuum.c' --- a/tools/ctdb_vacuum.c 2008-01-08 10:28:42 + +++ b/tools/ctdb_vacuum.c 2008-01-08 11:36:44 + @@ -78,7 +78,6 @@ event_loop_once(ctdb-ev); } if (data-fail_count != 0) { - DEBUG(0,(Async wait failed - fail_count=%u\n, data-fail_count)); return -1; } return 0;
Rev 741: nicer outut from repack and vacuum in http://samba.org/~tridge/ctdb
revno: 741 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Tue 2008-01-08 23:02:43 +1100 message: nicer outut from repack and vacuum modified: tools/ctdb.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 tools/ctdb_vacuum.cctdb_vacuum.c-20080108053634-3zs2bdddzs4r1e1t-1 === modified file 'tools/ctdb.c' --- a/tools/ctdb.c 2008-01-08 06:23:27 + +++ b/tools/ctdb.c 2008-01-08 12:02:43 + @@ -1117,6 +1117,8 @@ struct event_context *ev; const char *control; + setlinebuf(stdout); + /* set some defaults */ options.timelimit = 3; options.pnn = CTDB_CURRENT_NODE; === modified file 'tools/ctdb_vacuum.c' --- a/tools/ctdb_vacuum.c 2008-01-08 11:36:44 + +++ b/tools/ctdb_vacuum.c 2008-01-08 12:02:43 + @@ -128,7 +128,8 @@ /* vacuum one record */ -static int ctdb_vacuum_one(struct ctdb_context *ctdb, TDB_DATA key, struct ctdb_db_context *ctdb_db) +static int ctdb_vacuum_one(struct ctdb_context *ctdb, TDB_DATA key, + struct ctdb_db_context *ctdb_db, uint32_t *count) { TDB_DATA data; struct ctdb_ltdb_header *hdr; @@ -211,6 +212,8 @@ tdb_chainunlock(ctdb_db-ltdb-tdb, key); free(data.dptr); + (*count)++; + return 0; } @@ -219,7 +222,7 @@ vacuum records for which we are the lmaster */ static int ctdb_vacuum_local(struct ctdb_context *ctdb, struct ctdb_control_pulldb_reply *list, -struct ctdb_db_context *ctdb_db) +struct ctdb_db_context *ctdb_db, uint32_t *count) { struct ctdb_rec_data *r; int i; @@ -232,7 +235,7 @@ TDB_DATA key; key.dptr = r-data[0]; key.dsize = r-keylen; - if (ctdb_vacuum_one(ctdb, key, ctdb_db) != 0) { + if (ctdb_vacuum_one(ctdb, key, ctdb_db, count) != 0) { return -1; } } @@ -374,11 +377,11 @@ continue; } - printf(Found %u records for lmaster %u\n, vdata-list[i]-count, i); - /* for records where we are not the lmaster, tell the lmaster to fetch the record */ if (ctdb-vnn_map-map[i] != ctdb-pnn) { TDB_DATA data; + printf(Found %u records for lmaster %u in '%s'\n, vdata-list[i]-count, i, name); + data.dsize = talloc_get_size(vdata-list[i]); data.dptr = (void *)vdata-list[i]; if (ctdb_send_message(ctdb, ctdb-vnn_map-map[i], CTDB_SRVID_VACUUM_FETCH, data) != 0) { @@ -389,13 +392,24 @@ } continue; } + } + + for (i=0;ictdb-vnn_map-size;i++) { + uint32_t count = 0; + + if (vdata-list[i]-count == 0) { + continue; + } /* for records where we are the lmaster, we can try to delete them */ - if (ctdb_vacuum_local(ctdb, vdata-list[i], ctdb_db) != 0) { + if (ctdb_vacuum_local(ctdb, vdata-list[i], ctdb_db, count) != 0) { DEBUG(0,(__location__ Deletion error in vacuuming '%s'\n, name)); talloc_free(vdata); return -1; } + if (count != 0) { + printf(Deleted %u records on this node from '%s'\n, count, name); + } } /* this ensures we run our event queue */ @@ -576,7 +590,7 @@ return 0; } - DEBUG(0,(Repacking %s with %u freelist entries\n, name, size)); + printf(Repacking %s with %u freelist entries\n, name, size); if (ctdb_repack_tdb(ctdb_db-ltdb-tdb) != 0) { DEBUG(0,(__location__ Failed to repack '%s'\n, name));
Rev 739: ensure the main daemon doesn't use a blocking lock on the freelist in http://samba.org/~tridge/ctdb
revno: 739 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Tue 2008-01-08 22:31:48 +1100 message: ensure the main daemon doesn't use a blocking lock on the freelist modified: server/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 === modified file 'server/ctdb_recover.c' --- a/server/ctdb_recover.c 2008-01-08 06:23:27 + +++ b/server/ctdb_recover.c 2008-01-08 11:31:48 + @@ -647,6 +647,11 @@ struct ctdb_db_context *ctdb_db; TDB_DATA key, data; struct ctdb_ltdb_header *hdr, *hdr2; + + /* these are really internal tdb functions - but we need them here for + non-blocking lock of the freelist */ + int tdb_lock_nonblock(struct tdb_context *tdb, int list, int ltype); + int tdb_unlock(struct tdb_context *tdb, int list, int ltype); if (indata.dsize sizeof(uint32_t) || indata.dsize != rec-length) { DEBUG(0,(__location__ Bad record size in ctdb_control_delete_record\n)); @@ -688,8 +693,11 @@ } if (data.dsize sizeof(struct ctdb_ltdb_header)) { - tdb_delete(ctdb_db-ltdb-tdb, key); - DEBUG(0,(__location__ Deleted corrupt record\n)); + if (tdb_lock_nonblock(ctdb_db-ltdb-tdb, -1, F_WRLCK) == 0) { + tdb_delete(ctdb_db-ltdb-tdb, key); + tdb_unlock(ctdb_db-ltdb-tdb, -1, F_WRLCK); + DEBUG(0,(__location__ Deleted corrupt record\n)); + } tdb_chainunlock(ctdb_db-ltdb-tdb, key); free(data.dptr); return 0; @@ -712,13 +720,21 @@ return -1; } + if (tdb_lock_nonblock(ctdb_db-ltdb-tdb, -1, F_WRLCK) != 0) { + tdb_chainunlock(ctdb_db-ltdb-tdb, key); + free(data.dptr); + return -1; + } + if (tdb_delete(ctdb_db-ltdb-tdb, key) != 0) { + tdb_unlock(ctdb_db-ltdb-tdb, -1, F_WRLCK); tdb_chainunlock(ctdb_db-ltdb-tdb, key); DEBUG(2,(__location__ Failed to delete record\n)); free(data.dptr); return -1; } + tdb_unlock(ctdb_db-ltdb-tdb, -1, F_WRLCK); tdb_chainunlock(ctdb_db-ltdb-tdb, key); free(data.dptr); return 0;
Rev 742: changed default vacuum limit in http://samba.org/~tridge/ctdb
revno: 742 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-09 08:28:18 +1100 message: changed default vacuum limit modified: tools/ctdb_vacuum.cctdb_vacuum.c-20080108053634-3zs2bdddzs4r1e1t-1 === modified file 'tools/ctdb_vacuum.c' --- a/tools/ctdb_vacuum.c 2008-01-08 12:02:43 + +++ b/tools/ctdb_vacuum.c 2008-01-08 21:28:18 + @@ -608,7 +608,8 @@ { struct ctdb_dbid_map *dbmap=NULL; int ret, i; - uint32_t repack_limit = 100; + /* a reasonable default limit to prevent us using too much memory */ + uint32_t repack_limit = 1; if (argc 0) { repack_limit = atoi(argv[0]);
Rev 744: forgot this file in http://samba.org/~tridge/ctdb
revno: 744 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-09 08:41:27 +1100 message: forgot this file added: config/events.d/91.lvs 91.lvs-20080108214119-9xiof8rzqxi2lbo1-1 === added file 'config/events.d/91.lvs' --- a/config/events.d/91.lvs1970-01-01 00:00:00 + +++ b/config/events.d/91.lvs2008-01-08 21:41:27 + @@ -0,0 +1,86 @@ +#!/bin/sh +# script to manage the lvs ip multiplexer for a single public address cluster + +. $CTDB_BASE/functions +loadconfig ctdb + +[ -z $CTDB_LVS_PUBLIC_IP ] exit 0 +[ -z $CTDB_PUBLIC_INTERFACE ] exit 0 + +cmd=$1 +shift + +PATH=/usr/bin:/bin:/usr/sbin:/sbin:$PATH + +case $cmd in + startup) + ipvsadm -D -t $CTDB_LVS_PUBLIC_IP:0 + ipvsadm -D -u $CTDB_LVS_PUBLIC_IP:0 + + ip addr add $CTDB_LVS_PUBLIC_IP/32 dev lo scope host /dev/null 2/dev/null + + # do not respond to ARPs that are for ip addresses with scope 'host' + echo 3 /proc/sys/net/ipv4/conf/all/arp_ignore + # do not send out arp requests from loopback addresses + echo 2 /proc/sys/net/ipv4/conf/all/arp_announce + ;; + + shutdown) + ipvsadm -D -t $CTDB_LVS_PUBLIC_IP:0 + ipvsadm -D -u $CTDB_LVS_PUBLIC_IP:0 + + # remove the ip + ip addr del $CTDB_LVS_PUBLIC_IP/32 dev lo /dev/null 2/dev/null + + # flush our route cache + echo 1 /proc/sys/net/ipv4/route/flush + ;; + + takeip) + ;; + + releaseip) + ;; + + recovered) + # kill off any tcp connections + ipvsadm -D -t $CTDB_LVS_PUBLIC_IP:0 + ipvsadm -D -u $CTDB_LVS_PUBLIC_IP:0 + kill_tcp_connections $CTDB_LVS_PUBLIC_IP + + # are we the recmaster ? + ctdb isnotrecmaster /dev/null 2/dev/null || { + # change the ip address to have scope host so we wont respond + # to arps + ip addr del $CTDB_LVS_PUBLIC_IP/32 dev lo /dev/null 2/dev/null + ip addr add $CTDB_LVS_PUBLIC_IP/32 dev lo scope host /dev/null 2/dev/null + exit 0 + } + + # change the scope so we start responding to arps + ip addr del $CTDB_LVS_PUBLIC_IP/32 dev lo /dev/null 2/dev/null + ip addr add $CTDB_LVS_PUBLIC_IP/32 dev lo /dev/null 2/dev/null + + ipvsadm -A -t $CTDB_LVS_PUBLIC_IP:0 -p -s lc + ipvsadm -A -u $CTDB_LVS_PUBLIC_IP:0 -p -s lc + + ctdb status 2/dev/null | egrep ^pnn: | grep -v DISCONNECTED | grep -v (THIS NODE) | sed -e s/^pnn:[0-9]* // -e s/[ ].*// | while read IP; do + ipvsadm -a -t $CTDB_LVS_PUBLIC_IP:0 -r $IP -g + ipvsadm -a -u $CTDB_LVS_PUBLIC_IP:0 -r $IP -g + done + ipvsadm -a -t $CTDB_LVS_PUBLIC_IP:0 -r 127.0.0.1 + ipvsadm -a -u $CTDB_LVS_PUBLIC_IP:0 -r 127.0.0.1 + + # send out a gratious arp so our peers will update their arp tables + ctdb gratiousarp $CTDB_LVS_PUBLIC_IP $CTDB_PUBLIC_INTERFACE /dev/null 2/dev/null + + # flush our route cache + echo 1 /proc/sys/net/ipv4/route/flush + ;; + + monitor) + ;; + +esac + +exit 0
Rev 684: update version number in http://samba.org/~tridge/3_0-ctdb
revno: 684 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: s3-ctdb-tridge timestamp: Wed 2008-01-09 08:53:29 +1100 message: update version number modified: packaging/RHEL4-CTDB/samba.spec samba.spec-20070530192107-og9sp62ho5xuaaer-4 === modified file 'packaging/RHEL4-CTDB/samba.spec' --- a/packaging/RHEL4-CTDB/samba.spec 2007-11-29 10:10:03 + +++ b/packaging/RHEL4-CTDB/samba.spec 2008-01-08 21:53:29 + @@ -6,7 +6,7 @@ Packager: Samba Team [EMAIL PROTECTED] Name: samba Version: 3.0.25 -Release: ctdb.13 +Release: ctdb.14 Epoch:0 License: GNU GPL version 2 Group: System Environment/Daemons @@ -529,6 +529,8 @@ %endif %changelog +* Wed Jan 09 2008 : Version 3.0.25-ctdb.14 + - updated to new tdb from ctdb * Thu Nov 29 2007 : Version 3.0.25-ctdb.13 - fixed change notify bug that can cause a notify event storm - fixed several TSM bugs
Rev 745: needs to be in Makefile.in too in http://samba.org/~tridge/ctdb
revno: 745 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-09 08:50:03 +1100 message: needs to be in Makefile.in too modified: Makefile.inmakefile.in-20061117234101-o3qt14umlg9en8z0-1 === modified file 'Makefile.in' --- a/Makefile.in 2008-01-08 06:23:27 + +++ b/Makefile.in 2008-01-08 21:50:03 + @@ -181,6 +181,7 @@ ${INSTALLCMD} -m 755 config/events.d/60.nfs $(DESTDIR)$(etcdir)/ctdb/events.d ${INSTALLCMD} -m 755 config/events.d/61.nfstickle $(DESTDIR)$(etcdir)/ctdb/events.d ${INSTALLCMD} -m 755 config/events.d/90.ipmux $(DESTDIR)$(etcdir)/ctdb/events.d + ${INSTALLCMD} -m 755 config/events.d/91.lvs $(DESTDIR)$(etcdir)/ctdb/events.d ${INSTALLCMD} -m 755 tools/ctdb_diagnostics $(DESTDIR)$(bindir) ${INSTALLCMD} -m 755 tools/onnode.ssh $(DESTDIR)$(bindir) ${INSTALLCMD} -m 755 tools/onnode.rsh $(DESTDIR)$(bindir)
Rev 683: update to latest tdb code from ctdb - this means we now avoid the O(n^2) behaviour in smbd too in http://samba.org/~tridge/3_0-ctdb
revno: 683 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: s3-ctdb-tridge timestamp: Wed 2008-01-09 08:52:16 +1100 message: update to latest tdb code from ctdb - this means we now avoid the O(n^2) behaviour in smbd too modified: source/lib/tdb/Makefile.in makefile.in-20070416112700-wu1jh7in2kvfbr2w-2 source/lib/tdb/autogen.sh* autogen.sh-20070416112700-wu1jh7in2kvfbr2w-4 source/lib/tdb/common/dump.c dump.c-20070416112700-wu1jh7in2kvfbr2w-14 source/lib/tdb/common/error.c error.c-20070416112700-wu1jh7in2kvfbr2w-15 source/lib/tdb/common/freelist.c freelist.c-20070416112700-wu1jh7in2kvfbr2w-16 source/lib/tdb/common/freelistcheck.c freelistcheck.c-20070416112700-wu1jh7in2kvfbr2w-17 source/lib/tdb/common/io.c io.c-20070416112700-wu1jh7in2kvfbr2w-18 source/lib/tdb/common/lock.c lock.c-20070416112700-wu1jh7in2kvfbr2w-19 source/lib/tdb/common/open.c open.c-20070416112700-wu1jh7in2kvfbr2w-20 source/lib/tdb/common/tdb.ctdb.c-20070416112700-wu1jh7in2kvfbr2w-21 source/lib/tdb/common/tdb_private.h tdb_private.h-20070416112700-wu1jh7in2kvfbr2w-22 source/lib/tdb/common/transaction.c transaction.c-20070416112700-wu1jh7in2kvfbr2w-24 source/lib/tdb/common/traverse.c traverse.c-20070416112700-wu1jh7in2kvfbr2w-25 source/lib/tdb/config.guess* config.guess-20070419111302-1f4ud6u0mg1p64rp-1 source/lib/tdb/config.mk config.mk-20070416112700-wu1jh7in2kvfbr2w-7 source/lib/tdb/config.sub* config.sub-20070419111302-sg4y9tw3xf45ke9k-1 source/lib/tdb/configure.acconfigure.ac-20070419111303-740ihrzqkeog8s3q-1 source/lib/tdb/include/tdb.h tdb.h-20070416112700-wu1jh7in2kvfbr2w-28 source/lib/tdb/libtdb.m4 libtdb.m4-20070419111305-yv9pigd2s6bqf9bi-1 source/lib/tdb/swig/Tdb.py tdb.py-20070416112700-wu1jh7in2kvfbr2w-31 source/lib/tdb/tdb.pc.in tdb.pc.in-20070416112700-wu1jh7in2kvfbr2w-12 source/lib/tdb/tools/tdbbackup.c tdbbackup.c-20070416112700-wu1jh7in2kvfbr2w-33 source/lib/tdb/tools/tdbdump.c tdbdump.c-20070416112700-wu1jh7in2kvfbr2w-34 source/lib/tdb/tools/tdbtest.c tdbtest.c-20070416112700-wu1jh7in2kvfbr2w-35 source/lib/tdb/tools/tdbtool.c tdbtool.c-20070416112700-wu1jh7in2kvfbr2w-36 source/lib/tdb/tools/tdbtorture.c tdbtorture.c-20070416112700-wu1jh7in2kvfbr2w-37 Diff too large for email (2673, the limit is 200).
Rev 746: only match vacuum list if on the same database in http://samba.org/~tridge/ctdb
revno: 746 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-09 10:22:20 +1100 message: only match vacuum list if on the same database modified: client/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 server/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 === modified file 'client/ctdb_client.c' --- a/client/ctdb_client.c 2008-01-08 10:28:42 + +++ b/client/ctdb_client.c 2008-01-08 23:22:20 + @@ -1631,7 +1631,7 @@ return NULL; } - ctdb_db-ltdb = tdb_wrap_open(ctdb, ctdb_db-db_path, 0, 0, O_RDWR, 0); + ctdb_db-ltdb = tdb_wrap_open(ctdb, ctdb_db-db_path, 0, persistent?TDB_DEFAULT:TDB_NOSYNC, O_RDWR, 0); if (ctdb_db-ltdb == NULL) { ctdb_set_error(ctdb, Failed to open tdb '%s'\n, ctdb_db-db_path); talloc_free(ctdb_db); === modified file 'server/ctdb_recoverd.c' --- a/server/ctdb_recoverd.c2008-01-08 10:28:42 + +++ b/server/ctdb_recoverd.c2008-01-08 23:22:20 + @@ -822,7 +822,7 @@ srcnode = r-reqid; for (v=rec-vacuum_info;v;v=v-next) { - if (srcnode == v-srcnode) { + if (srcnode == v-srcnode recs-db_id == v-ctdb_db-db_id) { /* we're already working on records from this node */ return; }
Rev 682: ensure uni_name.buffer is initialised in http://samba.org/~tridge/3_0-ctdb
revno: 682 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: s3-ctdb-tridge timestamp: Wed 2008-01-09 08:35:23 +1100 message: ensure uni_name.buffer is initialised modified: source/smbd/notify.c notify.c-20070210173807-1wjifrbwaz6xnmgl-1020 === modified file 'source/smbd/notify.c' --- a/source/smbd/notify.c 2007-11-28 00:40:51 + +++ b/source/smbd/notify.c 2008-01-08 21:35:23 + @@ -55,6 +55,8 @@ int i; UNISTR uni_name; + uni_name.buffer = NULL; + for (i=0; inum_changes; i++) { struct notify_change *c = changes[i]; size_t namelen;
Rev 743: increase version number in http://samba.org/~tridge/ctdb
revno: 743 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-09 08:29:19 +1100 message: increase version number modified: packaging/RPM/ctdb.specctdb.spec-20070527204758-biuh7znabuwan3zn-3 === modified file 'packaging/RPM/ctdb.spec' --- a/packaging/RPM/ctdb.spec 2008-01-07 03:31:13 + +++ b/packaging/RPM/ctdb.spec 2008-01-08 21:29:19 + @@ -5,7 +5,7 @@ Packager: Samba Team [EMAIL PROTECTED] Name: ctdb Version: 1.0 -Release: 20 +Release: 21 Epoch: 0 License: GNU GPL version 3 Group: System Environment/Daemons @@ -118,6 +118,8 @@ %{_includedir}/ctdb_private.h %changelog +* Wed Jan 09 2008 : Version 1.0.21 + - added ctdb vacuum and ctdb repack code * Sun Jan 06 2008 : Version 1.0.20 - new transaction based recovery code * Sat Jan 05 2008 : Version 1.0.19
Rev 749: a compromise for freelist scanning - we now will look for other than the first fit, but get exponentially more desperate as we get deeper into the freelist in http://samba.org/~tridge/ctdb
revno: 749 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-09 15:33:10 +1100 message: a compromise for freelist scanning - we now will look for other than the first fit, but get exponentially more desperate as we get deeper into the freelist modified: lib/tdb/common/freelist.c freelist.c-20070220022425-m1wibgjq7n5hahs6-4 === modified file 'lib/tdb/common/freelist.c' --- a/lib/tdb/common/freelist.c 2008-01-08 06:23:27 + +++ b/lib/tdb/common/freelist.c 2008-01-09 04:33:10 + @@ -280,6 +280,7 @@ tdb_off_t rec_ptr, last_ptr; tdb_len_t rec_len; } bestfit; + float multiplier = 1.0; if (tdb_lock(tdb, -1, F_WRLCK) == -1) return 0; @@ -314,13 +315,27 @@ bestfit.rec_len = rec-rec_len; bestfit.rec_ptr = rec_ptr; bestfit.last_ptr = last_ptr; - break; } } /* move to the next record */ last_ptr = rec_ptr; rec_ptr = rec-next; + + /* if we've found a record that is big enough, then + stop searching if its also not too big. The + definition of 'too big' changes as we scan + through */ + if (bestfit.rec_len 0 + bestfit.rec_len length * multiplier) { + break; + } + + /* this multiplier means we only extremely rarely + search more than 50 or so records. At 50 records we + accept records up to 11 times larger than what we + want */ + multiplier *= 1.05; } if (bestfit.rec_ptr != 0) {
Rev 747: allow remote variable expansion in onnode, so you can use wildcards that expand on the remote nodes in http://samba.org/~tridge/ctdb
revno: 747 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-09 15:04:56 +1100 message: allow remote variable expansion in onnode, so you can use wildcards that expand on the remote nodes modified: tools/onnode.rsh onnode.rsh-20070530010004-83j66tszzvsimcn2-1 tools/onnode.ssh onnode.ssh-20070530010004-83j66tszzvsimcn2-3 === modified file 'tools/onnode.rsh' --- a/tools/onnode.rsh 2008-01-07 03:31:13 + +++ b/tools/onnode.rsh 2008-01-09 04:04:56 + @@ -10,7 +10,7 @@ NODE=$1 shift -SCRIPT=$* +SCRIPT=$@ NODES=/etc/ctdb/nodes @@ -21,9 +21,9 @@ for a in `egrep '^[[:alnum:]]' $NODES`; do echo; echo NODE: $a if [ -f $SCRIPT ]; then - rsh $a at -f $SCRIPT now + rsh $a at -f $SCRIPT now else - rsh $a $SCRIPT + rsh $a $SCRIPT fi done exit 0 @@ -38,7 +38,7 @@ a=`egrep '^[[:alnum:]]' $NODES | head -$NODEPLUSONE | tail -1` if [ -f $SCRIPT ]; then -exec rsh $a at -f $SCRIPT now +exec rsh $a at -f $SCRIPT now else -exec rsh $a $SCRIPT +exec rsh $a $SCRIPT fi === modified file 'tools/onnode.ssh' --- a/tools/onnode.ssh 2008-01-07 03:31:13 + +++ b/tools/onnode.ssh 2008-01-09 04:04:56 + @@ -10,7 +10,7 @@ NODE=$1 shift -SCRIPT=$* +SCRIPT=$@ NODES=/etc/ctdb/nodes @@ -21,9 +21,9 @@ for a in `egrep '^[[:alnum:]]' $NODES`; do echo; echo NODE: $a if [ -f $SCRIPT ]; then - ssh -n $a at -f $SCRIPT now + ssh -n $a at -f $SCRIPT now else - ssh -n $a $SCRIPT + ssh -n $a $SCRIPT fi done exit 0 @@ -38,7 +38,7 @@ a=`egrep '^[[:alnum:]]' $NODES | head -$NODEPLUSONE | tail -1` if [ -f $SCRIPT ]; then -exec ssh -n $a at -f $SCRIPT now +exec ssh -n $a at -f $SCRIPT now else -exec ssh -n $a $SCRIPT +exec ssh -n $a $SCRIPT fi
Rev 748: allow delete percentage to be specified on the command line in http://samba.org/~tridge/ctdb
revno: 748 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-09 15:32:18 +1100 message: allow delete percentage to be specified on the command line modified: tests/ctdb_randrec.c ctdb_randrec.c-20080103224053-3pf5tyxleld8dqam-1 === modified file 'tests/ctdb_randrec.c' --- a/tests/ctdb_randrec.c 2008-01-03 22:41:04 + +++ b/tests/ctdb_randrec.c 2008-01-09 04:32:18 + @@ -94,6 +94,7 @@ POPT_CTDB_CMDLINE { num-records, 'r', POPT_ARG_INT, num_records, 0, num_records, integer }, { base-rec, 'b', POPT_ARG_INT, base_rec, 0, base_rec, integer }, + { delete-pct, 'p', POPT_ARG_INT, delete_pct, 0, delete_pct, integer }, POPT_TABLEEND }; int opt;
Rev 750: report the store rate in ctdb_randrec in http://samba.org/~tridge/ctdb
revno: 750 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Wed 2008-01-09 17:45:13 +1100 message: report the store rate in ctdb_randrec modified: tests/ctdb_randrec.c ctdb_randrec.c-20080103224053-3pf5tyxleld8dqam-1 === modified file 'tests/ctdb_randrec.c' --- a/tests/ctdb_randrec.c 2008-01-09 04:32:18 + +++ b/tests/ctdb_randrec.c 2008-01-09 06:45:13 + @@ -27,6 +27,20 @@ #include sys/time.h #include time.h +static struct timeval tp1,tp2; + +static void start_timer(void) +{ + gettimeofday(tp1,NULL); +} + +static double end_timer(void) +{ + gettimeofday(tp2,NULL); + return (tp2.tv_sec + (tp2.tv_usec*1.0e-6)) - + (tp1.tv_sec + (tp1.tv_usec*1.0e-6)); +} + static int num_records = 10; static int delete_pct = 75; static int base_rec; @@ -44,6 +58,8 @@ srandom(time(NULL) ^ getpid()); + start_timer(); + printf(working with %d records\n, num_records); while (1) { unsigned r = random() % num_records; @@ -72,8 +88,9 @@ printf(Failed to store record\n); } if (i % 1000 == 0) { - printf(%u\r, i); + printf(%7.0f recs/second %u total\r, 1000.0 / end_timer(), i); fflush(stdout); + start_timer(); } i++; }
Re: [SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-1215-g2938e74
ensure uni_name.buffer is initialised merge from http://samba.org/~tridge/3_0-ctdb Thanks Volker!
Rev 734: background the smbstatus -n command in http://samba.org/~tridge/ctdb
revno: 734 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Mon 2008-01-07 23:41:07 +1100 message: background the smbstatus -n command modified: config/events.d/50.samba samba-20070601105340-vlcvnp6euoj3zdwy-3 === modified file 'config/events.d/50.samba' --- a/config/events.d/50.samba 2008-01-07 03:31:13 + +++ b/config/events.d/50.samba 2008-01-07 12:41:07 + @@ -36,7 +36,7 @@ # running smbstatus scrubs any dead entries from the connections # and sessionid database echo `date` Running periodic cleanup of samba databases -smbstatus -n /dev/null 21 +smbstatus -n /dev/null 21 } case $cmd in
Rev 735: show start/stop time of recovery on all nodes in http://samba.org/~tridge/ctdb
revno: 735 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Tue 2008-01-08 09:30:11 +1100 message: show start/stop time of recovery on all nodes modified: server/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 === modified file 'server/ctdb_recover.c' --- a/server/ctdb_recover.c 2008-01-07 03:31:13 + +++ b/server/ctdb_recover.c 2008-01-07 22:30:11 + @@ -509,6 +509,11 @@ return -1; } + if (recmode != ctdb-recovery_mode) { + DEBUG(0,(__location__ Recovery mode set to %s\n, +recmode==CTDB_RECOVERY_NORMAL?NORMAL:ACTIVE)); + } + if (recmode != CTDB_RECOVERY_NORMAL || ctdb-recovery_mode != CTDB_RECOVERY_ACTIVE) { ctdb-recovery_mode = recmode;
Rev 736: updated docs from ronnie in http://samba.org/~tridge/ctdb
revno: 736 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Tue 2008-01-08 11:47:29 +1100 message: updated docs from ronnie modified: doc/ctdbd.1ctdbd.1-20070610004249-06awdka4n3gyea3w-1 doc/ctdbd.1.html ctdbd.1.html-20070610004253-y2xxgjfgnpsucekc-1 Diff too large for email (566, the limit is 200).
Rev 737: added two new ctdb commands: in http://samba.org/~tridge/ctdb
revno: 737 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Tue 2008-01-08 17:23:27 +1100 message: added two new ctdb commands: ctdb vacuum : vacuums all the databases, deleting any zero length ctdb records ctdb repack : repacks all the databases, resulting in a perfectly packed database with no freelist entries added: tools/ctdb_vacuum.cctdb_vacuum.c-20080108053634-3zs2bdddzs4r1e1t-1 modified: Makefile.inmakefile.in-20061117234101-o3qt14umlg9en8z0-1 client/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 lib/tdb/common/freelist.c freelist.c-20070220022425-m1wibgjq7n5hahs6-4 lib/tdb/include/tdb.h tdb.h-20070125040949-7t3f5zdl1q4z9hyv-101 server/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 server/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 server/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 tools/ctdb.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1 Diff too large for email (1095, the limit is 200).
Rev 730: more efficient traversal in pulldb control in http://samba.org/~tridge/ctdb
revno: 730 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Mon 2008-01-07 14:07:01 +1100 message: more efficient traversal in pulldb control modified: server/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 === modified file 'server/ctdb_recover.c' --- a/server/ctdb_recover.c 2008-01-06 01:38:01 + +++ b/server/ctdb_recover.c 2008-01-07 03:07:01 + @@ -170,36 +170,38 @@ return 0; } -struct getkeys_params { +/* + a traverse function for pulling all relevent records from pulldb + */ +struct pulldb_data { struct ctdb_context *ctdb; - uint32_t lmaster; - uint32_t rec_count; - struct getkeys_rec { - TDB_DATA key; - TDB_DATA data; - } *recs; + struct ctdb_control_pulldb_reply *pulldata; + uint32_t len; + bool failed; }; -static int traverse_getkeys(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *p) +static int traverse_pulldb(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *p) { - struct getkeys_params *params = (struct getkeys_params *)p; - uint32_t lmaster; - - lmaster = ctdb_lmaster(params-ctdb, key); - - /* only include this record if the lmaster matches or if - the wildcard lmaster (-1) was specified. - */ - if ((params-lmaster != CTDB_LMASTER_ANY) (params-lmaster != lmaster)) { - return 0; - } - - params-recs = talloc_realloc(NULL, params-recs, struct getkeys_rec, params-rec_count+1); - key.dptr = talloc_memdup(params-recs, key.dptr, key.dsize); - data.dptr = talloc_memdup(params-recs, data.dptr, data.dsize); - params-recs[params-rec_count].key = key; - params-recs[params-rec_count].data = data; - params-rec_count++; + struct pulldb_data *params = (struct pulldb_data *)p; + struct ctdb_rec_data *rec; + + /* add the record to the blob */ + rec = ctdb_marshall_record(params-pulldata, 0, key, NULL, data); + if (rec == NULL) { + params-failed = true; + return -1; + } + params-pulldata = talloc_realloc_size(NULL, params-pulldata, rec-length + params-len); + if (params-pulldata == NULL) { + DEBUG(0,(__location__ Failed to expand pulldb_data to %u (%u records)\n, +rec-length + params-len, params-pulldata-count)); + params-failed = true; + return -1; + } + params-pulldata-count++; + memcpy(params-len+(uint8_t *)params-pulldata, rec, rec-length); + params-len += rec-length; + talloc_free(rec); return 0; } @@ -211,10 +213,8 @@ { struct ctdb_control_pulldb *pull; struct ctdb_db_context *ctdb_db; - struct getkeys_params params; + struct pulldb_data params; struct ctdb_control_pulldb_reply *reply; - int i; - size_t len = 0; if (ctdb-freeze_mode != CTDB_FREEZE_FROZEN) { DEBUG(0,(rejecting ctdb_control_pull_db when not frozen\n)); @@ -229,43 +229,32 @@ return -1; } - params.ctdb = ctdb; - params.lmaster = pull-lmaster; - - params.rec_count = 0; - params.recs = talloc_array(outdata, struct getkeys_rec, 0); - CTDB_NO_MEMORY(ctdb, params.recs); - - if (ctdb_lock_all_databases_mark(ctdb) != 0) { - DEBUG(0,(__location__ Failed to get lock on entired db - failing\n)); - return -1; - } - - tdb_traverse_read(ctdb_db-ltdb-tdb, traverse_getkeys, params); - - ctdb_lock_all_databases_unmark(ctdb); - - reply = talloc(outdata, struct ctdb_control_pulldb_reply); + reply = talloc_zero(outdata, struct ctdb_control_pulldb_reply); CTDB_NO_MEMORY(ctdb, reply); reply-db_id = pull-db_id; - reply-count = params.rec_count; - - len = offsetof(struct ctdb_control_pulldb_reply, data); - - for (i=0;ireply-count;i++) { - struct ctdb_rec_data *rec; - rec = ctdb_marshall_record(outdata, 0, params.recs[i].key, NULL, params.recs[i].data); - reply = talloc_realloc_size(outdata, reply, rec-length + len); - memcpy(len+(uint8_t *)reply, rec, rec-length); - len += rec-length; - talloc_free(rec); - } - - talloc_free(params.recs); - - outdata-dptr = (uint8_t *)reply; - outdata-dsize = len; + + params.ctdb = ctdb; + params.pulldata = reply; + params.len = offsetof(struct ctdb_control_pulldb_reply, data); + params.failed = false; + + if (ctdb_lock_all_databases_mark(ctdb) != 0) { + DEBUG(0,(__location__ Failed to get lock on entired db - failing\n)); + return -1; +
Rev 827: merge from tridge.stable in http://samba.org/~tridge/ctdb
revno: 827 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: ronnie.merge timestamp: Mon 2008-01-07 14:09:08 +1100 message: merge from tridge.stable modified: config/events.d/60.nfs nfs-20070601141008-hy3h4qgbk1jd2jci-1 server/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 revno: 432.1.257.1.42 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Mon 2008-01-07 14:08:25 +1100 message: catch internal traversal errors modified: server/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 revno: 432.1.257.1.41 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Mon 2008-01-07 14:07:01 +1100 message: more efficient traversal in pulldb control modified: server/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 revno: 432.1.257.1.40 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Mon 2008-01-07 14:05:30 +1100 message: don't retstart statd when we don't need to modified: config/events.d/60.nfs nfs-20070601141008-hy3h4qgbk1jd2jci-1 === modified file 'config/events.d/60.nfs' --- a/config/events.d/60.nfs2007-11-16 02:37:27 + +++ b/config/events.d/60.nfs2008-01-07 03:05:30 + @@ -55,6 +55,9 @@ ;; recovered) + # if no IPs have changed then don't need to restart statd + [ -f $CTDB_BASE/state/statd/restart ] || exit 0; + # always restart the lockmanager so that we start with a clusterwide # graceperiod when ip addresses has changed [ -x $CTDB_BASE/statd-callout ] { === modified file 'server/ctdb_recover.c' --- a/server/ctdb_recover.c 2008-01-07 02:46:31 + +++ b/server/ctdb_recover.c 2008-01-07 03:09:08 + @@ -170,36 +170,38 @@ return 0; } -struct getkeys_params { +/* + a traverse function for pulling all relevent records from pulldb + */ +struct pulldb_data { struct ctdb_context *ctdb; - uint32_t lmaster; - uint32_t rec_count; - struct getkeys_rec { - TDB_DATA key; - TDB_DATA data; - } *recs; + struct ctdb_control_pulldb_reply *pulldata; + uint32_t len; + bool failed; }; -static int traverse_getkeys(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *p) +static int traverse_pulldb(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *p) { - struct getkeys_params *params = (struct getkeys_params *)p; - uint32_t lmaster; - - lmaster = ctdb_lmaster(params-ctdb, key); - - /* only include this record if the lmaster matches or if - the wildcard lmaster (-1) was specified. - */ - if ((params-lmaster != CTDB_LMASTER_ANY) (params-lmaster != lmaster)) { - return 0; - } - - params-recs = talloc_realloc(NULL, params-recs, struct getkeys_rec, params-rec_count+1); - key.dptr = talloc_memdup(params-recs, key.dptr, key.dsize); - data.dptr = talloc_memdup(params-recs, data.dptr, data.dsize); - params-recs[params-rec_count].key = key; - params-recs[params-rec_count].data = data; - params-rec_count++; + struct pulldb_data *params = (struct pulldb_data *)p; + struct ctdb_rec_data *rec; + + /* add the record to the blob */ + rec = ctdb_marshall_record(params-pulldata, 0, key, NULL, data); + if (rec == NULL) { + params-failed = true; + return -1; + } + params-pulldata = talloc_realloc_size(NULL, params-pulldata, rec-length + params-len); + if (params-pulldata == NULL) { + DEBUG(0,(__location__ Failed to expand pulldb_data to %u (%u records)\n, +rec-length + params-len, params-pulldata-count)); + params-failed = true; + return -1; + } + params-pulldata-count++; + memcpy(params-len+(uint8_t *)params-pulldata, rec, rec-length); + params-len += rec-length; + talloc_free(rec); return 0; } @@ -211,10 +213,8 @@ { struct ctdb_control_pulldb *pull; struct ctdb_db_context *ctdb_db; - struct getkeys_params params; + struct pulldb_data params; struct ctdb_control_pulldb_reply *reply; - int i; - size_t len = 0;
Rev 731: catch internal traversal errors in http://samba.org/~tridge/ctdb
revno: 731 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Mon 2008-01-07 14:08:25 +1100 message: catch internal traversal errors modified: server/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 === modified file 'server/ctdb_recoverd.c' --- a/server/ctdb_recoverd.c2008-01-06 02:24:55 + +++ b/server/ctdb_recoverd.c2008-01-07 03:08:25 + @@ -542,7 +542,7 @@ struct ctdb_ltdb_header header; if (existing.dsize sizeof(struct ctdb_ltdb_header)) { DEBUG(0,(__location__ Bad record size %u from node %u\n, -existing.dsize, srcnode)); +(unsigned)existing.dsize, srcnode)); free(existing.dptr); talloc_free(tmp_ctx); return -1; @@ -898,6 +898,7 @@ struct ctdb_context *ctdb; struct ctdb_control_pulldb_reply *recdata; uint32_t len; + bool failed; }; static int traverse_recdb(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *p) @@ -917,10 +918,15 @@ /* add the record to the blob ready to send to the nodes */ rec = ctdb_marshall_record(params-recdata, 0, key, NULL, data); + if (rec == NULL) { + params-failed = true; + return -1; + } params-recdata = talloc_realloc_size(NULL, params-recdata, rec-length + params-len); if (params-recdata == NULL) { DEBUG(0,(__location__ Failed to expand recdata to %u (%u records)\n, rec-length + params-len, params-recdata-count)); + params-failed = true; return -1; } params-recdata-count++; @@ -949,12 +955,20 @@ params.ctdb = ctdb; params.recdata = recdata; params.len = offsetof(struct ctdb_control_pulldb_reply, data); + params.failed = false; if (tdb_traverse_read(recdb-tdb, traverse_recdb, params) == -1) { DEBUG(0,(__location__ Failed to traverse recdb database\n)); + talloc_free(params.recdata); return -1; } + if (params.failed) { + DEBUG(0,(__location__ Failed to traverse recdb database\n)); + talloc_free(params.recdata); + return -1; + } + recdata = params.recdata; outdata.dptr = (void *)recdata;
Rev 729: don't retstart statd when we don't need to in http://samba.org/~tridge/ctdb
revno: 729 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Mon 2008-01-07 14:05:30 +1100 message: don't retstart statd when we don't need to modified: config/events.d/60.nfs nfs-20070601141008-hy3h4qgbk1jd2jci-1 === modified file 'config/events.d/60.nfs' --- a/config/events.d/60.nfs2007-11-16 02:37:27 + +++ b/config/events.d/60.nfs2008-01-07 03:05:30 + @@ -55,6 +55,9 @@ ;; recovered) + # if no IPs have changed then don't need to restart statd + [ -f $CTDB_BASE/state/statd/restart ] || exit 0; + # always restart the lockmanager so that we start with a clusterwide # graceperiod when ip addresses has changed [ -x $CTDB_BASE/statd-callout ] {
Rev 826: merged from tridge.stable in http://samba.org/~tridge/ctdb
revno: 826 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: ronnie.merge timestamp: Mon 2008-01-07 13:46:31 +1100 message: merged from tridge.stable added: lib/replace/getaddrinfo.c getaddrinfo.c-20080105064003-0l0vaddyd3689f0x-1 lib/replace/getaddrinfo.h getaddrinfo.h-20080105064016-nzzl0au2e9klsho4-1 lib/replace/getaddrinfo.m4 getaddrinfo.m4-20080105064006-hosjskadr4vu48vd-1 lib/replace/getifaddrs.c getifaddrs.c-20080105064003-0l0vaddyd3689f0x-2 lib/replace/getifaddrs.m4 getifaddrs.m4-20080105064006-hosjskadr4vu48vd-2 lib/replace/inet_ntop.cinet_ntop.c-20080105064003-0l0vaddyd3689f0x-3 lib/replace/inet_ntop.m4 inet_ntop.m4-20080105064006-hosjskadr4vu48vd-3 lib/replace/inet_pton.cinet_pton.c-20080105064003-0l0vaddyd3689f0x-4 lib/replace/inet_pton.m4 inet_pton.m4-20080105064006-hosjskadr4vu48vd-4 lib/replace/libreplace_ld.m4 libreplace_ld.m4-20080105064006-hosjskadr4vu48vd-5 tests/ctdb_randrec.c ctdb_randrec.c-20080103224053-3pf5tyxleld8dqam-1 modified: client/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 config/ctdb.init ctdb.init-20070527204758-biuh7znabuwan3zn-6 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 include/includes.h includes.h-20061117234101-o3qt14umlg9en8z0-17 lib/replace/README readme-20070125040949-7t3f5zdl1q4z9hyv-6 lib/replace/configure.ac configure.ac-20070125040949-7t3f5zdl1q4z9hyv-13 lib/replace/dlfcn.cdlfcn.c-20070125040949-7t3f5zdl1q4z9hyv-14 lib/replace/dlfcn.m4 dlfcn.m4-20070125040949-7t3f5zdl1q4z9hyv-15 lib/replace/getpass.c getpass.c-20070125040949-7t3f5zdl1q4z9hyv-16 lib/replace/getpass.m4 getpass.m4-20070125040949-7t3f5zdl1q4z9hyv-17 lib/replace/libreplace.m4 libreplace.m4-20070125040949-7t3f5zdl1q4z9hyv-20 lib/replace/libreplace_cc.m4 libreplace_cc.m4-20070125040949-7t3f5zdl1q4z9hyv-21 lib/replace/libreplace_macros.m4 libreplace_macros.m4-20070125040949-7t3f5zdl1q4z9hyv-22 lib/replace/replace.h replace.h-20070125040949-7t3f5zdl1q4z9hyv-27 lib/replace/system/capability.h capability.h-20070125040949-7t3f5zdl1q4z9hyv-76 lib/replace/system/config.m4 config.m4-20070125040949-7t3f5zdl1q4z9hyv-77 lib/replace/system/network.h network.h-20070125040949-7t3f5zdl1q4z9hyv-84 lib/replace/system/passwd.hpasswd.h-20070125040949-7t3f5zdl1q4z9hyv-85 lib/replace/system/time.h time.h-20070125040949-7t3f5zdl1q4z9hyv-92 lib/replace/system/wait.h wait.h-20070125040949-7t3f5zdl1q4z9hyv-93 lib/tdb/Makefile.inmakefile.in-20070125040949-7t3f5zdl1q4z9hyv-59 lib/tdb/autogen.sh autogen.sh-20070125040949-7t3f5zdl1q4z9hyv-61 lib/tdb/common/error.c error.c-20070220022425-m1wibgjq7n5hahs6-3 lib/tdb/common/freelist.c freelist.c-20070220022425-m1wibgjq7n5hahs6-4 lib/tdb/common/io.cio.c-20070220022425-m1wibgjq7n5hahs6-6 lib/tdb/common/lock.c lock.c-20070220022425-m1wibgjq7n5hahs6-7 lib/tdb/common/open.c open.c-20070220022425-m1wibgjq7n5hahs6-8 lib/tdb/common/tdb.c tdb.c-20070220022425-m1wibgjq7n5hahs6-9 lib/tdb/common/tdb_private.h tdb_private.h-20070220022425-m1wibgjq7n5hahs6-10 lib/tdb/common/transaction.c transaction.c-20070220022425-m1wibgjq7n5hahs6-11 lib/tdb/common/traverse.c traverse.c-20070220022425-m1wibgjq7n5hahs6-12 lib/tdb/config.mk config.mk-20070125040949-7t3f5zdl1q4z9hyv-63 lib/tdb/configure.ac configure.ac-20070125040949-7t3f5zdl1q4z9hyv-65 lib/tdb/include/tdb.h tdb.h-20070125040949-7t3f5zdl1q4z9hyv-101 lib/tdb/libtdb.m4 libtdb.m4-20070125040949-7t3f5zdl1q4z9hyv-69 lib/tdb/tools/tdbbackup.c tdbbackup.c-20070125040949-7t3f5zdl1q4z9hyv-105 lib/tdb/tools/tdbdump.ctdbdump.c-20070125040949-7t3f5zdl1q4z9hyv-106 lib/tdb/tools/tdbtool.ctdbtool.c-20070125040949-7t3f5zdl1q4z9hyv-108 lib/tdb/tools/tdbtorture.c tdbtorture.c-20070125040949-7t3f5zdl1q4z9hyv-109 lib/util/db_wrap.c db_wrap.c-20070125041102-mfc39bu6uof09lw6-1 lib/util/debug.c debug.c-20070417155854-2i3crb0irl716qft-1 lib/util/debug.h debug.h-20070417155854-2i3crb0irl716qft-2 packaging/RPM/ctdb.specctdb.spec-20070527204758-biuh7znabuwan3zn-3 packaging/RPM/makerpms.sh makerpms.sh-20070527204758-biuh7znabuwan3zn-4 server/ctdb_call.c ctdb_call.c-20061128065342-to93h6eejj5kon81-1 server/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 server/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 server/ctdb_freeze.c ctdb_freeze.c-20070512051503-935zdtyuqknqnhmo-1
Rev 732: nicer onnode output in http://samba.org/~tridge/ctdb
revno: 732 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Mon 2008-01-07 14:31:13 +1100 message: nicer onnode output modified: config/ctdb.sysconfig ctdb.sysconfig-20070527204758-biuh7znabuwan3zn-7 config/events.d/50.samba samba-20070601105340-vlcvnp6euoj3zdwy-3 doc/ctdbd.1.xmlctdbd.1.xml-20070610004256-jh1qq0ws5zidbmbq-1 packaging/RPM/ctdb.specctdb.spec-20070527204758-biuh7znabuwan3zn-3 server/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 tools/ctdb_diagnostics ctdb_diagnostics-20070905041904-9d9r1qnt1j9qiwiz-1 tools/onnode.rsh onnode.rsh-20070530010004-83j66tszzvsimcn2-1 tools/onnode.ssh onnode.ssh-20070530010004-83j66tszzvsimcn2-3 Diff too large for email (368, the limit is 200).
Rev 825: remove for merge in http://samba.org/~tridge/ctdb
revno: 825 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: ronnie.merge timestamp: Mon 2008-01-07 13:41:08 +1100 message: remove for merge removed: tests/ctdb_randrec.c ctdb_randrec.c-2008010308-584sshdn57l9l64m-1 === removed file 'tests/ctdb_randrec.c' --- a/tests/ctdb_randrec.c 2008-01-03 04:46:17 + +++ b/tests/ctdb_randrec.c 1970-01-01 00:00:00 + @@ -1,137 +0,0 @@ -/* - create a lot of random records, both current records and deleted records - - Copyright (C) Andrew Tridgell 2008 - Ronnie sahlberg 2007 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see http://www.gnu.org/licenses/. -*/ - -#include includes.h -#include lib/events/events.h -#include system/filesys.h -#include popt.h -#include cmdline.h - -#include sys/time.h -#include time.h - -static int num_records = 10; -static int delete_pct = 75; -static int base_rec; - -static void store_records(struct ctdb_context *ctdb, struct event_context *ev) -{ - TDB_DATA key, data; - struct ctdb_db_context *ctdb_db; - TALLOC_CTX *tmp_ctx = talloc_new(ctdb); - int ret; - struct ctdb_record_handle *h; - uint32_t i=0; - - ctdb_db = ctdb_db_handle(ctdb, test.tdb); - - srandom(time(NULL) ^ getpid()); - - printf(working with %d records\n, num_records); - while (1) { - unsigned r = random() % num_records; - key.dptr = (uint8_t *)r; - key.dsize = sizeof(r); - - h = ctdb_fetch_lock(ctdb_db, tmp_ctx, key, data); - if (h == NULL) { - printf(Failed to fetch record '%s' on node %d\n, - (const char *)key.dptr, ctdb_get_pnn(ctdb)); - talloc_free(tmp_ctx); - return; - } - - if (random() % 100 delete_pct) { - data.dptr = NULL; - data.dsize = 0; - } else { - data.dptr = talloc_zero_size(h, data.dsize + sizeof(r)); - data.dsize += sizeof(r); - } - - ret = ctdb_record_store(h, data); - talloc_free(h); - if (ret != 0) { - printf(Failed to store record\n); - } - if (i % 1000 == 0) { - printf(%u\r, i); - fflush(stdout); - } - i++; - } - - talloc_free(tmp_ctx); -} - -/* - main program -*/ -int main(int argc, const char *argv[]) -{ - struct ctdb_context *ctdb; - struct ctdb_db_context *ctdb_db; - - struct poptOption popt_options[] = { - POPT_AUTOHELP - POPT_CTDB_CMDLINE - { num-records, 'r', POPT_ARG_INT, num_records, 0, num_records, integer }, - { base-rec, 'b', POPT_ARG_INT, base_rec, 0, base_rec, integer }, - POPT_TABLEEND - }; - int opt; - const char **extra_argv; - int extra_argc = 0; - poptContext pc; - struct event_context *ev; - - pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST); - - while ((opt = poptGetNextOpt(pc)) != -1) { - switch (opt) { - default: - fprintf(stderr, Invalid option %s: %s\n, - poptBadOption(pc, 0), poptStrerror(opt)); - exit(1); - } - } - - /* setup the remaining options for the main program to use */ - extra_argv = poptGetArgs(pc); - if (extra_argv) { - extra_argv++; - while (extra_argv[extra_argc]) extra_argc++; - } - - ev = event_context_init(NULL); - - ctdb = ctdb_cmdline_client(ev); - - /* attach to a specific database */ - ctdb_db = ctdb_attach(ctdb, test.tdb, false); - if (!ctdb_db) { - printf(ctdb_attach failed - %s\n, ctdb_errstr(ctdb)); - exit(1); - } - - store_records(ctdb, ev); - - return 0; -}
Rev 733: merge from ronnie in http://samba.org/~tridge/ctdb
revno: 733 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Mon 2008-01-07 16:17:22 +1100 message: merge from ronnie modified: include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 server/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 === modified file 'include/ctdb_private.h' --- a/include/ctdb_private.h2008-01-06 02:24:55 + +++ b/include/ctdb_private.h2008-01-07 05:17:22 + @@ -366,6 +366,7 @@ struct _trbt_tree_t *server_ids; const char *event_script_dir; const char *default_public_interface; + pid_t ctdbd_pid; pid_t recoverd_pid; bool done_startup; const char *node_ip; === modified file 'server/ctdb_recoverd.c' --- a/server/ctdb_recoverd.c2008-01-07 03:08:25 + +++ b/server/ctdb_recoverd.c2008-01-07 05:17:22 + @@ -1821,6 +1821,12 @@ /* we only check for recovery once every second */ ctdb_wait_timeout(ctdb, ctdb-tunable.recover_interval); + /* verify that the main daemon is still running */ + if (kill(ctdb-ctdbd_pid, 0) != 0) { + DEBUG(0,(CTDB daemon is no longer available. Shutting down recovery daemon\n)); + exit(-1); + } + if (rec-election_timeout) { /* an election is in progress */ goto again; @@ -2275,6 +2281,8 @@ return -1; } + ctdb-ctdbd_pid = getpid(); + ctdb-recoverd_pid = fork(); if (ctdb-recoverd_pid == -1) { return -1;
Rev 723: ensure tdb log messages appear in ctdbd logs in http://samba.org/~tridge/ctdb
revno: 723 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Sun 2008-01-06 12:35:49 +1100 message: ensure tdb log messages appear in ctdbd logs modified: lib/util/db_wrap.c db_wrap.c-20070125041102-mfc39bu6uof09lw6-1 lib/util/debug.c debug.c-20070417155854-2i3crb0irl716qft-1 lib/util/debug.h debug.h-20070417155854-2i3crb0irl716qft-2 === modified file 'lib/util/db_wrap.c' --- a/lib/util/db_wrap.c2007-07-10 05:29:31 + +++ b/lib/util/db_wrap.c2008-01-06 01:35:49 + @@ -44,6 +44,18 @@ return 0; } +static void log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...) +{ + if (level = TDB_DEBUG_ERROR) { + va_list ap; + + va_start(ap, fmt); + do_debug_v(fmt, ap); + va_end(ap); + } +} + + /* wrapped connection to a tdb database to close just talloc_free() the tdb_wrap pointer @@ -53,6 +65,10 @@ int open_flags, mode_t mode) { struct tdb_wrap *w; + struct tdb_logging_context log_ctx; + + log_ctx.log_fn = log_fn; + log_ctx.log_private = NULL; for (w=tdb_list;w;w=w-next) { if (strcmp(name, w-name) == 0) { @@ -67,8 +83,8 @@ w-name = talloc_strdup(w, name); - w-tdb = tdb_open(name, hash_size, tdb_flags, - open_flags, mode); + w-tdb = tdb_open_ex(name, hash_size, tdb_flags, +open_flags, mode, log_ctx, NULL); if (w-tdb == NULL) { talloc_free(w); return NULL; === modified file 'lib/util/debug.c' --- a/lib/util/debug.c 2007-08-07 03:40:13 + +++ b/lib/util/debug.c 2008-01-06 01:35:49 + @@ -22,17 +22,14 @@ #include unistd.h -void do_debug(const char *format, ...) +void do_debug_v(const char *format, va_list ap) { struct timeval t; - va_list ap; char *s = NULL; struct tm *tm; char tbuf[100]; - va_start(ap, format); vasprintf(s, format, ap); - va_end(ap); t = timeval_current(); tm = localtime(t.tv_sec); @@ -43,3 +40,12 @@ fflush(stderr); free(s); } + +void do_debug(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + do_debug_v(format, ap); + va_end(ap); +} === modified file 'lib/util/debug.h' --- a/lib/util/debug.h 2007-07-10 05:29:31 + +++ b/lib/util/debug.h 2008-01-06 01:35:49 + @@ -17,4 +17,5 @@ along with this program; if not, see http://www.gnu.org/licenses/. */ +void do_debug_v(const char *format, va_list ap); void do_debug(const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
Rev 722: - added tdb_add_flags() and tdb_remove_flags() in http://samba.org/~tridge/ctdb
revno: 722 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Sun 2008-01-06 12:33:57 +1100 message: - added tdb_add_flags() and tdb_remove_flags() - make freelist merging more paranoid - fixed TDB_DATA_STAART() (broken by earlier commit) modified: lib/tdb/common/freelist.c freelist.c-20070220022425-m1wibgjq7n5hahs6-4 lib/tdb/common/tdb.c tdb.c-20070220022425-m1wibgjq7n5hahs6-9 lib/tdb/common/tdb_private.h tdb_private.h-20070220022425-m1wibgjq7n5hahs6-10 lib/tdb/include/tdb.h tdb.h-20070125040949-7t3f5zdl1q4z9hyv-101 === modified file 'lib/tdb/common/freelist.c' --- a/lib/tdb/common/freelist.c 2008-01-05 01:09:00 + +++ b/lib/tdb/common/freelist.c 2008-01-06 01:33:57 + @@ -138,7 +138,7 @@ #endif /* Look left */ - if (offset - sizeof(tdb_off_t) = TDB_DATA_START(tdb-header.hash_size)) { + if (offset - sizeof(tdb_off_t) TDB_DATA_START(tdb-header.hash_size)) { tdb_off_t left = offset - sizeof(tdb_off_t); struct list_struct l; tdb_off_t leftsize; @@ -156,7 +156,8 @@ left = offset - leftsize; - if (left TDB_DATA_START(tdb-header.hash_size)) { + if (leftsize offset || + left TDB_DATA_START(tdb-header.hash_size)) { goto update; } === modified file 'lib/tdb/common/tdb.c' --- a/lib/tdb/common/tdb.c 2008-01-05 06:41:41 + +++ b/lib/tdb/common/tdb.c 2008-01-06 01:33:57 + @@ -666,6 +666,16 @@ return tdb-flags; } +void tdb_add_flags(struct tdb_context *tdb, unsigned flags) +{ + tdb-flags |= flags; +} + +void tdb_remove_flags(struct tdb_context *tdb, unsigned flags) +{ + tdb-flags = ~flags; +} + /* enable sequence number handling on an open tdb === modified file 'lib/tdb/common/tdb_private.h' --- a/lib/tdb/common/tdb_private.h 2008-01-05 06:41:41 + +++ b/lib/tdb/common/tdb_private.h 2008-01-06 01:33:57 + @@ -58,7 +58,7 @@ #define TDB_BAD_MAGIC(r) ((r)-magic != TDB_MAGIC !TDB_DEAD(r)) #define TDB_HASH_TOP(hash) (FREELIST_TOP + (BUCKET(hash)+1)*sizeof(tdb_off_t)) #define TDB_HASHTABLE_SIZE(tdb) ((tdb-header.hash_size+1)*sizeof(tdb_off_t)) -#define TDB_DATA_START(hash_size) TDB_HASH_TOP(hash_size) +#define TDB_DATA_START(hash_size) (TDB_HASH_TOP(hash_size-1) + sizeof(tdb_off_t)) #define TDB_RECOVERY_HEAD offsetof(struct tdb_header, recovery_start) #define TDB_SEQNUM_OFSoffsetof(struct tdb_header, sequence_number) #define TDB_PAD_BYTE 0x42 === modified file 'lib/tdb/include/tdb.h' --- a/lib/tdb/include/tdb.h 2008-01-05 06:41:41 + +++ b/lib/tdb/include/tdb.h 2008-01-06 01:33:57 + @@ -135,6 +135,8 @@ int tdb_hash_size(struct tdb_context *tdb); size_t tdb_map_size(struct tdb_context *tdb); int tdb_get_flags(struct tdb_context *tdb); +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); @@ -153,6 +155,7 @@ void tdb_dump_all(struct tdb_context *tdb); int tdb_printfreelist(struct tdb_context *tdb); int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries); +int tdb_wipe_all(struct tdb_context *tdb); extern TDB_DATA tdb_null;
Rev 725: change default tunables to cope with larger dbs in http://samba.org/~tridge/ctdb
revno: 725 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Sun 2008-01-06 12:36:58 +1100 message: change default tunables to cope with larger dbs modified: server/ctdb_tunables.c ctdb_tunables.c-20070604095258-4m34d7cm1qa7yos9-1 === modified file 'server/ctdb_tunables.c' --- a/server/ctdb_tunables.c2008-01-04 22:36:53 + +++ b/server/ctdb_tunables.c2008-01-06 01:36:58 + @@ -28,10 +28,10 @@ { SeqnumFrequency, 1, offsetof(struct ctdb_tunable, seqnum_frequency) }, { ControlTimeout, 60, offsetof(struct ctdb_tunable, control_timeout) }, { TraverseTimeout, 20, offsetof(struct ctdb_tunable, traverse_timeout) }, - { KeepaliveInterval,2, offsetof(struct ctdb_tunable, keepalive_interval) }, + { KeepaliveInterval,5, offsetof(struct ctdb_tunable, keepalive_interval) }, { KeepaliveLimit, 5, offsetof(struct ctdb_tunable, keepalive_limit) }, { MaxLACount, 7, offsetof(struct ctdb_tunable, max_lacount) }, - { RecoverTimeout, 5, offsetof(struct ctdb_tunable, recover_timeout) }, + { RecoverTimeout, 30, offsetof(struct ctdb_tunable, recover_timeout) }, { RecoverInterval, 1, offsetof(struct ctdb_tunable, recover_interval) }, { ElectionTimeout, 3, offsetof(struct ctdb_tunable, election_timeout) }, { TakeoverTimeout, 5, offsetof(struct ctdb_tunable, takeover_timeout) },
Rev 724: non-persistent databases don't need sync transactions in http://samba.org/~tridge/ctdb
revno: 724 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Sun 2008-01-06 12:36:30 +1100 message: non-persistent databases don't need sync transactions modified: server/ctdb_ltdb_server.c ctdb_ltdb_server.c-20070607120348-7r182h0nlqxysyss-1 === modified file 'server/ctdb_ltdb_server.c' --- a/server/ctdb_ltdb_server.c 2008-01-04 22:36:53 + +++ b/server/ctdb_ltdb_server.c 2008-01-06 01:36:30 + @@ -246,7 +246,7 @@ ctdb_db-ltdb = tdb_wrap_open(ctdb, ctdb_db-db_path, ctdb-tunable.database_hash_size, - persistent?TDB_DEFAULT:TDB_CLEAR_IF_FIRST, + persistent? TDB_DEFAULT : TDB_CLEAR_IF_FIRST | TDB_NOSYNC, O_CREAT|O_RDWR, 0666); if (ctdb_db-ltdb == NULL) { DEBUG(0,(Failed to open tdb '%s'\n, ctdb_db-db_path));
Rev 726: new simpler and much faster recovery code based on tdb transactions in http://samba.org/~tridge/ctdb
revno: 726 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Sun 2008-01-06 12:38:01 +1100 message: new simpler and much faster recovery code based on tdb transactions modified: client/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 server/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 server/ctdb_freeze.c ctdb_freeze.c-20070512051503-935zdtyuqknqnhmo-1 server/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 server/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 Diff too large for email (1640, the limit is 200).
Rev 728: new rpm version in http://samba.org/~tridge/ctdb
revno: 728 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Sun 2008-01-06 13:25:17 +1100 message: new rpm version modified: packaging/RPM/ctdb.specctdb.spec-20070527204758-biuh7znabuwan3zn-3 === modified file 'packaging/RPM/ctdb.spec' --- a/packaging/RPM/ctdb.spec 2008-01-04 22:52:53 + +++ b/packaging/RPM/ctdb.spec 2008-01-06 02:25:17 + @@ -5,7 +5,7 @@ Packager: Samba Team [EMAIL PROTECTED] Name: ctdb Version: 1.0 -Release: 19 +Release: 20 Epoch: 0 License: GNU GPL version 3 Group: System Environment/Daemons @@ -117,6 +117,8 @@ %{_includedir}/ctdb_private.h %changelog +* Sun Jan 06 2008 : Version 1.0.20 + - new transaction based recovery code * Sat Jan 05 2008 : Version 1.0.19 - fixed non-master bug - big speedup in recovery for large databases
Rev 727: added paranoid transaction ids in http://samba.org/~tridge/ctdb
revno: 727 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Sun 2008-01-06 13:24:55 +1100 message: added paranoid transaction ids modified: include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 server/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1 server/ctdb_freeze.c ctdb_freeze.c-20070512051503-935zdtyuqknqnhmo-1 server/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 Diff too large for email (209, the limit is 200).
Rev 708: a useful hack for checking correct behaviour of recovery in http://samba.org/~tridge/ctdb
revno: 708 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.kantana timestamp: Sat 2008-01-05 09:36:21 +1100 message: a useful hack for checking correct behaviour of recovery modified: server/ctdb_freeze.c ctdb_freeze.c-20070512051503-935zdtyuqknqnhmo-1 === modified file 'server/ctdb_freeze.c' --- a/server/ctdb_freeze.c 2007-07-10 05:29:31 + +++ b/server/ctdb_freeze.c 2008-01-04 22:36:21 + @@ -249,6 +249,10 @@ */ int32_t ctdb_control_thaw(struct ctdb_context *ctdb) { +#if 0 + /* this hack can be used to get a copy of the databases at the end of a recovery */ + system(mkdir -p /var/ctdb.saved; /usr/bin/rsync --delete -a /var/ctdb/ /var/ctdb.saved/$$ 21 /dev/null); +#endif talloc_free(ctdb-freeze_handle); ctdb-freeze_handle = NULL; ctdb_call_resend_all(ctdb);
Rev 707: convert much of the recovery logic to be async and parallel across all nodes in http://samba.org/~tridge/ctdb
revno: 707 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.kantana timestamp: Sat 2008-01-05 09:35:43 +1100 message: convert much of the recovery logic to be async and parallel across all nodes modified: server/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1 Diff too large for email (414, the limit is 200).
Rev 701: expand tdb by minimum of 25% at a time in http://samba.org/~tridge/ctdb
revno: 701 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.kantana timestamp: Sat 2008-01-05 09:30:09 +1100 message: expand tdb by minimum of 25% at a time modified: lib/tdb/common/io.cio.c-20070220022425-m1wibgjq7n5hahs6-6 === modified file 'lib/tdb/common/io.c' --- a/lib/tdb/common/io.c 2008-01-02 01:04:07 + +++ b/lib/tdb/common/io.c 2008-01-04 22:30:09 + @@ -211,7 +211,7 @@ says to use for mmap expansion */ static int tdb_expand_file(struct tdb_context *tdb, tdb_off_t size, tdb_off_t addition) { - char buf[1024]; + char buf[8192]; if (tdb-read_only || tdb-traverse_read) { tdb-ecode = TDB_ERR_RDONLY; @@ -251,7 +251,7 @@ int tdb_expand(struct tdb_context *tdb, tdb_off_t size) { struct list_struct rec; - tdb_off_t offset; + tdb_off_t offset, new_size; if (tdb_lock(tdb, -1, F_WRLCK) == -1) { TDB_LOG((tdb, TDB_DEBUG_ERROR, lock failed in tdb_expand\n)); @@ -261,9 +261,11 @@ /* 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 round - the database up to a multiple of the page size */ - size = TDB_ALIGN(tdb-map_size + size*100, tdb-page_size) - tdb-map_size; + /* always make room for at least 100 more records, and at + least 25% 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); + size = TDB_ALIGN(new_size, tdb-page_size) - tdb-map_size; if (!(tdb-flags TDB_INTERNAL)) tdb_munmap(tdb);
Rev 709: a new tunable DatabaseMaxDead that enables the tdb max dead cache logic in http://samba.org/~tridge/ctdb
revno: 709 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.kantana timestamp: Sat 2008-01-05 09:36:53 +1100 message: a new tunable DatabaseMaxDead that enables the tdb max dead cache logic modified: include/ctdb.h ctdb.h-20061117234101-o3qt14umlg9en8z0-11 include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13 server/ctdb_ltdb_server.c ctdb_ltdb_server.c-20070607120348-7r182h0nlqxysyss-1 server/ctdb_tunables.c ctdb_tunables.c-20070604095258-4m34d7cm1qa7yos9-1 === modified file 'include/ctdb.h' --- a/include/ctdb.h2007-11-29 23:00:04 + +++ b/include/ctdb.h2008-01-04 22:36:53 + @@ -297,7 +297,36 @@ struct ctdb_ltdb_header *headers; TDB_DATA *data; }; -int ctdb_ctrl_pulldb(struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid, uint32_t lmaster, TALLOC_CTX *mem_ctx, struct ctdb_key_list *keys); + +int ctdb_ctrl_pulldb( + struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid, + uint32_t lmaster, TALLOC_CTX *mem_ctx, + struct timeval timeout, TDB_DATA *outdata); + +struct ctdb_client_control_state *ctdb_ctrl_pulldb_send( + struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid, + uint32_t lmaster, TALLOC_CTX *mem_ctx, struct timeval timeout); + +int ctdb_ctrl_pulldb_recv( + struct ctdb_context *ctdb, + TALLOC_CTX *mem_ctx, struct ctdb_client_control_state *state, + TDB_DATA *outdata); + +int ctdb_ctrl_pushdb( + struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid, + TALLOC_CTX *mem_ctx, + struct timeval timeout, TDB_DATA indata); + +struct ctdb_client_control_state *ctdb_ctrl_pushdb_send( + struct ctdb_context *ctdb, uint32_t destnode, uint32_t dbid, + TALLOC_CTX *mem_ctx, struct timeval timeout, + TDB_DATA indata); + +int ctdb_ctrl_pushdb_recv( + struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, + struct ctdb_client_control_state *state); + + int ctdb_ctrl_copydb(struct ctdb_context *ctdb, struct timeval timeout, uint32_t sourcenode, uint32_t destnode, uint32_t dbid, uint32_t lmaster, === modified file 'include/ctdb_private.h' --- a/include/ctdb_private.h2007-11-29 23:09:54 + +++ b/include/ctdb_private.h2008-01-04 22:36:53 + @@ -86,6 +86,7 @@ uint32_t recovery_grace_period; uint32_t recovery_ban_period; uint32_t database_hash_size; + uint32_t database_max_dead; uint32_t rerecovery_timeout; uint32_t enable_bans; uint32_t deterministic_public_ips; @@ -1058,8 +1059,25 @@ void ctdb_node_connected(struct ctdb_node *node); bool ctdb_blocking_freeze(struct ctdb_context *ctdb); int32_t ctdb_control_max_rsn(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DATA *outdata); + +struct ctdb_client_control_state *ctdb_ctrl_set_rsn_nonempty_send( + struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, + uint32_t destnode, uint32_t db_id, uint64_t rsn); +int ctdb_ctrl_set_rsn_nonempty_recv(struct ctdb_context *ctdb, + struct ctdb_client_control_state *state); +int ctdb_ctrl_set_rsn_nonempty(struct ctdb_context *ctdb, struct timeval timeout, + uint32_t destnode, uint32_t db_id, uint64_t rsn); +struct ctdb_client_control_state *ctdb_ctrl_delete_low_rsn_send( + struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, struct timeval timeout, + uint32_t destnode, uint32_t db_id, uint64_t rsn); +int ctdb_ctrl_delete_low_rsn_recv(struct ctdb_context *ctdb, + struct ctdb_client_control_state *state); +int ctdb_ctrl_delete_low_rsn(struct ctdb_context *ctdb, struct timeval timeout, +uint32_t destnode, uint32_t db_id, uint64_t rsn); + int32_t ctdb_control_set_rsn_nonempty(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DATA *outdata); int32_t ctdb_control_delete_low_rsn(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DATA *outdata); + int ctdb_ctrl_get_max_rsn(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, uint32_t db_id, uint64_t *max_rsn); int ctdb_ctrl_set_rsn_nonempty(struct ctdb_context *ctdb, struct timeval timeout, === modified file 'server/ctdb_ltdb_server.c' --- a/server/ctdb_ltdb_server.c 2007-09-21 03:47:40 + +++ b/server/ctdb_ltdb_server.c 2008-01-04 22:36:53 + @@ -260,6 +260,9 @@ DLIST_ADD(ctdb-db_list, ctdb_db); + /* setting this can help some high churn databases */ + tdb_set_max_dead(ctdb_db-ltdb-tdb, ctdb-tunable.database_max_dead); + /* all databases support the null function. we need this in order to do forced migration of records === modified file 'server/ctdb_tunables.c' ---
Rev 702: fixed a warning in http://samba.org/~tridge/ctdb
revno: 702 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.kantana timestamp: Sat 2008-01-05 09:30:49 +1100 message: fixed a warning modified: server/ctdb_takeover.c ctdb_takeover.c-20070525071636-a5n1ihghjtppy08r-2 === modified file 'server/ctdb_takeover.c' --- a/server/ctdb_takeover.c2007-12-02 23:19:24 + +++ b/server/ctdb_takeover.c2008-01-04 22:30:49 + @@ -1738,10 +1738,10 @@ ( offsetof(struct ctdb_control_gratious_arp, iface) + gratious_arp-len ) ){ - DEBUG(0,(__location__ Wrong size of indata. Was %d bytes - but should be %d bytes\n, - indata.dsize, - offsetof(struct ctdb_control_gratious_arp, iface)+gratious_arp-len)); + DEBUG(0,(__location__ Wrong size of indata. Was %u bytes + but should be %u bytes\n, +(unsigned)indata.dsize, +(unsigned)(offsetof(struct ctdb_control_gratious_arp, iface)+gratious_arp-len))); return -1; }
Rev 705: avoid write locks during delete checks in traversals in http://samba.org/~tridge/ctdb
revno: 705 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.kantana timestamp: Sat 2008-01-05 09:33:39 +1100 message: avoid write locks during delete checks in traversals modified: lib/tdb/common/tdb.c tdb.c-20070220022425-m1wibgjq7n5hahs6-9 lib/tdb/common/tdb_private.h tdb_private.h-20070220022425-m1wibgjq7n5hahs6-10 lib/tdb/common/traverse.c traverse.c-20070220022425-m1wibgjq7n5hahs6-12 === modified file 'lib/tdb/common/tdb.c' --- a/lib/tdb/common/tdb.c 2007-07-10 05:32:27 + +++ b/lib/tdb/common/tdb.c 2008-01-04 22:33:39 + @@ -243,7 +243,8 @@ if (tdb-read_only || tdb-traverse_read) return -1; - if (tdb_write_lock_record(tdb, rec_ptr) == -1) { + if (tdb-traverse_write != 0 || + tdb_write_lock_record(tdb, rec_ptr) == -1) { /* Someone traversing here: mark it as dead */ rec-magic = TDB_DEAD_MAGIC; return tdb_rec_write(tdb, rec_ptr, rec); === modified file 'lib/tdb/common/tdb_private.h' --- a/lib/tdb/common/tdb_private.h 2007-07-10 05:32:27 + +++ b/lib/tdb/common/tdb_private.h 2008-01-04 22:33:39 + @@ -151,6 +151,7 @@ tdb_len_t map_size; /* how much space has been mapped */ int read_only; /* opened read-only */ int traverse_read; /* read-only traversal */ + int traverse_write; /* read-write traversal */ struct tdb_lock_type global_lock; int num_lockrecs; struct tdb_lock_type *lockrecs; /* only real locks, all with count0 */ === modified file 'lib/tdb/common/traverse.c' --- a/lib/tdb/common/traverse.c 2007-07-10 05:32:27 + +++ b/lib/tdb/common/traverse.c 2008-01-04 22:33:39 + @@ -238,7 +238,9 @@ return -1; } + tdb-traverse_write++; ret = tdb_traverse_internal(tdb, fn, private_data, tl); + tdb-traverse_write--; tdb_transaction_unlock(tdb);
Rev 703: added async pull, push and rsn handling functions in http://samba.org/~tridge/ctdb
revno: 703 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.kantana timestamp: Sat 2008-01-05 09:31:43 +1100 message: added async pull, push and rsn handling functions modified: client/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1 Diff too large for email (340, the limit is 200).
Rev 704: make some specific cases of the non-dmaster bug non-fatal in http://samba.org/~tridge/ctdb
revno: 704 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.kantana timestamp: Sat 2008-01-05 09:32:29 +1100 message: make some specific cases of the non-dmaster bug non-fatal modified: server/ctdb_call.c ctdb_call.c-20061128065342-to93h6eejj5kon81-1 === modified file 'server/ctdb_call.c' --- a/server/ctdb_call.c2007-09-04 00:47:02 + +++ b/server/ctdb_call.c2008-01-04 22:32:29 + @@ -322,11 +322,22 @@ /* its a protocol error if the sending node is not the current dmaster */ if (header.dmaster != hdr-srcnode) { - DEBUG(0,(pnn %u dmaster request non-master %u dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u\n, -ctdb-pnn, hdr-srcnode, header.dmaster, ctdb_hash(key), -ctdb_db-db_id, hdr-generation, ctdb-vnn_map-generation)); - ctdb_fatal(ctdb, ctdb_req_dmaster from non-master); - return; + DEBUG(0,(pnn %u dmaster request for new-dmaster %u from non-master %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c-rsn=%llu header.rsn=%llu reqid=%u keyval=0x%08x\n, +ctdb-pnn, c-dmaster, hdr-srcnode, header.dmaster, ctdb_hash(key), +ctdb_db-db_id, hdr-generation, ctdb-vnn_map-generation, +(unsigned long long)c-rsn, (unsigned long long)header.rsn, c-hdr.reqid, +(key.dsize = 4)?(*(uint32_t *)key.dptr):0)); + if (header.rsn != 0 || header.dmaster != ctdb-pnn) { + ctdb_fatal(ctdb, ctdb_req_dmaster from non-master); + return; + } + } + + if (header.rsn c-rsn) { + DEBUG(0,(pnn %u dmaster request with older RSN new-dmaster %u from %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c-rsn=%llu header.rsn=%llu reqid=%u\n, +ctdb-pnn, c-dmaster, hdr-srcnode, header.dmaster, ctdb_hash(key), +ctdb_db-db_id, hdr-generation, ctdb-vnn_map-generation, +(unsigned long long)c-rsn, (unsigned long long)header.rsn, c-hdr.reqid)); } /* use the rsn from the sending node */
Rev 706: this fixes the non-dmaster bug that has plagued us for months in http://samba.org/~tridge/ctdb
revno: 706 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.kantana timestamp: Sat 2008-01-05 09:34:47 +1100 message: this fixes the non-dmaster bug that has plagued us for months modified: server/ctdb_recover.c ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1 === modified file 'server/ctdb_recover.c' --- a/server/ctdb_recover.c 2008-01-03 22:19:06 + +++ b/server/ctdb_recover.c 2008-01-04 22:34:47 + @@ -303,7 +303,7 @@ rec = (struct ctdb_rec_data *)reply-data[0]; - DEBUG(3,(starting push of %u records for dbid 0x%x\n, + DEBUG(1,(starting push of %u records for dbid 0x%x\n, reply-count, reply-db_id)); for (i=0;ireply-count;i++) { @@ -328,31 +328,16 @@ DEBUG(0, (__location__ Unable to fetch record\n)); goto failed; } + /* The check for dmaster gives priority to the dmaster if the rsn values are equal */ - if (header.rsn hdr-rsn || - (header.dmaster != ctdb-pnn header.rsn == hdr-rsn)) { -#if 0 - /* this is a push optimisation - we can skip writing the record if: - - 1) this is not a persistent db - AND 2) we are not the recmaster - AND 3) we don't hold the record currently - AND 4) we won't hold the new record - */ - if (!ctdb_db-persistent - ctdb-recovery_master != ctdb-pnn - header.dmaster != ctdb-pnn - hdr-dmaster != ctdb-pnn) { - DEBUG(5,(Skipping push of record\n)); - } else -#endif -{ - ret = ctdb_ltdb_store(ctdb_db, key, hdr, data); - if (ret != 0) { - DEBUG(0, (__location__ Unable to store record\n)); - goto failed; - } + if (ctdb-pnn != ctdb-recovery_master || + header.rsn hdr-rsn || + (header.dmaster != ctdb-recovery_master header.rsn == hdr-rsn)) { + ret = ctdb_ltdb_store(ctdb_db, key, hdr, data); + if (ret != 0) { + DEBUG(0, (__location__ Unable to store record\n)); + goto failed; } } @@ -389,6 +374,9 @@ DEBUG(0,(__location__ failed to write tdb data back ret:%d\n,ret)); return ret; } + + /* TODO: add error checking here */ + return 0; }
Rev 714: fixed the bug that make onnode N service ctdb start hang in http://samba.org/~tridge/ctdb
revno: 714 revision-id:[EMAIL PROTECTED] parent: [EMAIL PROTECTED] committer: Andrew Tridgell [EMAIL PROTECTED] branch nick: tridge.stable timestamp: Sat 2008-01-05 12:09:29 +1100 message: fixed the bug that make onnode N service ctdb start hang modified: server/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1 === modified file 'server/ctdb_daemon.c' --- a/server/ctdb_daemon.c 2007-11-11 23:53:11 + +++ b/server/ctdb_daemon.c 2008-01-05 01:09:29 + @@ -597,6 +597,11 @@ if (do_fork) { setsid(); + close(0); + if (open(/dev/null, O_RDONLY) != 0) { + DEBUG(0,(__location__ Failed to setup stdin on /dev/null\n)); + exit(11); + } } block_signal(SIGPIPE);