4553 Commits

Author SHA1 Message Date
Rob Kiefer
9aa86e1549 Sets initial version and extension description. 2017-03-06 15:31:54 -05:00
Matvey Arye
969d452ec1 Merged in pg_indent_run (pull request #99)
pgindent format

Approved-by: ci-vast
Approved-by: enordstr NA
Approved-by: RobAtticus NA
2017-03-06 20:21:42 +00:00
Matvey Arye
32c45b75b2 formatting with pgindent 2017-03-06 15:20:00 -05:00
enordstr NA
73f4dcaaf0 Merged in enordstr/backend-database/enordstr/at-least-two-partitions-with-partitioning-column (pull request #101)
Default to asking for number of partitions when partitioning column set.

Approved-by: RobAtticus NA
Approved-by: ci-vast
Approved-by: Matvey Arye
2017-03-06 20:12:14 +00:00
Erik Nordström
11938ebb08 Default to asking for number of partitions when partitioning column set.
Since create_hypertable() allows you to optionally specify a
partitioning column, it makes sense to default to one partition when
no column is specified and asking for the number of partitions when a
column is specified and the number of partitions is not (instead of
defaulting to one).

This patch also changes the order and type of partitioning-related
input arguments to create_hypertable() so that the number of
partitions can easily be specified alongside the partitioning column
and without type casting.
2017-03-06 20:26:02 +01:00
RobAtticus NA
57ef405316 Merged in rename-timescale (pull request #93)
Rename iobeamdb to TimescaleDB

Approved-by: ci-vast
2017-03-06 16:19:00 +00:00
Rob Kiefer
ee3ad4678d Rename iobeamdb to TimescaleDB 2017-03-06 11:06:49 -05:00
enordstr NA
e17457261f Merged in enordstr/backend-database/enordstr/no-partitioning-column-segfault-fix (pull request #100)
Fix segfault due to uninitialized partitioning info.

Approved-by: Olof Rensfelt
Approved-by: ci-vast
Approved-by: Matvey Arye
2017-03-06 12:47:18 +00:00
Erik Nordström
675aecc614 Fix segfault due to uninitialized partitioning info.
Hypertables that have no partitioning column set will experience
a segmentation fault at query time when a partitioning info struct
is read without being properly initialized. This change will zero-
initialize the struct so that the partitioning column name will
be a NULL pointer instead of garbage if not set.
2017-03-06 13:18:23 +01:00
Matvey Arye
0e36e3287f Merged in cevian/ordered-insert (pull request #96)
Cevian/ordered insert

Approved-by: ci-vast
Approved-by: enordstr NA
2017-03-05 20:24:43 +00:00
Matvey Arye
4d4ac78ef5 cleanup 2017-03-05 10:13:45 -05:00
Matvey Arye
2404940315 getting rid of move_plan in cache. creating the plan caused a lock to be taken on the chunk table -- a lock which lead to a deadlock 2017-03-03 10:10:14 -05:00
Matvey Arye
64e8ec1877 Ordering inserts to avoid deadlocks 2017-03-03 10:10:14 -05:00
Rob Kiefer
2093b0ac6f Fix verbosity level from normal to default 2017-03-02 13:50:23 -05:00
RobAtticus NA
19a780526c Merged in test-verbosity (pull request #98)
Reduce verbosity to remove line nums from output.

Approved-by: ci-vast
Approved-by: enordstr NA
Approved-by: Olof Rensfelt
2017-03-02 18:33:22 +00:00
Rob Kiefer
5478231f3e Reduce verbosity to remove line nums from output. 2017-03-02 13:09:33 -05:00
RobAtticus NA
d1af4cfab0 Merged in update-readme-testing (pull request #97)
Approved-by: Ajay Kulkarni
Approved-by: Solar Olugebefola
Approved-by: ci-vast
2017-03-02 16:41:41 +00:00
Rob Kiefer
e7169dfcb5 Update README to move testing instructions.
Having the testing instructions in the installation instructions
was confusing and error-prone due to having to set up your
postgresql.conf file. It is not a necessary step for installation.
2017-03-02 11:31:30 -05:00
enordstr NA
eae34e1bbb Merged in enordstr/backend-database/enordstr/cached-inserts-with-native-scans (pull request #95)
Cached inserts with native scans

Approved-by: Matvey Arye
Approved-by: ci-vast
2017-03-02 14:38:55 +00:00
Erik Nordström
eebd9bbbc1 Use native scan for chunks.
The chunk catalog table is now scanned with a native
scan rather than SPI call.

The scanner module is also updated with the option of
of taking locks on found tuples. In the case of chunk
scanning, chunks are typically returned with a share
lock on the tuple.
2017-03-02 12:25:00 +01:00
Erik Nordström
61668c837a Allow heap/index scans to abort early if condition is met.
Aborting scans can be useful when scanning large tables or indexes and
the scan function knows that a condition has been met (e.g., all
tuples needed have been found). For instance, when scanning for
hypertable partitions, one can abort the scan when the found tuple
count equals the number of partitions in the partition epoch.
2017-03-02 12:25:00 +01:00
Erik Nordström
1daec06ce6 Use native scans for partition epochs and partitions.
This patch refactors the code to use native heap/index scans for
finding partition epochs and partitions. It also moves the
partitioning-related code and data structures to partitioning.{c,h}.
2017-03-02 12:25:00 +01:00
Erik Nordström
c92fa28ea8 Add scanner module implementing both heap and index scans. 2017-03-02 12:24:59 +01:00
Erik Nordström
f99669c880 Use direct index scan for hypertable lookups.
This is a first stab at moving from SPI queries
to direct heap/index scans for cleaner and more
efficient code. By doing direct scans, there is no
need to prepare and cache a bunch of query plans
that make the code both slower and more complex.

This patch also adds a catalog module that keeps
cached OIDs and other things for catalog tables.
The cached information is updated every time the
backend switches to a new database. A permission
check is also implemented when accessing the catalog
information, but should probably be extended to
tables and schemas in the future.
2017-03-02 12:24:59 +01:00
Matvey Arye
67ad21ee36 Cache hypertable metadata information for faster inserts.
Add caches for hypertable metadata to make it faster to map
INSERT rows to the chunk they should go into.
2017-03-02 12:24:53 +01:00
RobAtticus NA
86d2e78894 Make sure UsingSamples steps are in ordered list 2017-03-01 20:33:50 +00:00
enordstr NA
8a24110886 Merged in enordstr/backend-database/enordstr/add-num-partitions-to-epoch (pull request #92)
Add number of partitions to partition_epoch table.

Approved-by: Matvey Arye
Approved-by: RobAtticus NA
Approved-by: Olof Rensfelt
2017-02-28 19:59:18 +00:00
Erik Nordström
c09f6013fa Add number of partitions to partition_epoch table.
There are two reasons for adding the partition count to
the partition_epoch table:

* It makes the partition_epoch more self-describing as
  it makes it easy to see how many partitions are
  in the current epoch as well as past ones.
* It simplifies native code that can read the partition
  epoch, allocate memory for the right number of partitions,
  and finally scan the partition table filling in each entry.
2017-02-28 20:07:32 +01:00
RobAtticus NA
6dfe84036e Merged in sample-instructions (pull request #83)
Add examples to Sample readme

Approved-by: Matvey Arye
Approved-by: ci-vast
Approved-by: Ajay Kulkarni
2017-02-24 01:30:37 +00:00
enordstr NA
1787793b64 Merged in enordstr/backend-database/enordstr/close-chunks-at-end-of-insert (pull request #89)
Fix chunk-related deadlocks.

Approved-by: ci-vast
Approved-by: Matvey Arye
Approved-by: RobAtticus NA
2017-02-23 20:52:44 +00:00
Rob Kiefer
bc05676166 Add examples to Sample readme 2017-02-23 13:49:24 -06:00
Olof Rensfelt
4f31531bab Merged in olof_rensfelt/backend-database/ore/block_alter_table (pull request #88)
Block renaming of hypertables

Approved-by: ci-vast
Approved-by: RobAtticus NA
Approved-by: Matvey Arye
2017-02-23 19:48:52 +00:00
Erik Nordström
e3fabf993a Fix chunk-related deadlocks.
This patch fixes two deadlock cases.

The first case occurred as a result of taking partition and chunk
locks in inconsistent orders. When creating the first chunk C1
in a table, concurrent INSERT workers would race to create
that chunk. The result would be that the transactions queue up on
the partition lock P, effectively serializing these transactions.
This would lead to these concurrent transactions to insert
at very different offsets in time, one at a time. At some point
in the future, some n'th transaction Tn queued up on P would get
that lock as the preceeding inserters T1-(n-1) finish their inserts
and move on to their next batches. When Tn finally holds P, one of
the preceeding workers starts a new transaction that finds that it
needs to close C1, grabbing a lock on C1 and then on P. However,
it will block on P since Tn already holds P. Tn will also believe
it needs to close C1, thus trying to grab a lock on C1, but will
block, causing a deadlock.

The second case can occur on multi-partition hypertables. With
multiple partitions there are more than one open-ended chunk
at a time (one for each partition). This leads to a deadlock case
when two processes try to close (and thus lock) the chunks in
different order. For instance process P1 closes chunk C1 and then
C2, while process P2 locks in order C2 and C1.

The fix for the first case is to remove the partition lock
altogether. As it turns out, this lock is not needed.
Instead, transactions can race to create new chunks, thus causing
conflicts. A conflict in creating a new chunk can safely be
ignored and it also avoids taking unecessary locks. Removing the
partition lock also avoids the transaction serialization that
happens around this lock, which is especially bad for long-running
transactions (e.g., big INSERT batches).

The fix for the second multi-partition deadlock case is to always
close chunks in chunk ID order. This requires closing chunks at
the end of a transaction, once a transaction knows all the chunks
it needs to close. This also has the added benefit of reducing the
time a transaction holds exclusive locks on chunks, potentially
improving insert performance.
2017-02-23 15:41:57 +01:00
Olof Rensfelt
549b69ea81 Block renaming of hypertables 2017-02-23 13:37:45 +01:00
Olof Rensfelt
5e44e996f4 Merged in olof_rensfelt/backend-database/ore/remove_clustering (pull request #87)
Make all tests use create_single_db.sql

Approved-by: ci-vast
Approved-by: RobAtticus NA
Approved-by: enordstr NA
2017-02-23 08:05:20 +00:00
Olof Rensfelt
220e938930 Make all tests use create_single_db.sql 2017-02-22 15:18:56 +01:00
Olof Rensfelt
ffc146c27f Merged in olof_rensfelt/backend-database/ore/remove_clustering (pull request #86)
Remove clustered tests.

Approved-by: ci-vast
Approved-by: enordstr NA
2017-02-22 13:46:17 +00:00
Olof Rensfelt
406dbb7bd6 Remove clustered tests. 2017-02-22 12:16:48 +01:00
Olof Rensfelt
1d62f206cc Merged in olof_rensfelt/backend-database/ore/fix_docker_build (pull request #84)
Add .dockerignore

Approved-by: RobAtticus NA
Approved-by: Matvey Arye
Approved-by: ci-vast
2017-02-21 11:00:10 +00:00
Olof Rensfelt
4e247e0248 Add .dockerignore
Remove data/ adn docs/ from the docker build process.
2017-02-21 11:54:17 +01:00
Ajay Kulkarni
e8473b7ce8 Merged in readme-edits (pull request #81)
Readme edits for usability, clarity, consistency, and general awesomeness.

Approved-by: ci-vast
Approved-by: RobAtticus NA
2017-02-14 16:38:13 +00:00
enordstr NA
7a87b0f18b Merged in enordstr/backend-database/enordstr/custom-time-conversion (pull request #80)
Fix conversion between TIMESTAMP and internal BIGINT UNIX time representation.

Approved-by: Matvey Arye
Approved-by: ci-vast
2017-02-14 13:19:56 +00:00
Erik Nordström
4683d8e03e Fix conversion between TIMESTAMP and internal BIGINT UNIX time representation.
Currently, the internal metadata tables for hypertables track time
as a BIGINT integer. Converting hypertable time columns in TIMESTAMP
format to this internal representation requires using Postgres' conversion
functions that are imprecise due to floating-point arithmetic. This patch
adds C-based conversion functions that offer the following conversions
using accurate integer arithmetic:

- TIMESTAMP to UNIX epoch BIGINT in microseconds
- UNIX epoch BIGINT in microseconds to TIMESTAMP
- TIMESTAMP to Postgres epoch BIGINT in microseconds
- Postgres epoch BIGINT in microseconds to TIMESTAMP

The downside of the UNIX epoch functions are that they don't offer the full
date range as offered by the Postgres to_timestamp() function. This is
because of the required epoch shift might otherwise overflow the BIGINT.
All functions should, however, offer appropriate range checks and will
throw errors if outside the range.
2017-02-14 14:01:26 +01:00
Ajay Kulkarni
c332f32dbf Readme edits for usability, clarity, consistency, and general awesomeness. 2017-02-13 19:07:10 -05:00
enordstr NA
a910d100aa Merged in enordstr/backend-database/enordstr/fix-compiler-warnings (pull request #82)
Fix C-style and compiler warnings

Approved-by: ci-vast
Approved-by: RobAtticus NA
2017-02-13 19:09:27 +00:00
Erik Nordström
ab3070aa89 Fix C-style and compiler warnings
- Add emacs-style indentation settings headers
- Fix compiler warnings related to C style
- Indentation fixes
2017-02-13 11:47:41 +01:00
Rob Kiefer
03c9565915 README tweaks 2017-02-09 15:28:38 -05:00
Rob Kiefer
027dc56085 Update sample doc instructions and add links 2017-02-09 14:36:42 -05:00
enordstr NA
5c4fdb4a98 Merged in enordstr/backend-database/enordstr/readme-and-retention (pull request #76)
Update README and add user-facing API to drop chunks

Approved-by: Ajay Kulkarni
Approved-by: Matvey Arye
Approved-by: ci-vast
2017-02-09 14:12:48 +00:00
Erik Nordström
81d966f908 Update README and add user-facing API to drop chunks
- Add complete database setup instructions to the README.
- Add drop_chunks() user-facing API
- Add retention policy section to README
2017-02-09 13:04:20 +01:00