221 Commits

Author SHA1 Message Date
kgriffs
7d546fe89b Switch Redis driver modules over to oslo.utils.timeutils
This patch changes the Redis drivers so they use the oslo.utils
version of timeutils. This is consistent with the rest of Zaqar.

Change-Id: I56379b90414cbd8bcc6bca6998988dba800693b9
Partially-Implements: blueprint redis-storage-driver
2014-09-03 13:59:23 -05:00
kgriffs
0562485a09 Calculate stats dynamically instead of using side counters
Side counters are error-prone, and there are cases where they can
get out of sync if we lose a connection to the DB at the wrong
moment. Also, they are difficult to update when performing GC
operations.

This patch mostly removes the use of counters to track stats and
does the calculations on the fly. These calculations should still be
quite fast, since we are still using a per-claim counter (which
is easier to maintain than the per-queue counters).

Change-Id: I5d63a3791afd8d749890c5996208568c974f71d1
Partially-Implements: blueprint redis-storage-driver
2014-09-03 13:58:33 -05:00
Jenkins
00e5157f0c Merge "Implement claim and message expiration logic for Redis" 2014-09-03 13:13:33 +00:00
Jenkins
8c1b605a5c Merge "Make Client-ID a required header" 2014-09-03 00:21:53 +00:00
Jenkins
74e631ba68 Merge "Make X-Project-ID a required header" 2014-09-02 21:45:35 +00:00
Flavio Percoco
5bf16193e7 Make Client-ID a required header
It was decided to make Client-ID a required header. This patch adds a
new `before hook` that enforces this new rule.

Partially-Implements blueprint: api-v1.1-header-changes

Change-Id: I7b20d56812a0dff4f8ed3e6da75b62ef7c0f307e
2014-09-02 20:55:21 +02:00
Flavio Percoco
53733f344e Make X-Project-ID a required header
We decided to make X-Project-ID a required header for every request. If
not present, a 400 error should be raised.

Partially-Implements: blueprint api-v1.1-header-changes
Change-Id: I6c6c21585e9a738ff7c0f74ce6a284229ebec2aa
2014-09-02 20:55:18 +02:00
kgriffs
395c594b8f Implement claim and message expiration logic for Redis
This patch uses Redis where possible to automatically expire
claim and message data. Where it is not possible, manual
GC functions have been added in order to iterate through the
remaining data and clean it up.

Note that this patch does not include an implementation for
a command script that will call the Redis drivers' GC
method. That will be done in a followup patch.

Also, the GC functions in this patch do not decrement the
stats counters, since those are actually removed in the next
patch.

This change has been tested locally on my box using the
ZAQAR_TEST_REDIS=1 flag.

Change-Id: I38bfc52cf2de0ed078478aca80e6ad56b5bd55aa
Partially-Implements: blueprint redis-storage-driver
2014-09-02 13:23:01 -05:00
Prashanth Raghu
76f6e063db Implements queue, message and claim controllers for Redis
This patch implements the standard controllers for the redis
storage driver. It has been tested against a localhost Redis
server with ZAQAR_TEST_REDIS=1.

Change-Id: Ib7c100afd11a0410c3f241c1925d5aaf172ce6a8
Partially-Implements: blueprint redis-storage-driver
2014-08-30 15:45:27 -05:00
Flavio Percoco
ab1d471d94 Make the catalog flavor-aware
This patch adds the knowledge of flavors to the catalog. When a new
queue is registered, if a flavor is passed, it'll get the pool from the
flavor record. If flavor is not passed, it'll preserve the previous
behavior.

Partially Implements blueprint: marconi-queue-flavors

Change-Id: Idcf5a0215699269f29df793169ff21fc6435f3b2
2014-08-28 19:12:54 +00:00
Jenkins
19d2dcebea Merge "Add API support for flavors" 2014-08-27 09:27:00 +00:00
Jenkins
a80b985f95 Merge "Switch to oslo.utils" 2014-08-26 17:05:02 +00:00
Flavio Percoco
d8388e89fd Add API support for flavors
This patch adds the control API for flavors. The patch allows users to
create, delete, update and list flavors. This API is considered an
admin-only API, hence it's registered as part of the private endpoints.

DocImpact

Partially-Implements blueprint marconi-queue-flavors

Change-Id: Id29d29940f2ecabab0531edefe018c0dd2f39811
2014-08-26 16:53:25 +02:00
Jenkins
0300181024 Merge "Encapsulate top-level lists in responses in object" 2014-08-26 02:02:31 +00:00
Fei Long Wang
28df6f5cb0 Switch to oslo.utils
Change-Id: Ie040478db7773dc90f98b876a97893f3a63162e5
2014-08-26 12:07:53 +12:00
Jenkins
562b82b0f0 Merge "Clean up expired messages for SQLAlchemy driver" 2014-08-23 13:38:16 +00:00
pengfei wang
d8904dd495 Clean up expired messages for SQLAlchemy driver
Change-Id: I1d14258528bdea89399d491d45e5e1dfd1b06b50
Closes-Bug: #1331228
2014-08-21 11:25:17 +08:00
Nataliia Uvarova
533beb5dda Encapsulate top-level lists in responses in object
All top-level JSON arrays in response bodies are now encapsulated within
an object. Endpoints changed:
messages_get_many: GET /v1.1/queues/{queue}/messages?ids=
claim_create: POST /v1.1/queues/{queue}/claims

Partially-implements: blueprint api-v1.1-response-document-changes
Change-Id: I81e64decc928be665b8b4f4d0e238fd701794bc9
2014-08-20 11:33:14 +03:00
Fei Long Wang
13df51be82 feat(v1.1): Implement new /health endpoint for v1.1
The new /health endpoint of v1.1 is different from the /health
of v1.0. In v1.1 /health endpoint we will return a set of KPI
(Key Performance Indicator) of the target Marconi server. The
API response will be like below:

{
    "mongo_pool_1": {
        "message_volume": {
            "claimed": 0,
            "total": 0,
            "free": 0
        },
        "storage_reachable": true,
        "operation_status": {
            "create_queue": {
                "seconds": 0.0021300315856933594,
                "ref": null,
                "succeeded": true
            },
            "post_messages": {
                "seconds": 0.033502817153930664,
                "ref": null,
                "succeeded": true
            },
            "list_messages": {
                "seconds": 0.000013113021850585938,
                "ref": null,
                "succeeded": true
            },
            "claim_messages": {
                "seconds": 0.0013759136199951172,
                "ref": "3f515f37-58a0-4c81-8214-3e92979b82e7",
                "succeeded": false
            },
            "delete_queue": {
                "seconds": 0.0030739307403564453,
                "ref": null,
                "succeeded": true
            }
        }
    },
    "mongo_pool_2": {
        "message_volume": {
            "claimed": 0,
            "total": 0,
            "free": 0
        },
        "storage_reachable": true,
        "operation_status": {
            "create_queue": {
                "seconds": 0.0011799335479736328,
                "ref": null,
                "succeeded": true
            },
            "post_messages": {
                "seconds": 0.024316072463989258,
                "ref": null,
                "succeeded": true
            },
            "list_messages": {
                "seconds": 0.000008106231689453125,
                "ref": null,
                "succeeded": true
            },
            "claim_messages": {
                "seconds": 0.000576019287109375,
                "ref": "68629fda-b4ce-4cf9-978a-df0df8df36a7",
                "succeeded": false
            },
            "delete_queue": {
                "seconds": 0.003300905227661133,
                "ref": null,
                "succeeded": true
            }
        }
    },
    "catalog_reachable": true
}

docImpact
Implements: blueprint detailed-health

Change-Id: I6b281132e2fef8ce65ce54b9d6be297571f8b170
2014-08-19 18:16:59 +12:00
Flavio Percoco
962979a922 Add flavors support to mongodb
This patch is a follow-up on the queue's flavor work. It adds support
for such feature to the MongoDB storage driver.

Partially-Implements blueprint: marconi-queue-flavors

Change-Id: Ib3231ab361896e1c08831d17899dd4111710ab9b
2014-08-06 12:54:23 +02:00
Flavio Percoco
67949a7870 Require mongodb >= 2.2 or fail misserably
The patch adds a minimum requirement for mongodb. This will provide a
useful error message to users when the installed mongodb version doesn't
match the minimum required one.

Change-Id: Iff8bb1645e7276529230da58c408552bebd8647a
2014-08-04 17:48:12 +02:00
Flavio Percoco
36e63c9a45 Rename Marconi to Zaqar
This patch renames every package, file, match of Marconi in the codebase
to Zaqar *except* for the .gitreview file, which will have to be updated
*after* I8e587af588d9be0b5ebbab4b0f729b106a2ae537 lands.

Implements blueprint: project-rename

Change-Id: I63cf2c680cead4641f3e430af379452058bce5b3
2014-08-04 10:36:50 +02:00
Flavio Percoco
ba998351c1 Merge metadata back into the queue endpoint
During Icehouse, we decided to pull the metadata out of the queue
endpoint by adding a new endpoint `/metadata`. This worked well because
we didn't have a clear view of what the scope of metadata is. Now that
we want to use it and make it a key piece of the queues, we've found
that the workflow is not as clear as we'd like. The reason being that
some key items of the metadata - flavor, for example - need to be
specified during the queue creation and not after.

Merging these endpoints together is enough to fix this issue.

DocImpact

Implements blueprint: api-v1.1-merge-queue-and-metadata

Change-Id: Icca1a2b2066a518f8f50cad20e55b39a8bff0f2d
2014-08-04 10:36:47 +02:00
Jenkins
90cd53a4a0 Merge "Fixes several failing mongo driver tests" 2014-08-01 12:57:40 +00:00
kgriffs
5d94584c33 Fixes several failing mongo driver tests
Some mongodb tests were failing because the test suite was not
cleaning up the database in between runs. In the course of
fixing this bug, the tests in question were also DRY'd up between
the sqla and mongo drivers.

NOTE: This patch is a prerequisite for enabling mongo in the gate.
Change-Id: Iaa2a1cbd6a27c53a884c9e0260d48d77a7f198b9
2014-08-01 13:57:12 +02:00
Jenkins
1f39b7993c Merge "Correct the test instructions in README" 2014-07-31 22:47:37 +00:00
Jenkins
526170dac2 Merge "Minor cleanup of utils unit test" 2014-07-25 09:49:54 +00:00
Jenkins
b3f1b48d0f Merge "API v1.1 - Encapsulate message post bodies in a JSON object" 2014-07-24 02:21:35 +00:00
Jenkins
8ac9823b63 Merge "Remove check queue exists endpoint" 2014-07-24 00:54:07 +00:00
Jenkins
ae019cb35b Merge "Rename remaining 'shard' to 'pool'" 2014-07-23 22:31:16 +00:00
kgriffs
2be550c064 Minor cleanup of utils unit test
This patch removes an unnecessary stream seek from one test,
and renames a couple other tests to reflect the refactoring
of the filter_stream function into two separate functions.

Change-Id: Ie6731766028dee2410193ae79ec4c6f985df1a92
2014-07-23 17:09:06 -05:00
pengfei wang
de666b242b Correct the test instructions in README
README instructions on running functional tests without tox
points to nonexistent conf file, and also steps are not correct.

Change-Id: I51ce0a4a7f4bc3396a744ec1bedcf862dcc04688
Closes-Bug: #1347223
2014-07-23 14:58:40 +08:00
kgriffs
38c28a2de8 API v1.1 - Encapsulate message post bodies in a JSON object
This patch implements one of the breaking changes specified in
the API v1.1 spec, which requires clients to encapsulate the
list of messages to enqueue in a JSON object, when posting
those messages to the API.

Partially-Implements: blueprint api-v1.1-request-document-changes
Change-Id: I72ae87e1c479b6be6fbc8ce1fbaee89b2729e41a
2014-07-22 13:28:58 -05:00
Jenkins
79f0d2267b Merge "feat(v1.1): Default TTL and grace values" 2014-07-22 03:23:33 +00:00
Fei Long Wang
0fc10894af Rename remaining 'shard' to 'pool'
Rename remaining 'shard' to 'pool' to avoid any confusing.

Closes-Bug: 1346690

Change-Id: I3c889fd41187ae6a53a45fed26fb95da99f78dd8
2014-07-22 15:15:10 +12:00
kgriffs
354afebee2 feat(v1.1): Default TTL and grace values
When posting messages, the "ttl" field may be omitted, in which
case the server defaults to the default TTL value configured by
the operator.

Likewise, when creating a claim, the "ttl" and "grace" fields
may be omitted to use the defaults configured for each field.

Change-Id: I38c6307377293b26370de28ffa13db22228c208c
Partially-Implements: blueprint api-v1.1-request-document-changes
2014-07-18 17:42:26 -05:00
Malini Kamalambal
fe01a29583 Remove check queue exists endpoint
This patch removes the queue exists check from the transport layer.
Implements: blueprint api-v1.1-remove-check-queue-existence

Change-Id: I5fbd3089d552c22ab59a49a7fadc743cbb884770
2014-07-18 15:43:35 -04:00
Malini Kamalambal
3a59f52d55 Implement POP in v1.1 API
This patch implements the pop functionality for v1.1 of the Marconi
API. The POP functionality is implemented as an optional parameter
in the delete messages using id params endpoint. This includes the
following validations,
1. pop & id params cannot be used together in the request.
2. 0 < pop value <= max_messages_per_claim_or_pop

docImpact
Change-Id: I63b22e57ed5ab398b81cde2d0284767e9704ec11
Implements: blueprint api-v1.1-pop-operation
2014-07-14 14:50:39 -04:00
Victoria Martínez de la Cruz
ddabc98a99 Drop pylint due to the huge amount of false positives
Given that pylint is raising a lot of false positives
and that we have alternative static code checkers,
we decided to remove pylint from the tox envlist.

This patch also fix some pylint true positives
and cleans up the disabled pylint tests in the codebase.

Change-Id: I6fb4b9b4c80af452796032736e39ef064b9bcd03
Closes-Bug: #1297994
2014-07-13 20:03:52 -03:00
Nataliia Uvarova
dfed02207d Run storage unit tests in pooled context
Enable storage unit tests for pooled context. This patch adds check for
pooling in test config in test initialization and creates appropriate
wrappers.

Also changes to sqlalchemy pooling controllers were made: in pooled
context project cannot be None due to constraint in database.

Change-Id: I59a663cef5b761e9470b8870d07cea03f5dac98b
2014-07-11 19:01:13 +03:00
Flavio Percoco
c088959432 Use the class queue_name and project for tests
Marker's test used a local queue_name instead of the one defined in the
base class. This caused some tests to fail because the ran on a no clean
database.

The patch makes the test use the queue_name and the project defined in
the class.

Change-Id: I5a1682e835a07a452eb1114da8c87369fe2f48b4
2014-07-08 15:48:22 +02:00
Jenkins
4dfb4e95d7 Merge "V1.1 Functional Tests" 2014-06-24 22:02:11 +00:00
abettadapur
c1715c6fb1 V1.1 Functional Tests
Added tests for new V1.1 functions like pop and shard
Updated existing tests for V1.1 return calls
Added new json schemas
Edited functional test base to support multiple schemas
Change-Id: I35dfb92af22540609ecb50c1eb5c8fa65e6cadc8
Partially-Implements blueprint: api-v1.1-functional-tests
2014-06-24 16:10:15 -04:00
Nataliia Uvarova
4090079147 Fix Python 3 leftovers
This commit contains last small fixes. In Python 3 None cannot be
compared with int. Also string can be added only to string, thus
NamedUnicodeStr should be subclass of string.

Change-Id: I3afaa24cd88861e56b906689870ca7f1b8e853bb
Implements: blueprint py3k-support
2014-06-20 14:19:52 +03:00
kgriffs
bf0645fdb5 Update hacking version and fix new violations
The newer hacking version is more strict about some things, so I
had to update a bunch of files with minor issues that previously
fell through the cracks.

Change-Id: I169bc6f8533bab28c7d6cf321ea83a8d7945f136
2014-06-18 10:22:34 -05:00
Jenkins
646cf79621 Merge "Rename shards to pool" 2014-06-18 09:47:49 +00:00
Flavio Percoco
15d55e7601 Rename shards to pool
Shard turned out to be a quite overloaded/confusing term to use here,
although correct. We decided to rename our shard feature to pool.

P.S: I swear I didn't use sed O.O

Change-Id: Ic54f29a4da7d7690c9c9210b74876b96f0ae0eac
2014-06-18 10:57:11 +02:00
Jenkins
c4674d76b0 Merge "Fix tests to be Python 3 compatible" 2014-06-17 22:42:47 +00:00
Jenkins
e89b390197 Merge "Refactor auxiliary methods for MongoDB unit tests" 2014-06-17 06:04:39 +00:00
Jenkins
5c1aaac2a8 Merge "Re-enable tests affected by #1321840" 2014-06-17 04:13:01 +00:00