diff options
author | Dan McGee <dan@archlinux.org> | 2011-06-27 17:31:30 -0500 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2011-06-28 08:53:06 +0200 |
commit | 0cb493ef2a4182c22c405b15f5d6e86bec80d4bb (patch) | |
tree | 158c405b11393e753efa74227a56c70810f22822 /scripts/aurblup | |
parent | 0f994df357c3aa9d7a29cca711cb5f6d29a4b614 (diff) |
aurblup: blacklist processing query changes
* Do all list building and freeing outside of the transaction to keep it
as short as possible.
* Remove ability to blacklist without transactions as we now only
support InnoDB/transactional engines with proper relations.
* No need to turn autocommit off; BEGIN TRANSACTION operates regardless
of this setting.
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'scripts/aurblup')
-rw-r--r-- | scripts/aurblup/aurblup.c | 23 | ||||
-rw-r--r-- | scripts/aurblup/config.h.proto | 3 |
2 files changed, 5 insertions, 21 deletions
diff --git a/scripts/aurblup/aurblup.c b/scripts/aurblup/aurblup.c index fea7ffc..1f7aefc 100644 --- a/scripts/aurblup/aurblup.c +++ b/scripts/aurblup/aurblup.c @@ -122,19 +122,11 @@ blacklist_sync(alpm_list_t *pkgs_cur, alpm_list_t *pkgs_new) { alpm_list_t *pkgs_add, *pkgs_rem, *p; -#if MYSQL_USE_TRANSACTIONS - if (mysql_autocommit(c, 0)) - mysql_die("failed to turn MySQL autocommit off: %s\n"); + pkgs_add = alpm_list_diff(pkgs_new, pkgs_cur, (alpm_list_fn_cmp)strcmp); + pkgs_rem = alpm_list_diff(pkgs_cur, pkgs_new, (alpm_list_fn_cmp)strcmp); if (mysql_query(c, "START TRANSACTION;")) mysql_die("failed to start MySQL transaction: %s\n"); -#else - if (mysql_query(c, "LOCK TABLES PackageBlacklist WRITE;")) - mysql_die("failed to lock MySQL table: %s\n"); -#endif - - pkgs_add = alpm_list_diff(pkgs_new, pkgs_cur, (alpm_list_fn_cmp)strcmp); - pkgs_rem = alpm_list_diff(pkgs_cur, pkgs_new, (alpm_list_fn_cmp)strcmp); for (p = pkgs_add; p; p = alpm_list_next(p)) blacklist_add(alpm_list_getdata(p)); @@ -142,16 +134,11 @@ blacklist_sync(alpm_list_t *pkgs_cur, alpm_list_t *pkgs_new) for (p = pkgs_rem; p; p = alpm_list_next(p)) blacklist_remove(alpm_list_getdata(p)); - alpm_list_free(pkgs_add); - alpm_list_free(pkgs_rem); - -#if MYSQL_USE_TRANSACTIONS if (mysql_query(c, "COMMIT;")) mysql_die("failed to commit MySQL transaction: %s\n"); -#else - if (mysql_query(c, "UNLOCK TABLES;")) - mysql_die("failed to unlock MySQL tables: %s\n"); -#endif + + alpm_list_free(pkgs_add); + alpm_list_free(pkgs_rem); } alpm_list_t * diff --git a/scripts/aurblup/config.h.proto b/scripts/aurblup/config.h.proto index fc1a87b..daf1744 100644 --- a/scripts/aurblup/config.h.proto +++ b/scripts/aurblup/config.h.proto @@ -6,9 +6,6 @@ #define CONFIG_KEY_PASSWD "AUR_db_pass" #define CONFIG_KEY_DB "AUR_db_name" -/* unset this to use "LOCK TABLE" instead of transactions */ -#define MYSQL_USE_TRANSACTIONS 1 - /* libalpm options */ #define ALPM_DBPATH "/var/lib/aurblup/" #define ALPM_MIRROR "ftp://mirrors.kernel.org/archlinux/%s/os/i686" |