mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
The handling of transactions in xenstored is rather clumsy today: - Each transaction in progress is keeping a local copy of the complete xenstore data base - A transaction will fail as soon as any node is being modified outside the transaction This is leading to a very bad behavior in case of a large xenstore. Memory consumption of xenstored is much higher than necessary and with many domains up transactions failures will be more and more common. Instead of keeping a complete copy of the data base for each transaction store the transaction data in the same data base as the normal xenstore entries prepended with the transaction in the single nodes either read or modified. At the end of the transaction walk through all nodes accessed and check for conflicting modifications. In case no conflicts are found write all modified nodes to the data base without transaction identifier. Following tests have been performed: - create/destroy of various domains, including HVM with ioemu-stubdom (xenstored and xenstore-stubdom) - multiple concurrent runs of xs-test over several minutes (xenstored and xenstore-stubdom) - test for memory leaks of xenstored by dumping talloc reports before and after the tests Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Wei Liu <wei.liu2@citrix.com>
51 lines
1.8 KiB
C
51 lines
1.8 KiB
C
/*
|
|
Transaction code for Xen Store Daemon.
|
|
Copyright (C) 2005 Rusty Russell IBM Corporation
|
|
|
|
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 2 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/>.
|
|
*/
|
|
#ifndef _XENSTORED_TRANSACTION_H
|
|
#define _XENSTORED_TRANSACTION_H
|
|
#include "xenstored_core.h"
|
|
|
|
enum node_access_type {
|
|
NODE_ACCESS_READ,
|
|
NODE_ACCESS_WRITE,
|
|
NODE_ACCESS_DELETE
|
|
};
|
|
|
|
struct transaction;
|
|
|
|
int do_transaction_start(struct connection *conn, struct buffered_data *node);
|
|
int do_transaction_end(struct connection *conn, struct buffered_data *in);
|
|
|
|
struct transaction *transaction_lookup(struct connection *conn, uint32_t id);
|
|
|
|
/* inc/dec entry number local to trans while changing a node */
|
|
void transaction_entry_inc(struct transaction *trans, unsigned int domid);
|
|
void transaction_entry_dec(struct transaction *trans, unsigned int domid);
|
|
|
|
/* This node was accessed. */
|
|
int access_node(struct connection *conn, struct node *node,
|
|
enum node_access_type type, TDB_DATA *key);
|
|
|
|
/* Prepend the transaction to name if appropriate. */
|
|
int transaction_prepend(struct connection *conn, const char *name,
|
|
TDB_DATA *key);
|
|
|
|
void conn_delete_all_transactions(struct connection *conn);
|
|
int check_transactions(struct hashtable *hash);
|
|
|
|
#endif /* _XENSTORED_TRANSACTION_H */
|