6755 Commits

Author SHA1 Message Date
Clay Gerrard
a0fcca1e05 Do not sync suffixes when remote rejects reconstructor revert
SSYNC is designed to limit concurrent incoming connections in order to
prevent IO contention.  The reconstructor should expect remote
replication servers to fail ssync_sender when the remote is too busy.
When the remote rejects SSYNC - it should avoid forcing additional IO
against the remote with a REPLICATE request which causes suffix
rehashing.

Suffix rehashing via REPLICATE verbs takes two forms:

1) a initial pre-flight call to REPLICATE /dev/part will cause a remote
primary to rehash any invalid suffixes and return a map for the local
sender to compare so that a sync can be performed on any mis-matched
suffixes.

2) a final call to REPLICATE /dev/part/suf1-suf2-suf3[-sufX[...]] will
cause the remote primary to rehash the *given* suffixes even if they are
*not* invalid.  This is a requirement for rsync replication because
after a suffix is synced via rsync the contents of a suffix dir will
likely have changed and the remote server needs to update it hashes.pkl
to reflect the new data.

SSYNC does not *need* to send a post-sync REPLICATE request.  Any
suffixes that are modified by the SSYNC protocol will call _finalize_put
under the hood as it is syncing.  It is however not harmful and
potentially useful to go ahead refresh hashes after an SSYNC while the
inodes of those suffixes are warm in the cache.

However, that only makes sense if the SSYNC conversation actually synced
any suffixes - if SSYNC is rejected for concurrency before it ever got
started there is no value in the remote performing a rehash.  It may be
that *another* reconstructor is pushing data into that same partition
and the suffixes will become immediately invalidated.

If a ssync_sender does not successful finish a sync the reconstructor
should skip the REPLICATE call entirely and move on to the next
partition without causing any useless remote IO.

Closes-Bug: #1665141

Change-Id: Ia72c407247e4525ef071a1728750850807ae8231
2017-04-06 17:37:34 +01:00
Jenkins
bc9a7075d3 Merge "Fix intermittent test_unlink_* failures" 2017-04-03 06:55:18 +00:00
Clay Gerrard
88ebcafbb9 Fix intermittent test_unlink_* failures
Change-Id: Iab403724a418e5d8a44e56e58da782bc66eab6e4
Closes-Bug: #1579578
2017-03-29 22:30:54 +00:00
Tim Burke
cce719260d Clean up some doc formatting
Change-Id: Iac24369910464cb766fe7d5e6c15120d147930a7
2017-03-29 21:00:01 +00:00
Alexandre Lécuyer
95905b0174 Modify _get_hashes() arguments to be more generic
Some public functions in the diskfile manager expect or return full
file paths. It implies a filesystem diskfile implementation.
To make it easier to plug alternate diskfile implementations, patch
functions to take more generic arguments.

This commit changes DiskFileManager _get_hashes() arguments from:
  - partition_path, recalculate=None, do_listdir=False
to :
  - device, partition, policy, recalculate=None, do_listdir=False

Callers are modified accordingly, in diskfile.py, reconstructor.py,
and replicator.py

Change-Id: I8e2d7075572e466ae2fa5ebef5e31d87eed90fec
2017-03-29 14:57:40 +02:00
Jenkins
ff50c5f9b3 Merge "Use swift tempurl instaed of swift-temp-url" 2017-03-29 09:53:47 +00:00
Jenkins
75c31760aa Merge "Fix some reST field lists in docstrings" 2017-03-29 08:56:52 +00:00
Jenkins
ca958317f0 Merge "Test that Manager.reload does stop/start in that order" 2017-03-29 08:26:08 +00:00
XieYingYun
36b1a2f69f Fix some reST field lists in docstrings
Probably the most common format for documenting arguments is reST field
lists [1]. This change updates some docstrings to comply with the field
lists syntax.

 [1] http://sphinx-doc.org/domains.html#info-field-lists

Change-Id: I87e77a9bbd5bcb834b35460ce0adff5bc59d9168
2017-03-29 09:11:07 +08:00
Jenkins
6cbf1c52e1 Merge "Remove unused returned value object_path from yield_hashes()" 2017-03-28 06:19:38 +00:00
Tim Burke
3ad8773239 Version DLOs, just like every other type of object
Previously, requests involving DLOs would bypass versioned_writes:

 * Any existing DLOs wouldn't get copied to the archive container during
   overwrites (or deletes, with history-mode), so there would be no
   evidence they had ever existed.

 * Any new DLOs wouldn't copy overwritten objects to the archive
   container, potentially leading to data loss.

Now, DLOs will behave like every other type of object under
versioned_writes.

Change-Id: I488e13eead2f33dd272d03f6f898adc52fc7fdad
Related-Change: Ie899290b3312e201979eafefb253d1a60b65b837
Related-Change: Ib5b29a19e1d577026deb50fc9d26064a8da81cd7
Closes-Bug: #1626989
2017-03-27 17:15:13 +00:00
Alexandre Lécuyer
cff7455a68 Remove unused returned value object_path from yield_hashes()
Some public functions in the diskfile manager expect or return full
file paths. It implies a filesystem diskfile implementation.
To make it easier to plug alternate diskfile implementations, patch
functions to take more generic arguments.

This commit changes DiskFileManager yield_hashes() returned values
from:
        - object_path, object_hash, timestamps
to:
        - object_hash, timestamps

object_path was not used by any caller.

Change-Id: I914fb1ec8ce7c9c26d22e1d07f03bd03f4504176
2017-03-27 17:18:28 +02:00
Jenkins
50ea38c070 Merge "Factor out a bunch of common testing setup" 2017-03-27 13:48:11 +00:00
lijunbo
47ba1041fc Use swift tempurl instaed of swift-temp-url
Deprecate swift-temp-url and call python-swiftclient's
implementation instead. This adds python-swiftclient as an
optional dependency of Swift which is noted in releasenotes.

Change-Id: I0404f16c21099cb7695430f5b63722729c305613
2017-03-27 18:38:50 +08:00
Jenkins
91fc844e7b Merge "Document SAIO rsync service setup for ubuntu 16" 2017-03-24 16:12:00 +00:00
Alistair Coles
a15b2a2a16 Test that Manager.reload does stop/start in that order
The current test for reload does not actually verify the order in
which stop and start are called. Tighten that up to ensure stop is
called before start.

Change-Id: Iede6eb2049e3ab8f3810a69a6b77713de3c71399
Related-Change: I4bf57c8cdba6773ddc1e4013e2b2a9736dacada8
2017-03-24 10:47:53 +00:00
Tim Burke
9edf914ff9 Drop support for auth-server from common/manager
swift-auth-server was removed in 2011. While there are still some lingering
references in test_manager, it's not clear whether removing them would
reduce test coverage for things like bad pid files.

See https://github.com/openstack/swift/commit/bd22dbe

Change-Id: I4bf57c8cdba6773ddc1e4013e2b2a9736dacada8
2017-03-23 11:36:59 -07:00
Jenkins
8a7c5ec960 Merge "keep consistent naming convention of swift and urls" 2017-03-23 10:06:44 +00:00
lijunbo
21396bc106 keep consistent naming convention of swift and urls
Change-Id: Iddd4f69abf77a5c643ce8b164fc6cfd72c068229
2017-03-23 02:28:41 +00:00
Tim Burke
dfeae59824 Factor out a bunch of common testing setup
Rather than having a comment declaring that the stack/history modes
only diverge after the delete(), move the common code to a separate
function called by tests for both modes.

Change-Id: I657106b11bf0697338a776513d2a51ac6e562c0a
2017-03-23 00:27:39 +00:00
Jenkins
5507df14e8 Merge "Test EC chunk_transformer with larger input chunks" 2017-03-22 20:37:06 +00:00
Kota Tsuyuzaki
8fe4bfefaa TestObjectController refactoring
From the related change of ECDuplication, Swift have a couple of Test
classes for EC policy, normal EC and EC Duplication, in the
test/unit/proxy/test_server.py. To enable the classes, the related change
abstracts the EC test cases as the ECTestMixin class to gather test
methods into one place but it was worse because TestObjectController did
still have both test cases for replication and for ec that may be hard
to understand the test class structure.

Hence, this patch attempts to refactor the structure as

From:

     ECTestMixin
            |
    -------------------------------------
    |                                   |
TestObjectController           TestObjectControllerECDuplication
(for replication and EC)       (for EC Duplication Policy)

To:

    BaseTestObjectController
            |
    --------------------------------------
    |                                    |
TestReplicatedObjectController  BaseTestECObjectController
(for replication)                        |
                          ---------------------------------
                          |                               |
                TestECObjectController    TestECDuplicationObjectController
                (for EC policy)           (for EC Duplication Policy)

Some more cleanups are in follow up patches because this patch shows a lot
of moving code chunks which could be hard to compare the diff. To make
the review easy, this patch forcus on ONLY the structure changes as
possible.

Related-Change: Idd155401982a2c48110c30b480966a863f6bd305
Related-Change: I25a3f8fc837706d78dca226fe282d9e5ead65a0d
Change-Id: Ifd3d0fa66773e640bb61cc528f7a1b2358e97d91
2017-03-22 19:54:50 +00:00
Jenkins
050bb63b77 Merge "Include received frag_index in reconstructor log warnings" 2017-03-22 16:19:53 +00:00
Jenkins
39c7021aa4 Merge "Small fixes for ec duplication" 2017-03-22 16:14:23 +00:00
Jenkins
23cc5d1f18 Merge "Clean up unused function" 2017-03-22 11:14:48 +00:00
Jenkins
1954189483 Merge "Remove duplicate code in test_diskfile.py" 2017-03-22 07:48:17 +00:00
Jenkins
55075ea8be Merge "Add extra test for name_check /info" 2017-03-21 17:53:31 +00:00
Jenkins
809229203b Merge "Log the correct request type of a subrequest downstream of copy" 2017-03-21 17:37:12 +00:00
Tim Burke
7d08b0735f Clean up unused function
Also, use `==` instead of `is` for string comparison.

Change-Id: I12040d56afc239a7b7be1ae37b27cce708bf6f10
Related-Change: I1ccb2665b6cd2887659e548e55a26aa00de879e3
2017-03-21 08:46:17 -07:00
Jenkins
3abc664b7a Merge "add name_check to /info" 2017-03-21 14:23:32 +00:00
Alistair Coles
3b83bd42a6 Remove duplicate code in test_diskfile.py
DiskFileMixin and DiskFileManagerMixin has almost
identical setUp() and tearDown() methods, and both
inherit BaseDiskFileTestMixin, so this moves the common
code into the abstract superclass.

Also remove repeated declaration of vars in
test_diskfile.py:run_quarantine_invalids
and a duplicated qualified import in obj/test_server.py

Change-Id: Id99ba151c7802c3b61e483a7e766bf6f2b2fe3df
2017-03-21 11:37:33 +00:00
Alistair Coles
bd400dd22e Add extra test for name_check /info
Test that the actual configured options get reported in /info

Follow up to:
Related-Change: If1af43485b4708cab6c4b5d7f6f0a334d8752518

Change-Id: I1d76d40c70a38b959dd0103f3c56b1da4dae068f
2017-03-21 10:59:50 +00:00
John Dickinson
cd39778824 add name_check to /info
Also removed a bunch of unnecessary unquotes. Just use path_info
instead (it's already unquoted).

Partial-Bug: #1670915

Change-Id: If1af43485b4708cab6c4b5d7f6f0a334d8752518
2017-03-21 10:58:41 +00:00
Janie Richling
108501a8c1 Log the correct request type of a subrequest downstream of copy
Before this change, subrequests made while servicing a copy would
result in logging the request type from the copy PUT/GET request
instead of the type from the subrequest being logged.

In order to have the correct requst type logged for subrequests:
- Changed subrequest environments to not inherit the orig_req_method
  of the enclosing request.
- Changed copy to be more picky about when it sets orig_req_method

In addition, subrequest environments will no longer inherit the
swift.log_info from the enclosing request.  That inheritance had
been added at Ic96a92e938589a2f6add35a40741fd062f1c29eb
along with swift.orig_req_method.

Change-Id: I1ccb2665b6cd2887659e548e55a26aa00de879e3
Closes-Bug: #1657246
2017-03-20 22:11:33 -05:00
Alistair Coles
52a23ddb3c Fix race when consolidating new partition
Suffix hash invalidations in hashes.invalid can be lost when two
concurrent calls to get_hashes consolidate the hashes of a new
partition with no hashes.pkl:

- suffix S has been invalidated and is listed in hashes.invalid
- process X calls get_hashes when there is no existing hashes.pkl
- process X removes hashes.invalids file in consolidate_hashes
- process X calculates the hash of suffix S (note, process X has
  not yet written hashes.pkl)
- process Y invalidates suffix S, appends S to hashes.invalid, so the
  hash of suffix S *should* be recalculated at some point
- process Z calls get_hashes->consolidate_hashes, deletes hashes.invalid
  because there is still no hashes.pkl
- process Z fails
- process X writes hashes.pkl with stale hash value for suffix S
- the invalidation of S that was made by process Y is lost

The solution is to never remove hashes.invalid during consolidate_hashes
without first recording any invalid suffixes in hashes and writing hashes
to disk in hashes.pkl. This is already the behaviour when hashes.pkl
exists. The cost of an additional write to hashes.pkl, introduced by this
patch, is only incurred once, when get_hashes first encounters a
partition with no hashes.pkl.

Related-Change: Ia43ec2cf7ab715ec37f0044625a10aeb6420f6e3

Change-Id: I08c8cf09282f737103e580c1f57923b399abe58c
2017-03-20 12:49:57 +00:00
cheng
99412d4830 fix get ring name
replace ring_name = basename(ring_path)[:len('ring.gz')]
with ring_name = basename(ring_path)[:-len('.ring.gz')]

Change-Id: I741e46d116c8fc7c2e91a51da4284302eec3aa41
Closes-bug: #1668736
2017-03-18 03:43:32 +00:00
Alistair Coles
aa9afb5384 Test EC chunk_transformer with larger input chunks
The tests were lacking coverage for the chunk_transformer
reading multiple segment_size pieces from an input chunk.
This patch modifies test_chunk_transformer to exercise more
input chunk scenarios.

Also improve variable naming and comments in
_test_determine_chunk_destinations_prioritize

Change-Id: I4eb55ee3e87dae478828f7ccba86fec267492bd8
Related-Change: Ib9e8a6f67c2985164dd20b049c7f144f19fd1822
2017-03-17 09:19:47 +00:00
Alistair Coles
56349e022d Include received frag_index in reconstructor log warnings
The Related-Change removed the frag_index expected from a
node response from the full_path included in log messages.
This made sense because the *expected* frag_index is not
necessarily the index that was actually received from the
node. However, it would be useful to include the *actual*
received frag_index in log messages.

This patch also:

- makes _full_path a module level function
- renames unique_index to be resp_frag_index to aid
  understanding of the various indexes we deal with during
  reconstruction.

Change-Id: Ic932835b3c1ed51a8456fce775fb59445fcb834b
Related-Change: I8096202f5f8d91296963f7a409a29d57fa7828e4
2017-03-17 09:18:17 +00:00
Kota Tsuyuzaki
a2f4046624 Small fixes for ec duplication
To address Alistair's comment at
https://review.openstack.org/#/c/219165.

This includes:

- Fix reconstructor log message to avoid redundant frag index info
- Fix incorrect FabricatedRing setting to have ec_k + ec_m replicas
- Use policy.ec_n_unique_fragments for testing frag index election
- Plus some various minor cleanup and docs additions

Huge refactoring around TestECMixin at the test/unit/proxy/test_server.py
is in https://review.openstack.org/#/c/440466/ to clarify the change.

Co-Authored-By: Alistair Coles <alistairncoles@gmail.com>

Change-Id: I8096202f5f8d91296963f7a409a29d57fa7828e4
2017-03-16 21:59:56 -07:00
Jenkins
5c0814daa6 Merge "Add assertions to test_reconstructor test_get_response" 2017-03-17 04:52:04 +00:00
Jenkins
31ccc2740a Merge "Fix intermittent EC GET test failure" 2017-03-16 20:46:36 +00:00
Alistair Coles
4f5c03c89d Fix intermittent EC GET test failure
test_GET_with_mixed_etags_at_same_timestamp in
test.unit.proxy.controllers.test_obj:TestECObjController
will fail intermittently when the randomly chosen bodies
of the two objects are identical. In conjunction with the
timestamps of the two objects being deliberately equal,
this makes the two objects identical.

Fix it by explicitly setting unique base strings for the
object bodies.

Change-Id: Idb1081edfa26b9f229f44b00c439cda33a7385fa
2017-03-16 16:56:32 +00:00
Jenkins
b43414c905 Merge "Accept storage_domain as a list in domain_remap" 2017-03-16 12:35:48 +00:00
Jenkins
2dd8357269 Merge "refactor some common code from crypto" 2017-03-14 17:22:30 +00:00
Jenkins
4143c3579c Merge "Fixed indentation in common/ and obj/" 2017-03-14 14:18:34 +00:00
Jenkins
612a6bb976 Merge "Update calling super class constructor style in proxy controllers" 2017-03-14 07:38:19 +00:00
Jenkins
1e9b8888bf Merge "Enable cluster-wide CORS Expose-Headers setting" 2017-03-13 19:24:20 +00:00
Kazuhiro MIYAHARA
7dd1985b90 Update calling super class constructor style in proxy controllers
"swift.proxy.controllers.base.Controller" inherits "object", so the
Controller class and its sub classes (AccountController,
ContainerController, BaseObjectController, InfoController) are
"new style class".  In new style class, if a class call super class's
constructor, "super(SubClass, self).__init__(foo, bar)" is recommended.
But, AccountController, ContainerController, BaseObjectController,
and InfoController use "Controller.__init__(self, app)", and it is
deprecated.

This patch fixes the calling super class constructor codes.

Change-Id: I4b94ec3131c7c7be4609716867a36490a70d5009
Closes-Bug: #1672285
2017-03-13 17:13:46 +09:00
Jenkins
8b2f01a619 Merge "More port number cleanup" 2017-03-10 23:31:59 +00:00
Jenkins
d6edefe886 Merge "Add another failing test for 412 logging" 2017-03-10 22:15:11 +00:00