skytools.git
15 years agoMerge branch 'master' of git://github.com/markokr/skytools-dev
Martin Pihlak [Fri, 6 Nov 2009 08:57:06 +0000 (10:57 +0200)]
Merge branch 'master' of git://github.com/markokr/skytools-dev

15 years agotodo update
Marko Kreen [Wed, 4 Nov 2009 13:30:48 +0000 (15:30 +0200)]
todo update

15 years agoDBScript: restore .looping variable
Marko Kreen [Wed, 4 Nov 2009 13:28:49 +0000 (15:28 +0200)]
DBScript: restore .looping variable

loop_delay is loaded from conf, so it conflicts with .set_single_loop()
in scripts which have both looping mode and non-looping mode.
Eg: londiste, walmgr

15 years agopgq.Consumer: report new class vars in top-level
Marko Kreen [Wed, 4 Nov 2009 13:28:27 +0000 (15:28 +0200)]
pgq.Consumer: report new class vars in top-level

15 years agoqadmin: fix style problems
Marko Kreen [Wed, 4 Nov 2009 13:27:45 +0000 (15:27 +0200)]
qadmin: fix style problems

15 years agoskytools_upgrade: add missing import
Marko Kreen [Wed, 4 Nov 2009 13:27:16 +0000 (15:27 +0200)]
skytools_upgrade: add missing import

15 years agowalmgr: remove double import
Marko Kreen [Wed, 4 Nov 2009 13:26:51 +0000 (15:26 +0200)]
walmgr: remove double import

15 years agopychecker: dont warn for class docstrs, too much noise
Marko Kreen [Wed, 4 Nov 2009 13:25:47 +0000 (15:25 +0200)]
pychecker: dont warn for class docstrs, too much noise

15 years agosql/londiste: restore fkeys to local tables only
Marko Kreen [Wed, 4 Nov 2009 12:24:54 +0000 (14:24 +0200)]
sql/londiste: restore fkeys to local tables only

Fwd-port from 2.1-stable

15 years agoDBScript: avoid second reload on startup
Marko Kreen [Wed, 4 Nov 2009 12:24:28 +0000 (14:24 +0200)]
DBScript: avoid second reload on startup

15 years agotodo update
Marko Kreen [Tue, 3 Nov 2009 12:43:41 +0000 (14:43 +0200)]
todo update

15 years agopgqadm status: show quick stats
Marko Kreen [Tue, 3 Nov 2009 12:37:37 +0000 (14:37 +0200)]
pgqadm status: show quick stats

15 years agosql/pgq: add quick stats to get_{queue|consumer}_info
Marko Kreen [Tue, 3 Nov 2009 12:30:27 +0000 (14:30 +0200)]
sql/pgq: add quick stats to get_{queue|consumer}_info

get_consumer_info().pending_events

  How batched events are availble for read.

get_queue_info().ev_per_sec

  Average event creation speed, based on recent 20 batches.

get_queue_info().ev_new

  How many events have appreased in queue since recent tick.
  Those are not yet in any batch so consumers cannot read them yet.

15 years agoDBScript: use log.exception also for psycopg errors
Marko Kreen [Tue, 3 Nov 2009 12:28:27 +0000 (14:28 +0200)]
DBScript: use log.exception also for psycopg errors

15 years agopsycopgwrapper: make server_version int
Marko Kreen [Tue, 3 Nov 2009 12:27:40 +0000 (14:27 +0200)]
psycopgwrapper: make server_version int

15 years agofix pgq brokenness related to recent commits
Marko Kreen [Tue, 3 Nov 2009 12:26:19 +0000 (14:26 +0200)]
fix pgq brokenness related to recent commits

- get_batch_cursor()
- loop_delay

15 years agotestlib: set pipefail to catch errors in middle of pipe
Marko Kreen [Tue, 3 Nov 2009 12:24:26 +0000 (14:24 +0200)]
testlib: set pipefail to catch errors in middle of pipe

15 years agolondiste: copy expression support
Marko Kreen [Tue, 3 Nov 2009 12:21:28 +0000 (14:21 +0200)]
londiste: copy expression support

15 years agopkgloader: allow non-numerics after '-'
Marko Kreen [Tue, 3 Nov 2009 12:19:22 +0000 (14:19 +0200)]
pkgloader: allow non-numerics after '-'

Clean up few veriable names also

15 years agolondiste copy: use TRUNCATE ONLY on 8.4+
Marko Kreen [Wed, 28 Oct 2009 14:03:28 +0000 (16:03 +0200)]
londiste copy: use TRUNCATE ONLY on 8.4+

15 years agopsycopgwrapper: Fill .server_version on older psycopg
Marko Kreen [Wed, 28 Oct 2009 14:00:51 +0000 (16:00 +0200)]
psycopgwrapper: Fill .server_version on older psycopg

This make the parameter always available.

15 years agodbstruct: Remove ONLY from ADD CONSTRAINT.
Marko Kreen [Wed, 28 Oct 2009 13:34:27 +0000 (15:34 +0200)]
dbstruct: Remove ONLY from ADD CONSTRAINT.

Parent table cannot have contraints that the childs do not have.

15 years agoMakefile: pass sub-* target exit status back
Marko Kreen [Mon, 2 Nov 2009 13:45:47 +0000 (15:45 +0200)]
Makefile: pass sub-* target exit status back

16 years agopython/: Add --version switch to all scripts.
Marko Kreen [Wed, 14 Oct 2009 15:03:54 +0000 (18:03 +0300)]
python/: Add --version switch to all scripts.

Based on patch by Hannu Krosing

16 years agolondiste: make copy unlink inherited table from it's parents
Marko Kreen [Wed, 14 Oct 2009 14:34:40 +0000 (17:34 +0300)]
londiste: make copy unlink inherited table from it's parents

Otherwise we cannot drop constraints.

Unlink from childs is not needed, so they are left as-is.

Patch by Hannu Krosing

16 years agoskytools.DBScript: safer pidfile writing
Marko Kreen [Wed, 14 Oct 2009 13:47:31 +0000 (16:47 +0300)]
skytools.DBScript: safer pidfile writing

- signal_pidfile: Clarify ValueError error message. Thrown usually
  on empty pidfiles, the error messega will now mention the pidfile name.

- run_single_process: restructure pidfile writing, so that
  the pidfile is removed if .write() failed, but not when open() failed.
  This should avoid the chance that empty pidfiles are hanging around.

16 years agopython/skytools: add doctest-based regtests to few non-sql functions
Marko Kreen [Wed, 14 Oct 2009 13:37:17 +0000 (16:37 +0300)]
python/skytools: add doctest-based regtests to few non-sql functions

Seems to be better testing method than ad-hoc scripts.  They will
serve as examples too.

Also fix few minor problems found in the process:
- parse_pgarray:  check if str ends with }
- parse_pgarray: support NULL
- quote_fqident: add 'public.' schema to idents without schema
- fq_name_parts: return always list

16 years agosql/pgq/triggers: magic fields to set event fields directly.
Marko Kreen [Wed, 14 Oct 2009 13:30:18 +0000 (16:30 +0300)]
sql/pgq/triggers: magic fields to set event fields directly.

pgq.sqltriga() / pgq.logutriga() now consider following fields magic:

  _pgq_ev_type
  _pgq_ev_data
  _pgq_ev_extra1
  _pgq_ev_extra2
  _pgq_ev_extra3
  _pgq_ev_extra4

If any of them is present in table, corresponding event field is set directly
to it's value, overriding value generated by trigger.

16 years agoMerge remote branch 'martin/master'
Marko Kreen [Tue, 6 Oct 2009 15:01:23 +0000 (18:01 +0300)]
Merge remote branch 'martin/master'

16 years agoMerge branch 'master' of git://github.com/markokr/skytools-dev
Martin Pihlak [Tue, 6 Oct 2009 14:16:55 +0000 (17:16 +0300)]
Merge branch 'master' of git://github.com/markokr/skytools-dev

16 years agoFix the pg_[x]log rsyncing code to leave out directory contents.
Martin Pihlak [Tue, 6 Oct 2009 14:12:19 +0000 (17:12 +0300)]
Fix the pg_[x]log rsyncing code to leave out directory contents.

16 years agodbscript: rename connection_setup to connection_hook
Marko Kreen [Mon, 21 Sep 2009 13:25:00 +0000 (16:25 +0300)]
dbscript: rename connection_setup to connection_hook

16 years agoDBScript: Simplify looping and docstring handling
Marko Kreen [Mon, 21 Sep 2009 13:13:27 +0000 (16:13 +0300)]
DBScript: Simplify looping and docstring handling

- looping: remove .do_single_loop and .looping variables, let only .loop_delay
  control looping.  If loop_delay is missing from confing or 0, then
  instead sleep, the script will exit.

- docstr: print docstring fragments recursively, so each class
  needs to only document its own parameters.

- londiste.py: use Replicator class to print default config as it has
  proper class inheritance.

16 years agoAdd various junk to .gitignore
Marko Kreen [Mon, 21 Sep 2009 13:12:56 +0000 (16:12 +0300)]
Add various junk to .gitignore

16 years agosqltools: make mk_update_sql()/mk_delete_sql() use ONLY
Marko Kreen [Mon, 21 Sep 2009 11:37:28 +0000 (14:37 +0300)]
sqltools: make mk_update_sql()/mk_delete_sql() use ONLY

This will make urlencoded events behave same as sql events.

16 years agosql/pgq: trigger fixes
Marko Kreen [Mon, 21 Sep 2009 11:29:51 +0000 (14:29 +0300)]
sql/pgq: trigger fixes

- pgq.logutriga() did not put custom pkey= value into events.

- pgq.logutriga() and pgq.sqltriga() did allow UPDATE and DELETE
  on tables without pkey, running into SQL errors downstream.
  They should throw error in such case.

16 years agopgq.maint_retry_events(): lock table to allow only single mover
Marko Kreen [Thu, 17 Sep 2009 08:46:10 +0000 (11:46 +0300)]
pgq.maint_retry_events(): lock table to allow only single mover

Use SHARE UPDATE EXCLUSIVE lock, which will not conflict with inserts.

16 years agoDisable archive_command in restored postgresql.conf
Martin Pihlak [Tue, 15 Sep 2009 12:24:01 +0000 (15:24 +0300)]
Disable archive_command in restored postgresql.conf
archive_command is set to /bin/true instead of disabling archive_mode
This avoids the extra reconfiguration restart when the slave is actually
booted and promoted to master. Based on patch by Mark Kirkwoord.

16 years agopgq.Consumer: use next_batch_custom()
Marko Kreen [Fri, 11 Sep 2009 17:37:11 +0000 (20:37 +0300)]
pgq.Consumer: use next_batch_custom()

This brings new configurable params:

  pgq_min_delay, pgq_min_count, pgq_min_lag

make them also reloadable via SIGHUP.

16 years agopgq.get_batch_info(): show also seq values
Marko Kreen [Fri, 11 Sep 2009 12:28:24 +0000 (15:28 +0300)]
pgq.get_batch_info(): show also seq values

16 years agopgq.Consumer: use lazy_fetch by default
Marko Kreen [Fri, 11 Sep 2009 11:21:32 +0000 (14:21 +0300)]
pgq.Consumer: use lazy_fetch by default

New default_lazy_fetch class var to allow subclasses to turn it off.

16 years agopgq.Consumer: use get_batch_cursor()
Marko Kreen [Fri, 11 Sep 2009 11:20:48 +0000 (14:20 +0300)]
pgq.Consumer: use get_batch_cursor()

16 years agopgq.next_batch_custom(): extended next_batch
Marko Kreen [Fri, 11 Sep 2009 11:08:51 +0000 (14:08 +0300)]
pgq.next_batch_custom(): extended next_batch

Supports create batch of several ticks and also forced lag.

16 years agopgq: make test should also install
Marko Kreen [Fri, 11 Sep 2009 10:55:28 +0000 (13:55 +0300)]
pgq: make test should also install

16 years agonodeinfo: show failed consumers
Marko Kreen [Thu, 10 Sep 2009 14:54:34 +0000 (17:54 +0300)]
nodeinfo: show failed consumers

16 years agocascadeadmin: fix provider_node ref
Marko Kreen [Thu, 10 Sep 2009 14:54:10 +0000 (17:54 +0300)]
cascadeadmin: fix provider_node ref

16 years agorefresh libusual
Marko Kreen [Thu, 10 Sep 2009 14:53:39 +0000 (17:53 +0300)]
refresh libusual

16 years agotodo update
Marko Kreen [Thu, 10 Sep 2009 11:33:59 +0000 (14:33 +0300)]
todo update

16 years agoconfigure: add usual_port_check
Marko Kreen [Thu, 10 Sep 2009 11:33:22 +0000 (14:33 +0300)]
configure: add usual_port_check

16 years agocascadedconsumer: use exception_hook to store error in db
Marko Kreen [Thu, 10 Sep 2009 11:27:21 +0000 (14:27 +0300)]
cascadedconsumer: use exception_hook to store error in db

16 years agoDBScript: exception_hook
Marko Kreen [Thu, 10 Sep 2009 11:04:35 +0000 (14:04 +0300)]
DBScript: exception_hook

16 years agolondiste add-seq/tbl: fix --create bug
Marko Kreen [Thu, 10 Sep 2009 11:53:10 +0000 (14:53 +0300)]
londiste add-seq/tbl: fix --create bug

16 years agopython/: clean up imports
Marko Kreen [Thu, 10 Sep 2009 10:36:47 +0000 (13:36 +0300)]
python/: clean up imports

- Remove unused imports
- Remove relative imports

16 years agorun.lint: check all packages
Marko Kreen [Thu, 10 Sep 2009 11:33:48 +0000 (14:33 +0300)]
run.lint: check all packages

Also tune down style warnings

16 years agolondiste: on error, apply sql on-by-one
Marko Kreen [Wed, 9 Sep 2009 11:09:40 +0000 (14:09 +0300)]
londiste: on error, apply sql on-by-one

Check whether last loop got error (work_state = -1)
and apply sql one-by-one if thats true.

Also, apply TRUNCATE separately from other SQL.

16 years agoskytools.DBScript: make work_state = -1 signal exception
Marko Kreen [Wed, 9 Sep 2009 11:02:01 +0000 (14:02 +0300)]
skytools.DBScript: make work_state = -1 signal exception

If exception was thrown, set work_state = -1, to let consumer
handle next work differently.

16 years agopgq.CoopConsumer for Python
Marko Kreen [Wed, 9 Sep 2009 10:52:58 +0000 (13:52 +0300)]
pgq.CoopConsumer for Python

Simply wrapper around Consumer which redirects few calls to pgq_coop schema.

16 years agotodo: merge queue loader to londiste
Marko Kreen [Wed, 2 Sep 2009 17:56:41 +0000 (20:56 +0300)]
todo: merge queue loader to londiste

16 years agodoc: fix html generation
Marko Kreen [Wed, 2 Sep 2009 17:55:53 +0000 (20:55 +0300)]
doc: fix html generation

16 years agorefresh libusual
Marko Kreen [Wed, 2 Sep 2009 17:55:25 +0000 (20:55 +0300)]
refresh libusual

16 years agolondiste.local_add_table: use information_schema to get trigger info
Marko Kreen [Thu, 27 Aug 2009 08:45:55 +0000 (11:45 +0300)]
londiste.local_add_table: use information_schema to get trigger info

This allows to filter out only AFTER triggers without
depending on low-level details of pg_catalog.

16 years agolondiste: helper function to extract parts from fqname
Marko Kreen [Thu, 27 Aug 2009 08:45:16 +0000 (11:45 +0300)]
londiste: helper function to extract parts from fqname

16 years agoFetch libusual fix
Marko Kreen [Thu, 27 Aug 2009 08:27:42 +0000 (11:27 +0300)]
Fetch libusual fix

16 years agoMerge commit 'martin/master'
Marko Kreen [Tue, 21 Jul 2009 11:19:50 +0000 (14:19 +0300)]
Merge commit 'martin/master'

16 years agoRemove unused --overwrite option.
Martin Pihlak [Tue, 21 Jul 2009 11:12:57 +0000 (14:12 +0300)]
Remove unused --overwrite option.

16 years agoCreate pg_xlog/archive_status directory for slave restore.
Martin Pihlak [Tue, 21 Jul 2009 10:44:06 +0000 (13:44 +0300)]
Create pg_xlog/archive_status directory for slave restore.

Patch by Mark Kirkwood.

16 years agolibusual: refresh
Marko Kreen [Wed, 8 Jul 2009 15:13:12 +0000 (18:13 +0300)]
libusual: refresh

16 years agosql/londiste: refresh regtests for table_attrs
Marko Kreen [Wed, 8 Jul 2009 15:09:04 +0000 (18:09 +0300)]
sql/londiste: refresh regtests for table_attrs

16 years agolocal_add_table: FOUND does not work with MAX()
Marko Kreen [Wed, 8 Jul 2009 15:07:41 +0000 (18:07 +0300)]
local_add_table: FOUND does not work with MAX()

16 years agolondiste: fix missing END IF and some ws in local_add_table()
Marko Kreen [Wed, 8 Jul 2009 15:01:11 +0000 (18:01 +0300)]
londiste: fix missing END IF and some ws in local_add_table()

16 years agoWarn user when adding a table to replicate if it has triggers which will fire before...
Dimitri Fontaine [Wed, 8 Jul 2009 14:45:36 +0000 (16:45 +0200)]
Warn user when adding a table to replicate if it has triggers which will fire before londiste ones, and change trigger name to prefix with '_londiste_', per discussion.

16 years agoMake --expect-sync use londiste.local_set_table_state()
Martin Pihlak [Tue, 9 Jun 2009 07:48:31 +0000 (10:48 +0300)]
Make --expect-sync use londiste.local_set_table_state()

16 years agofixed display_table to properly display long table names.
Martin Pihlak [Tue, 9 Jun 2009 07:23:12 +0000 (10:23 +0300)]
fixed display_table to properly display long table names.

16 years agoReduced logging level for maintenance and retry commands.
Martin Pihlak [Tue, 9 Jun 2009 07:08:39 +0000 (10:08 +0300)]
Reduced logging level for maintenance and retry commands.

16 years agolondiste: make --expect-sync work
Marko Kreen [Mon, 8 Jun 2009 14:27:49 +0000 (17:27 +0300)]
londiste: make --expect-sync work

16 years agotodo update
Marko Kreen [Mon, 8 Jun 2009 10:14:45 +0000 (13:14 +0300)]
todo update

16 years agoMerge commit 'martin/master'
Marko Kreen [Mon, 8 Jun 2009 08:07:08 +0000 (11:07 +0300)]
Merge commit 'martin/master'

16 years agopgq_node.set_consumer_error(): to store pending error condition
Marko Kreen [Mon, 8 Jun 2009 08:03:49 +0000 (11:03 +0300)]
pgq_node.set_consumer_error(): to store pending error condition

this may help admin tools which can show also pending error
of why processing last batch failed.

16 years agoFixed variable name mismatch.
Martin Pihlak [Mon, 8 Jun 2009 07:46:19 +0000 (10:46 +0300)]
Fixed variable name mismatch.

16 years agoMerge branch 'master' of git://github.com/markokr/skytools-dev
Martin Pihlak [Mon, 8 Jun 2009 07:42:51 +0000 (10:42 +0300)]
Merge branch 'master' of git://github.com/markokr/skytools-dev

16 years agopgq_node.set_global_watermark: ignore missing ticks
Marko Kreen [Mon, 8 Jun 2009 07:25:59 +0000 (10:25 +0300)]
pgq_node.set_global_watermark: ignore missing ticks

set_global_watermark() can be called with non-existing tick-ids
if worker is processing old batches.

16 years agobuildsystem reorg
Marko Kreen [Fri, 5 Jun 2009 12:34:06 +0000 (15:34 +0300)]
buildsystem reorg

- put python modules under 'skytools-3.0'
- install pkgloader separately
- install scripts in Makefile instead setup.py (it did not support rename)
  removing .py afterwards is dangerous as we may overwrite old scripts.
- move setup.py under misc/ as it really is not usable standalone
- drop override PYTHON

16 years agodoc: clean up files under doc/
Marko Kreen [Fri, 5 Jun 2009 10:32:09 +0000 (13:32 +0300)]
doc: clean up files under doc/

- move extra.css, fixman.py and getattrs.py under misc/
- move .html, .xml, .1 files to subdir
- remove londiste.5
- standardise: pgq-admin->pgqadm, londiste.cmdline -> londiste

16 years agopkgloader module to be able to coexist with 2.x
Marko Kreen [Fri, 5 Jun 2009 10:29:05 +0000 (13:29 +0300)]
pkgloader module to be able to coexist with 2.x

Use scheme that pygtk uses to support parallel installations:

  import pkgloader
  pkgloader.require('skytools', '3.0')

  import skytools

This will allow keeping old module installed by default and new
version is used only by request.

16 years agomove bulk_loader/cube_dispatcher/table_dispatcher to old/
Marko Kreen [Fri, 5 Jun 2009 10:28:31 +0000 (13:28 +0300)]
move bulk_loader/cube_dispatcher/table_dispatcher to old/

The scripts are obsolete but kept as samples.  To notify
that they are not maintained actively, move them away.

16 years agolondiste: replace skip_trunc columns with table attrs
Marko Kreen [Thu, 4 Jun 2009 13:18:03 +0000 (16:18 +0300)]
londiste: replace skip_trunc columns with table attrs

this allows to store more extra data and avoid table
struct change for each item.  only items that the
SQL code does not need to care about can be stored
that way.

16 years agodoc update
Marko Kreen [Tue, 2 Jun 2009 10:33:14 +0000 (13:33 +0300)]
doc update

16 years agoMerge branch 'master' of git://github.com/markokr/skytools-dev
Martin Pihlak [Thu, 4 Jun 2009 13:28:10 +0000 (16:28 +0300)]
Merge branch 'master' of git://github.com/markokr/skytools-dev

16 years agoMerge commit 'martin/master'
Marko Kreen [Thu, 4 Jun 2009 13:22:14 +0000 (16:22 +0300)]
Merge commit 'martin/master'

16 years agoMerge branch 'master' of git://github.com/markokr/skytools-dev
Martin Pihlak [Thu, 4 Jun 2009 10:45:20 +0000 (13:45 +0300)]
Merge branch 'master' of git://github.com/markokr/skytools-dev

16 years agoWalMgr backup retains symlinks for pg_log and pg_xlog.
Martin Pihlak [Thu, 4 Jun 2009 10:42:49 +0000 (13:42 +0300)]
WalMgr backup retains symlinks for pg_log and pg_xlog.

Attempt to keep symlinks for pg_log and pg_xlog. Add a
new configuration parameter for controlling the behaviour.

16 years agolondiste: make compare/repair work with new cascade code
Marko Kreen [Mon, 1 Jun 2009 14:02:24 +0000 (17:02 +0300)]
londiste: make compare/repair work with new cascade code

16 years agoupdate todo
Marko Kreen [Mon, 1 Jun 2009 13:41:39 +0000 (16:41 +0300)]
update todo

16 years agopython/pgq: relaxed event handling
Marko Kreen [Mon, 1 Jun 2009 13:32:08 +0000 (16:32 +0300)]
python/pgq: relaxed event handling

.tag_done() call is no more required.  Events are by default in
'done' state.

In 2.x events were in 'retry' state by default, which was very bad
idea in retrospect.  Changing them to 'untagged' and still requiring
tag_done() does not seem too good either.  Original reasoning was to
detect and survive errors in scripts, but the result was only
confusion to everybody.

So instead of assuming that script may be buggy, now we assume
that script knows what it does.  And only by explicit action
can they be tagged as retry.

16 years agoupdate TODO, fix londiste doc
Marko Kreen [Mon, 1 Jun 2009 13:01:37 +0000 (16:01 +0300)]
update TODO, fix londiste doc

16 years agolondiste: local_add_seq() - log seq name
Marko Kreen [Mon, 1 Jun 2009 13:01:01 +0000 (16:01 +0300)]
londiste: local_add_seq() - log seq name

16 years agolondiste: globbing, --all
Marko Kreen [Mon, 1 Jun 2009 12:51:54 +0000 (15:51 +0300)]
londiste: globbing, --all

16 years agolondiste: fix resync / missing commands
Marko Kreen [Mon, 1 Jun 2009 09:30:33 +0000 (12:30 +0300)]
londiste: fix resync / missing commands

16 years agopython scripts: Move template config to docstring.
Asko Oja [Mon, 4 May 2009 14:02:39 +0000 (14:02 +0000)]
python scripts: Move template config to docstring.

* Template config is now in docstring to make to more
  easy to keep up-to-date.

* dbscript: --ini option to show template config.

16 years agopgqd: use strlist
Marko Kreen [Mon, 1 Jun 2009 06:25:56 +0000 (09:25 +0300)]
pgqd: use strlist