[SCM] CTDB repository - branch 1.2 updated - ctdb-1.9.1-401-g91410b7

Ronnie Sahlberg sahlberg at samba.org
Tue Mar 15 22:58:24 MDT 2011


The branch, 1.2 has been updated
       via  91410b7040bc6a3ded7f7057304e3e80157912fe (commit)
       via  0bdd0b932ec205dcdf02e9e305203dd1ed8964a8 (commit)
       via  8342d7bb23a8031424bd023f538b62d18b9c9143 (commit)
       via  2fd5ff854b434c3c7733f8c03d8ffce50616ea0c (commit)
       via  e5cebbdcb4d6e97e2ce1cf48b054cac224149e92 (commit)
       via  3048e29a9fbcda70e2aa00e1c84aea37ec96dd95 (commit)
       via  dd2c3cb864ccf9fe98fb21681db231e211701881 (commit)
       via  7652d58f6efa09e85c7855be0d62081bf6f0d022 (commit)
       via  78a6ff5a3e8e56dc253068724dc4276f05b7473e (commit)
       via  7b0654cc3f9ddafb6eda27a0daba304d3e3dc93c (commit)
       via  3767b3298639fd41f757a6bb9aa3abd7f88dffb2 (commit)
       via  e5692fe7bf779c1e562431d37e9a84a84b9b6b0d (commit)
       via  6ef458bd4b192fff501a3e301f3e89df2563b322 (commit)
       via  297a66f43d0369fab6628cd8ecd167d69cc62eb6 (commit)
       via  06340511fea8c477afdf31e55447e6b74f1a092c (commit)
       via  15a09bc5806cbbc877c8f874286e416688a9e59d (commit)
       via  299f70a7fc84abdedc5a38ae4222df19161c6e5b (commit)
       via  15d23a4b00b8c85ff43ae636775eec1f970999a4 (commit)
       via  6e58a240adc7dbfac2cec2a9d53eb19822476acd (commit)
       via  5392ab6164af97f1a396eae01f9b7a959e214032 (commit)
       via  a1538ada954dc983a3d4285f39df972dab6ddb17 (commit)
       via  7247a8fe8b2a743c08838f6b157aabc3e38f2ddf (commit)
       via  4239a6fafe3970d130970117c9874d11341f67f3 (commit)
       via  561d6f757f852918ca6b2db2cce267eaed19a4ba (commit)
       via  1c262b49edf810405246d4f0ebe241f88e7ef1a3 (commit)
       via  1b82a986e87626f297496f8fb48c9e698b683d2a (commit)
       via  b4ca0e045c3324f9b7e6e36dd0696483ec1fdb67 (commit)
       via  790c16a48d9342afa8025b4b926a20535149652b (commit)
       via  de2795b7bc2df88f67de742a2e86f530706e6657 (commit)
       via  8fbcf29e4297b26b83441332ce363b13d8fcf379 (commit)
       via  290107a7b946e0d753952e965fa87129ead4c0b6 (commit)
       via  f0609ea8bfb232c4baa191c75abd604fef4cbf2b (commit)
       via  eb79d483bdfb32b4d32ed7f35bd1c9759bc2deb5 (commit)
       via  95475ed390ed20449adeac0cbdcf5527c50f334b (commit)
       via  27adf4fc73b662f451dc375238f68444e2f68883 (commit)
       via  51715899e7d3b949c6048e41f961ca7c8d485024 (commit)
       via  66bb65f9bcb1a22eb53d1ebdd5dc8f5a7c9da06e (commit)
       via  7f99d6c6b05f6cf835b4aea386ab70412f4bbdfb (commit)
       via  5f6f0192f53d25e1eab301bfefd53162c0256d50 (commit)
       via  ac4b3c4f7774b042b0701aaac7076da0808cf9f7 (commit)
       via  230f5227cf105733f145b85c58a851ed4653b478 (commit)
       via  dd109f9e02ec885cb19ecf057a3c9bb30ba36f49 (commit)
       via  f235cc4de87c9e4ea397d5dcb34016dfcc9411a0 (commit)
       via  370abbfcb3f81b97017c1613721a31a444583558 (commit)
       via  d328bfaa86b671bb3617e4656021fbd3af7b7151 (commit)
       via  77249785f6f520c412b7c28d4b5e77d2b4e62696 (commit)
       via  f1a3aa079f033bf85041ab4db421fde6b833dcc8 (commit)
       via  2cbaf05e14f493fb430bb4e7a9db72d5e533c3e0 (commit)
       via  68202fb89a1fb594e1f2717573c5327cea36a828 (commit)
       via  017d24dd0adc48ab898fc755d5112db6a55e092e (commit)
       via  8fe83b8ede4e9dd730c167d44f35a01b942cd486 (commit)
       via  16955e32e7119e529c038e74e6a50e60bf68f030 (commit)
       via  76e88354b2e39a376bef5f79cfbd4733a83ce40e (commit)
       via  ee5277136bc8223fc76d16e2abb82a74d818983b (commit)
       via  942604d9c87db6840cbec680ae2b14bfd62119e0 (commit)
       via  12a4c89f19622a9d7941feabc1ff46ac35baa22c (commit)
       via  1dc4fa53c4db0c7b54db31a88b3228835b3f14a1 (commit)
       via  0837fc898743032f8a1f774f02a6bfe076dee73c (commit)
       via  05777b42ceb103981d6f7a33386104ce4d71b949 (commit)
       via  88fbdba3712b312fd57454c9d2e3a33700572f59 (commit)
       via  4a34b5c863bf4e007ebc807fd955e401e13ee847 (commit)
       via  ecd02cbaf8ce5df646f453ac76f335a1f9082438 (commit)
       via  93148b5308306c27b0b672c565c7b324ab263bd0 (commit)
       via  df46cd2c862e45311b6db05a763b27d90b676f01 (commit)
       via  eb6652c00456d7a24317790a16177600ff326c66 (commit)
       via  b3ceec608069177e9bcf23e8ea963b229838cd59 (commit)
       via  5bab0f2d3f75ca8b91c7517a69e687e37d9abc8e (commit)
       via  4769729cfb8aa549044f3efb0bf69e8c1c73322f (commit)
       via  669fd6c8c72e7e6225d65da98e1fe03967826372 (commit)
      from  d93b1e0a7a71914488cd43fa455478ba9596e255 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2


- Log -----------------------------------------------------------------
commit 91410b7040bc6a3ded7f7057304e3e80157912fe
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Wed Mar 16 14:55:58 2011 +1100

    Deferred attach: create the timed event as a child context of the da context we want to delete.
    Othwervise the da context can be timed out and talloc_free()d
    but the event for this already freed object will still trigger,
    causing a talloc error and shutdown.
    
    CQ S1022515

commit 0bdd0b932ec205dcdf02e9e305203dd1ed8964a8
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon Mar 14 10:12:37 2011 +1100

    New version 1.2.25

commit 8342d7bb23a8031424bd023f538b62d18b9c9143
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon Mar 14 09:55:28 2011 +1100

    IP reallocation. If a public address is already hosted on the node when we startup, log a warning message but do not cause the recovery to fail.
    
    CQ S1022356

commit 2fd5ff854b434c3c7733f8c03d8ffce50616ea0c
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Sun Mar 13 11:30:52 2011 +1100

    Vacuuming: initialize a variable to avoid a harmless valgrind hit

commit e5cebbdcb4d6e97e2ce1cf48b054cac224149e92
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Sat Mar 12 09:42:07 2011 +1100

    Dont allow clients to connect to databases untile we are well past and through
    the initial recovery phase
    
    CQ S1022412

commit 3048e29a9fbcda70e2aa00e1c84aea37ec96dd95
Author: Michael Adam <obnox at samba.org>
Date:   Mon Feb 21 15:55:16 2011 +1100

    New version 1.2.24.

commit dd2c3cb864ccf9fe98fb21681db231e211701881
Author: Michael Adam <obnox at samba.org>
Date:   Fri Mar 11 16:05:44 2011 +0100

    vacuum: fix a comment typo

commit 7652d58f6efa09e85c7855be0d62081bf6f0d022
Author: Michael Adam <obnox at samba.org>
Date:   Fri Mar 11 15:57:45 2011 +0100

    vacuum: use insert_record_into_delete_queue in ctdb_local_schedule_for_deletion.
    
    This is to take advantage of the hash collision handling and logging
    also in ctdb_local_schedule_for_deletion.

commit 78a6ff5a3e8e56dc253068724dc4276f05b7473e
Author: Michael Adam <obnox at samba.org>
Date:   Fri Mar 11 15:55:52 2011 +0100

    vacuum: refactor insert_record_into_delete_queue out of ctdb_control_schedule_for_deletion

commit 7b0654cc3f9ddafb6eda27a0daba304d3e3dc93c
Author: Michael Adam <obnox at samba.org>
Date:   Fri Mar 11 14:57:15 2011 +0100

    vacuum: raise a debug level from INFO to DEBUG
    
    when overwriting an existing entry in the delete_queue.

commit 3767b3298639fd41f757a6bb9aa3abd7f88dffb2
Author: Michael Adam <obnox at samba.org>
Date:   Wed Nov 24 08:01:01 2010 +0100

    server: add a comment explaining the call redirect logic in ctdb_call_send_redirect().

commit e5692fe7bf779c1e562431d37e9a84a84b9b6b0d
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 3 16:32:23 2011 +0100

    ctdb_ltdb_store_server: honour the AUTOMATIC record flag
    
    Do not delete empty records that carry this flag but store
    them and schedule them for deletetion. Do not store the flag
    in the ltdb though, since this is internal only and should not
    be visible to the client.

commit 6ef458bd4b192fff501a3e301f3e89df2563b322
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 3 16:30:52 2011 +0100

    ltdb: add the CTDB_REC_FLAG_AUTOMATIC to the initial header in ctdb_ltdb_fetch()
    
    Signals that this record was not created by a client level store.

commit 297a66f43d0369fab6628cd8ecd167d69cc62eb6
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 3 16:27:42 2011 +0100

    ctdb_private.h: add record flag CTDB_REC_FLAG_AUTOMATIC
    
    This is a flag that shall signa that a record has been automatically generated by ctdb
    and not by an explicit client store operation. This will be used in the ctdb_ltdb_fetch
    operation which stores an empty record with default initial header before trying to
    migrate the record from the dmaster when the record does not exist in the local tdb.

commit 06340511fea8c477afdf31e55447e6b74f1a092c
Author: Michael Adam <obnox at samba.org>
Date:   Tue Dec 28 13:19:22 2010 +0100

    ctdb_ltdb_store_server: add ability to send SCHEDULE_FOR_DELETION control to ctdb_ltdb_store.

commit 15a09bc5806cbbc877c8f874286e416688a9e59d
Author: Michael Adam <obnox at samba.org>
Date:   Tue Dec 21 18:08:11 2010 +0100

    ctdb_ltdb_store_server: Improve debug message in ctdb_ltdb_store when store or delete fails.

commit 299f70a7fc84abdedc5a38ae4222df19161c6e5b
Author: Michael Adam <obnox at samba.org>
Date:   Tue Dec 21 17:50:52 2010 +0100

    ctdb_ltdb_store_server: always store the data when ctdb_ltdb_store() is called from the client
    
    This also fixes a segfault since ctdb_lmaster uses the vnn_map.

commit 15d23a4b00b8c85ff43ae636775eec1f970999a4
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 10 14:13:50 2010 +0100

    ctdb_ltdb_store_server: implement fastpath vacuuming deletion based on VACUUM_MIGRATED flag.
    
    When the record has been obtained by the lmaster as part of the vacuuming-fetch
    handler and it is empty and never been migrated with data, then such records
    are deleted instead of being stored. These records have automatically been
    deleted when leaving the former dmaster, so that they vanish for good when
    hitting the lmaster in this way. This will reduces the load on traditional
    vacuuming.
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>

commit 6e58a240adc7dbfac2cec2a9d53eb19822476acd
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 3 15:29:21 2010 +0100

    ctdb_ltdb_store_server: delete an empty record that is safe to delete instead of storing locally.
    
    When storing a record that is being migrated off to another node
    and has never been migrated with data, then we can safely delete it
    from the local tdb instead of storing the record with empty data.
    
    Note: This record is not deleted if we are its lmaster or dmaster.
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>

commit 5392ab6164af97f1a396eae01f9b7a959e214032
Author: Michael Adam <obnox at samba.org>
Date:   Thu Dec 30 18:19:32 2010 +0100

    server: Use the ctdb_ltdb_store_server() in the ctdb daemon for non-persistent dbs
    
    This is realized by adding a ctdb_ltdb_store_fn function pointer to the db
    context and filling it in the attach procedure for non-persistent dbs.

commit a1538ada954dc983a3d4285f39df972dab6ddb17
Author: Michael Adam <obnox at samba.org>
Date:   Thu Dec 30 17:44:51 2010 +0100

    server: create a server variant ctdb_ltdb_store_server() of ctdb_ltdb_store().
    
    This is supposed to contain logic for deleting records that are safe
    to delete and scheduling records for deletion. It will be called in
    server context for non-persistent databases instead of the standard
    ctdb_ltdb_store() function.

commit 7247a8fe8b2a743c08838f6b157aabc3e38f2ddf
Author: Michael Adam <obnox at samba.org>
Date:   Tue Dec 28 13:14:23 2010 +0100

    daemon: fill ctdb->ctdbd_pid early

commit 4239a6fafe3970d130970117c9874d11341f67f3
Author: Michael Adam <obnox at samba.org>
Date:   Tue Dec 21 15:29:46 2010 +0100

    test: send SCHEDULE_FOR_DELETION control from randrec test.

commit 561d6f757f852918ca6b2db2cce267eaed19a4ba
Author: Michael Adam <obnox at samba.org>
Date:   Tue Dec 21 15:29:23 2010 +0100

    client: add accessor function ctdb_header_from_record_handle().

commit 1c262b49edf810405246d4f0ebe241f88e7ef1a3
Author: Michael Adam <obnox at samba.org>
Date:   Tue Dec 28 13:13:34 2010 +0100

    vacuum: add ctdb_local_schedule_for_deletion()

commit 1b82a986e87626f297496f8fb48c9e698b683d2a
Author: Michael Adam <obnox at samba.org>
Date:   Tue Dec 21 14:25:48 2010 +0100

    server: implement a new control SCHEDULE_FOR_DELETION to fill the delete_queue.

commit b4ca0e045c3324f9b7e6e36dd0696483ec1fdb67
Author: Michael Adam <obnox at samba.org>
Date:   Wed Mar 9 00:57:55 2011 +0100

    control: add a new control opcode CTDB_CONTROL_SCHEDULE_FOR_DELETION

commit 790c16a48d9342afa8025b4b926a20535149652b
Author: Michael Adam <obnox at samba.org>
Date:   Wed Mar 9 00:56:25 2011 +0100

    control: add macro CHECK_CONTROL_MIN_DATA_SIZE.
    
    This is for the control dispatcher to check whether the input data has
    a required minimum size.

commit de2795b7bc2df88f67de742a2e86f530706e6657
Author: Michael Adam <obnox at samba.org>
Date:   Thu Dec 23 11:54:09 2010 +0100

    vacuum: lower level of hash collision debug message to INFO

commit 8fbcf29e4297b26b83441332ce363b13d8fcf379
Author: Michael Adam <obnox at samba.org>
Date:   Thu Dec 23 00:27:27 2010 +0100

    vacuum: add statistics output to the fast and full traverse runs.

commit 290107a7b946e0d753952e965fa87129ead4c0b6
Author: Michael Adam <obnox at samba.org>
Date:   Tue Dec 21 14:19:00 2010 +0100

    vacuum: refactor insert_delete_record_data_into_tree() out of add_record_to_delete_tree()
    
    for reuse in filling the delete_queue.

commit f0609ea8bfb232c4baa191c75abd604fef4cbf2b
Author: Michael Adam <obnox at samba.org>
Date:   Mon Dec 20 21:43:41 2010 +0100

    vacuum: change all Vacuum*Interval tunables to default to 10
    
    So, by default we have a fastpath vacuuming every 10 seconds and
    full blown db-traverse vacuuming once every 10 minutes.

commit eb79d483bdfb32b4d32ed7f35bd1c9759bc2deb5
Author: Michael Adam <obnox at samba.org>
Date:   Mon Dec 20 21:30:39 2010 +0100

    vacuum: disable full db-traverse vacuuming runs when VacuumFastPathCount == 0

commit 95475ed390ed20449adeac0cbdcf5527c50f334b
Author: Michael Adam <obnox at samba.org>
Date:   Mon Dec 20 18:03:38 2010 +0100

    vacuum: Only run full vacuumig (db traverse) every VacuumFastPathCount times.

commit 27adf4fc73b662f451dc375238f68444e2f68883
Author: Michael Adam <obnox at samba.org>
Date:   Mon Dec 20 17:54:04 2010 +0100

    vacuum: reset the fast path count in the event handle if it exceeds the limit.

commit 51715899e7d3b949c6048e41f961ca7c8d485024
Author: Michael Adam <obnox at samba.org>
Date:   Mon Dec 20 17:49:29 2010 +0100

    vacuum: bump the number of fast-path runs in the vacuum child destructor

commit 66bb65f9bcb1a22eb53d1ebdd5dc8f5a7c9da06e
Author: Michael Adam <obnox at samba.org>
Date:   Mon Dec 20 17:44:02 2010 +0100

    vacuum: add a fast_path_count to the vacuum_handle.

commit 7f99d6c6b05f6cf835b4aea386ab70412f4bbdfb
Author: Michael Adam <obnox at samba.org>
Date:   Mon Dec 20 17:42:25 2010 +0100

    Add a tunable VacuumFastPathCount.
    
    This will control how many fast-path vacuuming runs wil have to
    be done, before a full vacuuming will be triggered, i.e. one with
    a db-traversal.

commit 5f6f0192f53d25e1eab301bfefd53162c0256d50
Author: Michael Adam <obnox at samba.org>
Date:   Mon Dec 20 17:25:35 2010 +0100

    vacuum: traverse the delete_queue befor traversing the database.

commit ac4b3c4f7774b042b0701aaac7076da0808cf9f7
Author: Michael Adam <obnox at samba.org>
Date:   Mon Dec 20 17:24:32 2010 +0100

    vacuum: add delete_queue_traverse() for traversal of the delete_queue.

commit 230f5227cf105733f145b85c58a851ed4653b478
Author: Michael Adam <obnox at samba.org>
Date:   Tue Dec 21 11:22:50 2010 +0100

    vacuum: reduce indentation in add_record_to_delete_tree()
    
    This simplyfies the logical structure a bit by using early return.

commit dd109f9e02ec885cb19ecf057a3c9bb30ba36f49
Author: Michael Adam <obnox at samba.org>
Date:   Mon Dec 20 17:11:27 2010 +0100

    vacuum: refactor new add_record_to_delete_tree() out of vacuum_traverse().
    
    This will be reused by the traversal of the delete_queue list.

commit f235cc4de87c9e4ea397d5dcb34016dfcc9411a0
Author: Michael Adam <obnox at samba.org>
Date:   Mon Dec 20 16:41:13 2010 +0100

    vacuum: skip adding records to list of records to send to lmaster on lmaster
    
    This list is skipped afterwards when the lists are processed.

commit 370abbfcb3f81b97017c1613721a31a444583558
Author: Michael Adam <obnox at samba.org>
Date:   Mon Dec 20 16:31:27 2010 +0100

    vacuum: refactor new add_record_to_vacuum_fetch_list() out of vacuum_traverse().
    
    This is the function that fills the list of records to send to each lmaster
    with the VACUUM_FETCH message.
    
    This function will be reused in the traverse function for the delete_queue.

commit d328bfaa86b671bb3617e4656021fbd3af7b7151
Author: Michael Adam <obnox at samba.org>
Date:   Mon Dec 20 10:55:53 2010 +0100

    server: rename ctdb_repack_db() to ctdb_vacuum_and_repack_db()

commit 77249785f6f520c412b7c28d4b5e77d2b4e62696
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 17 02:22:02 2010 +0100

    When wiping a database, clear the delete_queue.

commit f1a3aa079f033bf85041ab4db421fde6b833dcc8
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 17 01:53:25 2010 +0100

    vaccum: clear the fast-path vacuuming delete_queue after creating the vacuuming child.
    
    Maybe we should keep a copy for the case that the vacuuming fails?

commit 2cbaf05e14f493fb430bb4e7a9db72d5e533c3e0
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 17 01:38:09 2010 +0100

    When attaching to a non-persistent DB, initialize the delete_queue.

commit 68202fb89a1fb594e1f2717573c5327cea36a828
Author: Michael Adam <obnox at samba.org>
Date:   Wed Dec 22 14:50:53 2010 +0100

    Add a delete_queue to the ctdb database context struct.
    
    This list will be filled by the client using a new
    delete control. The list will then be used to implement
    a fast-path vacuuming that will traverse this list instead
    of traversing the database.

commit 017d24dd0adc48ab898fc755d5112db6a55e092e
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 10 14:11:38 2010 +0100

    call: becoming dmaster in VACUUM_MIGRATION, set the VACUUM_MIGRATED record flag
    
    This temporary flag is used for the local record storage function to
    decide whether to delete an empty record which has never been migrated
    with data as part of the fast-path vacuuming process or, or to store
    the record.

commit 8fe83b8ede4e9dd730c167d44f35a01b942cd486
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 10 14:07:21 2010 +0100

    call: hand the submitted record_flags to local record storage function.

commit 16955e32e7119e529c038e74e6a50e60bf68f030
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 10 14:02:33 2010 +0100

    call: transfer the record flags in the ctdb call packets.
    
    This way, the MIGRATED_WITH_DATA information can be transported
    along with the records. This is important for vacuuming to function
    properly.
    
    The record flags are appended to the data section of the ctdb_req_dmaster
    and ctdb_reply_dmaster structs.
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>

commit 76e88354b2e39a376bef5f79cfbd4733a83ce40e
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 10 13:59:37 2010 +0100

    server: in the VACUUM_FETCH handler, add the VACUUM_MIGRAION to the call flags
    
    This way, the records coming in via this handler, can be treated appropriately.
    Namely, they can be deleted instead of being stored when the meet the fast-path
    vacuuming criteria (empty, never migrated with data...)

commit ee5277136bc8223fc76d16e2abb82a74d818983b
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 10 13:57:01 2010 +0100

    add a new record flag CTDB_REC_FLAG_VACUUM_MIGRATED.
    
    This is to be used internally. The purpose is to flag a record
    as been migrated by a VACUUM_MIGRATION, which is triggered by
    a VACUUM_FETCH message as part of the vacuuming. The local store
    routine will base its decision whether to delete or to store
    the record (among other things) upon the value of this flag.
    
    This flag should never be stored in the local database copies.

commit 942604d9c87db6840cbec680ae2b14bfd62119e0
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 10 14:22:55 2010 +0100

    call: Move definition of call flags down to the definition of the flags field.

commit 12a4c89f19622a9d7941feabc1ff46ac35baa22c
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 10 14:24:40 2010 +0100

    call: add new call flag CTDB_CALL_FLAG_VACUUM_MIGRATION
    
    This is to be used when the CTDB_SRVID_VACUUM_FETCH message
    triggers the migration of deleted records to the lmaster.
    The lmaster can then delete records that have not been
    migrated with data instead of storing them.

commit 1dc4fa53c4db0c7b54db31a88b3228835b3f14a1
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 3 15:24:06 2010 +0100

    recoverd: in a recovery, set the MIGRATED_WITH_DATA flag on all records
    
    Those records that are kept after recovery, are non-empty, and
    stored identically on all nodes. So this is as if they had been
    migrated with data.
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>

commit 0837fc898743032f8a1f774f02a6bfe076dee73c
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 3 15:21:51 2010 +0100

    server: when we migrate off a record with data, set the MIGRATED_WITH_DATA flag

commit 05777b42ceb103981d6f7a33386104ce4d71b949
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 3 12:15:41 2011 +0100

    vacuum: check lmaster against num_nodes instead of vnn_map->size
    
    When lmaster is bigger than the biggest recorded node number,
    then exit the traverse with error.

commit 88fbdba3712b312fd57454c9d2e3a33700572f59
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 3 17:47:36 2011 +0100

    vacuum: reduce indentation of the loop sending VACUUM_FETCH controls
    
    This slightly improves the code structure in that loop.

commit 4a34b5c863bf4e007ebc807fd955e401e13ee847
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 3 12:26:45 2011 +0100

    vacuum: correctly send TRY_DELETE_RECORDS ctrl to all active nodes
    
    Originally, the control was sent to all records in the vnn_map, but
    there was something still missing here:
    When a node can not become lmaster (via CTDB_CAPABILITY_LMASTER=no)
    then it will not be part of the vnn_map. So such a node would
    be active but never receive the TRY_DELETE_RECORDS control from a
    vacuuming run.
    
    This is fixed in this change by correctly building the list of
    active nodes first in the same way that the recovery process does it.

commit ecd02cbaf8ce5df646f453ac76f335a1f9082438
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 3 12:18:58 2011 +0100

    vacuum: in ctdb_vacuum_db, fix the length of the array of vacuum fetch lists
    
    This patch fixes segfaults in the vacuum child when at least one
    node has been stopped or removed from the cluster:
    
    The size of the vnn_map is only the number of active nodes
    (that can be lmaster). But the node numbers that are referenced
    by the vnn_map spread over all configured nodes.
    
    Since the array of vacuum fetch lists is referenced by the
    key's lmaster's node number later on, the array needs to
    be of size num_nodes instad of vnn_map->size.

commit 93148b5308306c27b0b672c565c7b324ab263bd0
Author: Michael Adam <obnox at samba.org>
Date:   Mon Dec 20 16:26:50 2010 +0100

    Fix typos in a comment in vacuum_traverse.

commit df46cd2c862e45311b6db05a763b27d90b676f01
Author: Michael Adam <obnox at samba.org>
Date:   Tue Dec 21 17:18:03 2010 +0100

    tests: fix segfault in store test when connection to ctdbd failed.

commit eb6652c00456d7a24317790a16177600ff326c66
Author: Michael Adam <obnox at samba.org>
Date:   Tue Dec 21 17:15:41 2010 +0100

    tests: fix segfault in fetch_one test when connection to ctdbd fails

commit b3ceec608069177e9bcf23e8ea963b229838cd59
Author: Michael Adam <obnox at samba.org>
Date:   Tue Dec 21 17:14:33 2010 +0100

    tests: fix segfault in fetch test when connection to ctdb failed.

commit 5bab0f2d3f75ca8b91c7517a69e687e37d9abc8e
Author: Michael Adam <obnox at samba.org>
Date:   Tue Dec 21 17:11:26 2010 +0100

    tests: fix segfault in randrec test when connection to daemon fails.

commit 4769729cfb8aa549044f3efb0bf69e8c1c73322f
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 3 15:39:44 2010 +0100

    gitignore: add tags file

commit 669fd6c8c72e7e6225d65da98e1fe03967826372
Author: Michael Adam <obnox at samba.org>
Date:   Fri Dec 3 15:39:26 2010 +0100

    gitignore: add vi swap files

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                 |    2 +
 client/ctdb_client.c       |    9 +
 common/ctdb_ltdb.c         |    5 +
 include/ctdb_private.h     |   35 +++
 include/ctdb_protocol.h    |    6 +-
 packaging/RPM/ctdb.spec.in |    7 +-
 server/ctdb_call.c         |   79 +++++-
 server/ctdb_control.c      |    9 +
 server/ctdb_daemon.c       |    1 +
 server/ctdb_freeze.c       |   11 +
 server/ctdb_ltdb_server.c  |  209 ++++++++++++++-
 server/ctdb_monitor.c      |    1 +
 server/ctdb_recoverd.c     |    2 +
 server/ctdb_takeover.c     |    2 +-
 server/ctdb_tunables.c     |    7 +-
 server/ctdb_vacuum.c       |  670 +++++++++++++++++++++++++++++++++++++------
 tests/src/ctdb_fetch.c     |    5 +
 tests/src/ctdb_fetch_one.c |    5 +
 tests/src/ctdb_randrec.c   |   48 +++-
 tests/src/ctdb_store.c     |    5 +
 20 files changed, 1004 insertions(+), 114 deletions(-)


Changeset truncated at 500 lines:

diff --git a/.gitignore b/.gitignore
index a4cc47e..063e1ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
 *.[oa]
 *~
+*.swp
 config.status
 configure
 ctdb.pc
@@ -7,6 +8,7 @@ publish*.sh
 push*.sh
 web/packages
 TAGS
+tags
 bin
 Makefile
 config.h
diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 99ff72d..a43710f 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -4234,3 +4234,12 @@ int ctdb_ctrl_getstathistory(struct ctdb_context *ctdb, struct timeval timeout,
 		    
 	return 0;
 }
+
+struct ctdb_ltdb_header *ctdb_header_from_record_handle(struct ctdb_record_handle *h)
+{
+	if (h == NULL) {
+		return NULL;
+	}
+
+	return &h->header;
+}
diff --git a/common/ctdb_ltdb.c b/common/ctdb_ltdb.c
index 200cca4..3ee7fe8 100644
--- a/common/ctdb_ltdb.c
+++ b/common/ctdb_ltdb.c
@@ -65,6 +65,7 @@ static void ltdb_initial_header(struct ctdb_db_context *ctdb_db,
 	ZERO_STRUCTP(header);
 	/* initial dmaster is the lmaster */
 	header->dmaster = ctdb_lmaster(ctdb_db->ctdb, &key);
+	header->flags = CTDB_REC_FLAG_AUTOMATIC;
 }
 
 
@@ -129,6 +130,10 @@ int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
 	int ret;
 	bool seqnum_suppressed = false;
 
+	if (ctdb_db->ctdb_ltdb_store_fn) {
+		return ctdb_db->ctdb_ltdb_store_fn(ctdb_db, key, header, data);
+	}
+
 	if (ctdb->flags & CTDB_FLAG_TORTURE) {
 		struct ctdb_ltdb_header *h2;
 		rec = tdb_fetch(ctdb_db->ltdb->tdb, key);
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 447d40c..5729e84 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -119,6 +119,7 @@ struct ctdb_tunable {
 	uint32_t allow_unhealthy_db_read;
 	uint32_t stat_history_interval;
 	uint32_t deferred_attach_timeout;
+	uint32_t vacuum_fast_path_count;
 };
 
 /*
@@ -514,6 +515,12 @@ struct ctdb_db_context {
 	struct lockwait_handle *lockwait_active;
 	struct lockwait_handle *lockwait_overflow;
 	struct ctdb_persistent_state *persistent_state;
+	struct trbt_tree *delete_queue;
+	int (*ctdb_ltdb_store_fn)(struct ctdb_db_context *ctdb_db,
+				  TDB_DATA key,
+				  struct ctdb_ltdb_header *header,
+				  TDB_DATA data);
+
 };
 
 
@@ -840,6 +847,14 @@ ctdb_control_send(struct ctdb_context *ctdb,
  } \
  } while (0)
 
+#define CHECK_CONTROL_MIN_DATA_SIZE(size) do { \
+ if (indata.dsize < size) { \
+	 DEBUG(0,(__location__ " Invalid data size in opcode %u. Got %u expected >= %u\n", \
+		  opcode, (unsigned)indata.dsize, (unsigned)size));	\
+	 return -1; \
+ } \
+ } while (0)
+
 int ctdb_control_getvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata);
 int ctdb_control_setvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata);
 int ctdb_control_getdbmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata);
@@ -1374,4 +1389,24 @@ int ctdb_deferred_drop_all_ips(struct ctdb_context *ctdb);
 
 int ctdb_process_deferred_attach(struct ctdb_context *ctdb);
 
+/**
+ * structure to pass to a schedule_for_deletion_control
+ */
+struct ctdb_control_schedule_for_deletion {
+	uint32_t db_id;
+	struct ctdb_ltdb_header hdr;
+	uint32_t keylen;
+	uint8_t key[1]; /* key[] */
+};
+
+int32_t ctdb_control_schedule_for_deletion(struct ctdb_context *ctdb,
+					   TDB_DATA indata);
+
+
+int32_t ctdb_local_schedule_for_deletion(struct ctdb_db_context *ctdb_db,
+					 const struct ctdb_ltdb_header *hdr,
+					 TDB_DATA key);
+
+struct ctdb_ltdb_header *ctdb_header_from_record_handle(struct ctdb_record_handle *h);
+
 #endif
diff --git a/include/ctdb_protocol.h b/include/ctdb_protocol.h
index b6b753c..0422afe 100644
--- a/include/ctdb_protocol.h
+++ b/include/ctdb_protocol.h
@@ -34,13 +34,14 @@
 #define CTDB_FETCH_FUNC     0xFF000002
 
 
-#define CTDB_IMMEDIATE_MIGRATION	0x00000001
 struct ctdb_call {
 	int call_id;
 	TDB_DATA key;
 	TDB_DATA call_data;
 	TDB_DATA reply_data;
 	uint32_t status;
+#define CTDB_IMMEDIATE_MIGRATION	0x00000001
+#define CTDB_CALL_FLAG_VACUUM_MIGRATION		0x00000002
 	uint32_t flags;
 };
 
@@ -361,6 +362,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
 		    CTDB_CONTROL_SET_IFACE_LINK_STATE	 = 125,
 		    CTDB_CONTROL_TCP_ADD_DELAYED_UPDATE  = 126,
 		    CTDB_CONTROL_GET_STAT_HISTORY	 = 127,
+		    CTDB_CONTROL_SCHEDULE_FOR_DELETION   = 128,
 };
 
 /*
@@ -482,6 +484,8 @@ struct ctdb_ltdb_header {
 	uint32_t reserved1;
 #define CTDB_REC_FLAG_DEFAULT			0x00000000
 #define CTDB_REC_FLAG_MIGRATED_WITH_DATA	0x00010000
+#define CTDB_REC_FLAG_VACUUM_MIGRATED		0x00020000
+#define CTDB_REC_FLAG_AUTOMATIC			0x00040000
 	uint32_t flags;
 };
 
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index ebf0fdd..1b744ca 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -3,7 +3,7 @@ Name: ctdb
 Summary: Clustered TDB
 Vendor: Samba Team
 Packager: Samba Team <samba at samba.org>
-Version: 1.2.23
+Version: 1.2.25
 Release: 1GITHASH
 Epoch: 0
 License: GNU GPL version 3
@@ -143,6 +143,11 @@ development libraries for ctdb
 %{_libdir}/libctdb.a
 
 %changelog
+* Mon Mar 14 2011 : Version 1.2.25
+ - Vacuum update. Vacuuming updated from Michael Adam's vacuuming patch which
+   greatly improves the speed of vacuuming of shortlived records.
+ - Defer database access until we have well gone through initial startup and covergence. This reduces the chance of hitting a split brain when writing to the cluster if we dont use split brain protection reclock file.
+ - Try to restart recovery daemon if/when it fails or hangs.
 * Fri Feb 25 2011 : Version 1.2.23
  - Fix for "DB Attach to database %s refused. Can not match clientid.."
    that was introduced in 1.2.22
diff --git a/server/ctdb_call.c b/server/ctdb_call.c
index be6e8f9..73072c3 100644
--- a/server/ctdb_call.c
+++ b/server/ctdb_call.c
@@ -99,9 +99,30 @@ static void ctdb_send_error(struct ctdb_context *ctdb,
 }
 
 
-/*
-  send a redirect reply
-*/
+/**
+ * send a redirect reply
+ *
+ * The logic behind this function is this:
+ *
+ * A client wants to grab a record and sends a CTDB_REQ_CALL packet
+ * to its local ctdb (ctdb_request_call). If the node is not itself
+ * the record's DMASTER, it first redirects the packet to  the
+ * record's LMASTER. The LMASTER then redirects the call packet to
+ * the current DMASTER. But there is a race: The record may have
+ * been migrated off the DMASTER while the redirected packet is
+ * on the wire (or in the local queue). So in case the record has
+ * migrated off the new destinaton of the call packet, instead of
+ * going back to the LMASTER to get the new DMASTER, we try to
+ * reduce rountrips by fist chasing the record a couple of times
+ * before giving up the direct chase and finally going back to the
+ * LMASTER (again). Note that this works because auf this: When
+ * a record is migrated off a node, then the new DMASTER is stored
+ * in the record's copy on the former DMASTER.
+ *
+ * The maxiumum number of attempts for direct chase to make before
+ * going back to the LMASTER is configurable by the tunable
+ * "MaxRedirectCount".
+ */
 static void ctdb_call_send_redirect(struct ctdb_context *ctdb, 
 				    TDB_DATA key,
 				    struct ctdb_req_call *c, 
@@ -160,7 +181,7 @@ static void ctdb_send_dmaster_reply(struct ctdb_db_context *ctdb_db,
 	tmp_ctx = talloc_new(ctdb);
 
 	/* send the CTDB_REPLY_DMASTER */
-	len = offsetof(struct ctdb_reply_dmaster, data) + key.dsize + data.dsize;
+	len = offsetof(struct ctdb_reply_dmaster, data) + key.dsize + data.dsize + sizeof(uint32_t);
 	r = ctdb_transport_allocate(ctdb, tmp_ctx, CTDB_REPLY_DMASTER, len,
 				    struct ctdb_reply_dmaster);
 	CTDB_NO_MEMORY_FATAL(ctdb, r);
@@ -173,6 +194,7 @@ static void ctdb_send_dmaster_reply(struct ctdb_db_context *ctdb_db,
 	r->db_id         = ctdb_db->db_id;
 	memcpy(&r->data[0], key.dptr, key.dsize);
 	memcpy(&r->data[key.dsize], data.dptr, data.dsize);
+	memcpy(&r->data[key.dsize+data.dsize], &header->flags, sizeof(uint32_t));
 
 	ctdb_queue_packet(ctdb, &r->hdr);
 
@@ -201,13 +223,18 @@ static void ctdb_call_send_dmaster(struct ctdb_db_context *ctdb_db,
 		return;
 	}
 
+	if (data->dsize != 0) {
+		header->flags |= CTDB_REC_FLAG_MIGRATED_WITH_DATA;
+	}
+
 	if (lmaster == ctdb->pnn) {
 		ctdb_send_dmaster_reply(ctdb_db, header, *key, *data, 
 					c->hdr.srcnode, c->hdr.reqid);
 		return;
 	}
 	
-	len = offsetof(struct ctdb_req_dmaster, data) + key->dsize + data->dsize;
+	len = offsetof(struct ctdb_req_dmaster, data) + key->dsize + data->dsize
+			+ sizeof(uint32_t);
 	r = ctdb_transport_allocate(ctdb, ctdb, CTDB_REQ_DMASTER, len, 
 				    struct ctdb_req_dmaster);
 	CTDB_NO_MEMORY_FATAL(ctdb, r);
@@ -220,6 +247,7 @@ static void ctdb_call_send_dmaster(struct ctdb_db_context *ctdb_db,
 	r->datalen       = data->dsize;
 	memcpy(&r->data[0], key->dptr, key->dsize);
 	memcpy(&r->data[key->dsize], data->dptr, data->dsize);
+	memcpy(&r->data[key->dsize + data->dsize], &header->flags, sizeof(uint32_t));
 
 	header->dmaster = c->hdr.srcnode;
 	if (ctdb_ltdb_store(ctdb_db, *key, header, *data) != 0) {
@@ -237,10 +265,10 @@ static void ctdb_call_send_dmaster(struct ctdb_db_context *ctdb_db,
 
   must be called with the chainlock held. This function releases the chainlock
 */
-static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db, 
+static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db,
 				struct ctdb_req_header *hdr,
 				TDB_DATA key, TDB_DATA data,
-				uint64_t rsn)
+				uint64_t rsn, uint32_t record_flags)
 {
 	struct ctdb_call_state *state;
 	struct ctdb_context *ctdb = ctdb_db->ctdb;
@@ -252,6 +280,21 @@ static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db,
 	ZERO_STRUCT(header);
 	header.rsn = rsn + 1;
 	header.dmaster = ctdb->pnn;
+	header.flags = record_flags;
+
+	state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
+
+	if (state) {
+		if (state->call->flags & CTDB_CALL_FLAG_VACUUM_MIGRATION) {
+			/*
+			 * We temporarily add the VACUUM_MIGRATED flag to
+			 * the record flags, so that ctdb_ltdb_store can
+			 * decide whether the record should be stored or
+			 * deleted.
+			 */
+			header.flags |= CTDB_REC_FLAG_VACUUM_MIGRATED;
+		}
+	}
 
 	if (ctdb_ltdb_store(ctdb_db, key, &header, data) != 0) {
 		ctdb_fatal(ctdb, "ctdb_reply_dmaster store failed\n");
@@ -263,7 +306,6 @@ static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db,
 		return;
 	}
 
-	state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state);
 
 	if (state == NULL) {
 		DEBUG(DEBUG_ERR,("pnn %u Invalid reqid %u in ctdb_become_dmaster from node %u\n",
@@ -324,12 +366,19 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
 	TDB_DATA key, data, data2;
 	struct ctdb_ltdb_header header;
 	struct ctdb_db_context *ctdb_db;
+	uint32_t record_flags = 0;
+	size_t len;
 	int ret;
 
 	key.dptr = c->data;
 	key.dsize = c->keylen;
 	data.dptr = c->data + c->keylen;
 	data.dsize = c->datalen;
+	len = offsetof(struct ctdb_req_dmaster, data) + key.dsize + data.dsize
+			+ sizeof(uint32_t);
+	if (len <= c->hdr.length) {
+		record_flags = *(uint32_t *)&c->data[c->keylen + c->datalen];
+	}
 
 	ctdb_db = find_ctdb_db(ctdb, c->db_id);
 	if (!ctdb_db) {
@@ -386,10 +435,13 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr
 	/* use the rsn from the sending node */
 	header.rsn = c->rsn;
 
+	/* store the record flags from the sending node */
+	header.flags = record_flags;
+
 	/* check if the new dmaster is the lmaster, in which case we
 	   skip the dmaster reply */
 	if (c->dmaster == ctdb->pnn) {
-		ctdb_become_dmaster(ctdb_db, hdr, key, data, c->rsn);
+		ctdb_become_dmaster(ctdb_db, hdr, key, data, c->rsn, record_flags);
 	} else {
 		ctdb_send_dmaster_reply(ctdb_db, &header, key, data, c->dmaster, hdr->reqid);
 
@@ -562,6 +614,8 @@ void ctdb_reply_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 	struct ctdb_reply_dmaster *c = (struct ctdb_reply_dmaster *)hdr;
 	struct ctdb_db_context *ctdb_db;
 	TDB_DATA key, data;
+	uint32_t record_flags = 0;
+	size_t len;
 	int ret;
 
 	ctdb_db = find_ctdb_db(ctdb, c->db_id);
@@ -574,6 +628,11 @@ void ctdb_reply_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 	key.dsize = c->keylen;
 	data.dptr = &c->data[key.dsize];
 	data.dsize = c->datalen;
+	len = offsetof(struct ctdb_reply_dmaster, data) + key.dsize + data.dsize
+		+ sizeof(uint32_t);
+	if (len <= c->hdr.length) {
+		record_flags = *(uint32_t *)&c->data[c->keylen + c->datalen];
+	}
 
 	ret = ctdb_ltdb_lock_requeue(ctdb_db, key, hdr,
 				     ctdb_call_input_pkt, ctdb, False);
@@ -585,7 +644,7 @@ void ctdb_reply_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
 		return;
 	}
 
-	ctdb_become_dmaster(ctdb_db, hdr, key, data, c->rsn);
+	ctdb_become_dmaster(ctdb_db, hdr, key, data, c->rsn, record_flags);
 }
 
 
diff --git a/server/ctdb_control.c b/server/ctdb_control.c
index 69724e3..748907f 100644
--- a/server/ctdb_control.c
+++ b/server/ctdb_control.c
@@ -604,6 +604,15 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
 		CHECK_CONTROL_DATA_SIZE(0);
 		return ctdb_control_get_stat_history(ctdb, c, outdata);
 
+	case CTDB_CONTROL_SCHEDULE_FOR_DELETION: {
+		struct ctdb_control_schedule_for_deletion *d;
+		size_t size = offsetof(struct ctdb_control_schedule_for_deletion, key);
+		CHECK_CONTROL_MIN_DATA_SIZE(size);
+		d = (struct ctdb_control_schedule_for_deletion *)indata.dptr;
+		size += d->keylen;
+		CHECK_CONTROL_DATA_SIZE(size);
+		return ctdb_control_schedule_for_deletion(ctdb, indata);
+	}
 	default:
 		DEBUG(DEBUG_CRIT,(__location__ " Unknown CTDB control opcode %u\n", opcode));
 		return -1;
diff --git a/server/ctdb_daemon.c b/server/ctdb_daemon.c
index 9c650a0..75344ad 100644
--- a/server/ctdb_daemon.c
+++ b/server/ctdb_daemon.c
@@ -777,6 +777,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog,
 	block_signal(SIGPIPE);
 
 	ctdbd_pid = getpid();
+	ctdb->ctdbd_pid = ctdbd_pid;
 
 
 	DEBUG(DEBUG_ERR, ("Starting CTDBD as pid : %u\n", ctdbd_pid));
diff --git a/server/ctdb_freeze.c b/server/ctdb_freeze.c
index 86cb5ed..0f70fd3 100644
--- a/server/ctdb_freeze.c
+++ b/server/ctdb_freeze.c
@@ -25,6 +25,7 @@
 #include "../include/ctdb_private.h"
 #include "lib/util/dlinklist.h"
 #include "db_wrap.h"
+#include "../common/rb_tree.h"
 
 static bool later_db(const char *name)
 {
@@ -605,5 +606,15 @@ int32_t ctdb_control_wipe_database(struct ctdb_context *ctdb, TDB_DATA indata)
 		return -1;
 	}
 
+	if (!ctdb_db->persistent) {
+		talloc_free(ctdb_db->delete_queue);
+		ctdb_db->delete_queue = trbt_create(ctdb_db, 0);
+		if (ctdb_db->delete_queue == NULL) {
+			DEBUG(DEBUG_ERR, (__location__ " Failed to re-create "
+					  "the vacuum tree.\n"));
+			return -1;
+		}
+	}
+
 	return 0;
 }
diff --git a/server/ctdb_ltdb_server.c b/server/ctdb_ltdb_server.c
index ad9b30f..6a12441 100644
--- a/server/ctdb_ltdb_server.c
+++ b/server/ctdb_ltdb_server.c
@@ -25,6 +25,7 @@
 #include "system/dir.h"
 #include "system/time.h"
 #include "../include/ctdb_private.h"
+#include "../common/rb_tree.h"
 #include "db_wrap.h"
 #include "lib/util/dlinklist.h"
 #include <ctype.h>
@@ -49,6 +50,199 @@ static int ctdb_fetch_func(struct ctdb_call_info *call)
 }
 
 
+/**
+ * write a record to a normal database
+ *
+ * This is the server-variant of the ctdb_ltdb_store function.
+ * It contains logic to determine whether a record should be
+ * stored or deleted. It also sends SCHEDULE_FOR_DELETION
+ * controls to the local ctdb daemon if apporpriate.
+ */
+static int ctdb_ltdb_store_server(struct ctdb_db_context *ctdb_db,
+				  TDB_DATA key,
+				  struct ctdb_ltdb_header *header,
+				  TDB_DATA data)
+{
+	struct ctdb_context *ctdb = ctdb_db->ctdb;
+	TDB_DATA rec;
+	int ret;
+	bool seqnum_suppressed = false;
+	bool keep = false;
+	bool schedule_for_deletion = false;
+	uint32_t lmaster;
+
+	if (ctdb->flags & CTDB_FLAG_TORTURE) {
+		struct ctdb_ltdb_header *h2;
+		rec = tdb_fetch(ctdb_db->ltdb->tdb, key);
+		h2 = (struct ctdb_ltdb_header *)rec.dptr;
+		if (rec.dptr && rec.dsize >= sizeof(h2) && h2->rsn > header->rsn) {
+			DEBUG(DEBUG_CRIT,("RSN regression! %llu %llu\n",
+				 (unsigned long long)h2->rsn, (unsigned long long)header->rsn));
+		}
+		if (rec.dptr) free(rec.dptr);
+	}
+
+	if (ctdb->vnn_map == NULL) {
+		/*
+		 * Called from a client: always store the record
+		 * Also don't call ctdb_lmaster since it uses the vnn_map!
+		 */
+		keep = true;
+		goto store;
+	}
+
+	lmaster = ctdb_lmaster(ctdb_db->ctdb, &key);
+
+	/*
+	 * If we migrate an empty record off to another node
+	 * and the record has not been migrated with data,
+	 * delete the record instead of storing the empty record.


-- 
CTDB repository


More information about the samba-cvs mailing list