)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"57d095e477c029c970fb169ca6109fc83882de2b","unresolved":false,"context_lines":[{"line_number":9,"context_line":"The root leader already decides when shard containers should"},{"line_number":10,"context_line":"shrink. Now it also decides when they should shard. This avoids"},{"line_number":11,"context_line":"obvious potential for a root and a shard to make independent"},{"line_number":12,"context_line":"conflicting decisions."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"On each sharder cycle the root leader looks for candidates to shard,"},{"line_number":15,"context_line":"sets their shard range state to SHARDING and propagates the state"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"df7087c5_92b93bcd","line":12,"updated":"2018-03-14 16:48:14.000000000","message":"I\u0027m torn about this. On the one hand, having a central authority would be rather nice. But the concern is that a root that hasn\u0027t received updates in a bit marks a shard to shrink while the shard independently realizes that it\u0027s grown too large, right? The shard by definition has a more up-to-date view of its own state -- with this change and in that case, wouldn\u0027t we end up shrinking the already-too-big shard into its neighbor?","commit_id":"0f6dc6ad87a83c3b8ffaf7af1cb903387f0e3ae1"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"ad3fb34611398c101921bcaacdaea4352d73c493","unresolved":false,"context_lines":[{"line_number":9,"context_line":"The root leader already decides when shard containers should"},{"line_number":10,"context_line":"shrink. Now it also decides when they should shard. This avoids"},{"line_number":11,"context_line":"obvious potential for a root and a shard to make independent"},{"line_number":12,"context_line":"conflicting decisions."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"On each sharder cycle the root leader looks for candidates to shard,"},{"line_number":15,"context_line":"sets their shard range state to SHARDING and propagates the state"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"df7087c5_c446d6c0","line":12,"in_reply_to":"df7087c5_92b93bcd","updated":"2018-03-16 11:09:10.000000000","message":"But we have to choose one place to make the decisions, no?\n\nI can see several ways in which we can improve deicison making at the root:\n\n- require a \u0027recent\u0027 stats update\n\n- implement per replica/db stats reporting so we can get aggregate view of stats\n\n- make a request to all replicas to check stats before proceeding","commit_id":"0f6dc6ad87a83c3b8ffaf7af1cb903387f0e3ae1"}],"swift/container/sharder.py":[{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"57d095e477c029c970fb169ca6109fc83882de2b","unresolved":false,"context_lines":[{"line_number":1003,"context_line":"        # First cut is simple: assume root container shard usage stats are good"},{"line_number":1004,"context_line":"        # enough to make decision."},{"line_number":1005,"context_line":"        # TODO: object counts may well not be the appropriate metric for"},{"line_number":1006,"context_line":"        # deciding to shrink because a shard with low object_count may have a"},{"line_number":1007,"context_line":"        # large number of deleted object rows that will need to be merged with"},{"line_number":1008,"context_line":"        # a neighbour. We may need to expose row count as well as object count."},{"line_number":1009,"context_line":"        if shard_ranges is None:"}],"source_content_type":"text/x-python","patch_set":2,"id":"df7087c5_3f7598cb","line":1006,"range":{"start_line":1006,"start_character":22,"end_line":1006,"end_character":28},"updated":"2018-03-14 16:48:14.000000000","message":"? I thought we were talking about deciding to shard...\n\nAh, copy/paste from below.","commit_id":"0f6dc6ad87a83c3b8ffaf7af1cb903387f0e3ae1"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"6ac1d1030754f418cf591e9ea4ae345ca1c42142","unresolved":false,"context_lines":[{"line_number":622,"context_line":"                    # bootstrap sharding of root container"},{"line_number":623,"context_line":"                    if self._find_sharding_candidates("},{"line_number":624,"context_line":"                            broker, shard_ranges\u003d[own_shard_range]):"},{"line_number":625,"context_line":"                        own_shard_range \u003d broker.get_own_shard_range()"},{"line_number":626,"context_line":""},{"line_number":627,"context_line":"                if broker.get_shard_ranges():"},{"line_number":628,"context_line":"                    # container may have been given shard ranges rather"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_b4ba996b","line":625,"updated":"2018-03-20 22:06:04.000000000","message":"Right, since _find_sharding_candidates can push own_shard_range\u0027s sate to SHARDING, and we want to catch that below...","commit_id":"0c9b3735d4becf57a2d724528a80550589c2e669"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"6ac1d1030754f418cf591e9ea4ae345ca1c42142","unresolved":false,"context_lines":[{"line_number":685,"context_line":"                    own_shard_range \u003d broker.get_own_shard_range()"},{"line_number":686,"context_line":"                    own_shard_range.update_state(ShardRange.SHARDED)"},{"line_number":687,"context_line":"                    own_shard_range.update_meta(0, 0)"},{"line_number":688,"context_line":"                    if (not broker.is_root_container() and not"},{"line_number":689,"context_line":"                            own_shard_range.deleted):"},{"line_number":690,"context_line":"                        own_shard_range \u003d own_shard_range.copy("},{"line_number":691,"context_line":"                            timestamp\u003dTimestamp.now(), deleted\u003d1)"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_ef2a787c","line":688,"range":{"start_line":688,"start_character":35,"end_line":688,"end_character":52},"updated":"2018-03-20 22:06:04.000000000","message":"Why does the root container get a pass? When (if ever) does it get marked deleted?","commit_id":"0c9b3735d4becf57a2d724528a80550589c2e669"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"6a1a451e691011f08594ad7d94c6dcc5a1f6e5bc","unresolved":false,"context_lines":[{"line_number":685,"context_line":"                    own_shard_range \u003d broker.get_own_shard_range()"},{"line_number":686,"context_line":"                    own_shard_range.update_state(ShardRange.SHARDED)"},{"line_number":687,"context_line":"                    own_shard_range.update_meta(0, 0)"},{"line_number":688,"context_line":"                    if (not broker.is_root_container() and not"},{"line_number":689,"context_line":"                            own_shard_range.deleted):"},{"line_number":690,"context_line":"                        own_shard_range \u003d own_shard_range.copy("},{"line_number":691,"context_line":"                            timestamp\u003dTimestamp.now(), deleted\u003d1)"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_4ed03cca","line":688,"range":{"start_line":688,"start_character":35,"end_line":688,"end_character":52},"in_reply_to":"df7087c5_ef2a787c","updated":"2018-03-21 09:40:20.000000000","message":"We don\u0027t need to do this for the root because it does not report itself to any other container. Marking the shard range deleted means it will no longer appear in the root\u0027s default get_shard_ranges() result. It is also a cue for cleaning up this container when the audit phase finds it (code yet to be written). The latter is the best reason for not doing this to a root, plus the possible inference that something deleted is no longer relevant.\n\nWe probably have some redundancy between the deleted attribute and just having a state \u0027deleted\u0027, or even the state \u0027sharded\u0027, but for now it was simple to keep deleted attribute because we have bits of sql pattern that filter based on that column.","commit_id":"0c9b3735d4becf57a2d724528a80550589c2e669"},{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"b5b87dc0afe299470dbb16e23fa825163b3b2948","unresolved":false,"context_lines":[{"line_number":985,"context_line":"                shard_range.update_state(ShardRange.SHARDING)"},{"line_number":986,"context_line":"                candidates.append(shard_range)"},{"line_number":987,"context_line":"        broker.merge_shard_ranges(candidates)"},{"line_number":988,"context_line":"        return len(candidates)"},{"line_number":989,"context_line":""},{"line_number":990,"context_line":"    def _find_shrinks(self, broker):"},{"line_number":991,"context_line":"        # this should only execute on root containers that have sharded; the"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_6fdc2718","line":988,"updated":"2018-03-20 23:26:12.000000000","message":"do we need to be careful not to put a range into sharding state if it\u0027s an accepter for shrinking.. it _shouldn\u0027t_ happen, but should we be sure. ie:\n\n  if shard_range.state !\u003d ShardRange.EXPANDING and shard_range.object_count \u003e\u003d self.shard_container_size:\n      ...\n\nOr something?","commit_id":"0c9b3735d4becf57a2d724528a80550589c2e669"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"c794dee6b0185877f49966755f0ca1f383f013bb","unresolved":false,"context_lines":[{"line_number":985,"context_line":"                shard_range.update_state(ShardRange.SHARDING)"},{"line_number":986,"context_line":"                candidates.append(shard_range)"},{"line_number":987,"context_line":"        broker.merge_shard_ranges(candidates)"},{"line_number":988,"context_line":"        return len(candidates)"},{"line_number":989,"context_line":""},{"line_number":990,"context_line":"    def _find_shrinks(self, broker):"},{"line_number":991,"context_line":"        # this should only execute on root containers that have sharded; the"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_af20fff8","line":988,"in_reply_to":"df7087c5_6fdc2718","updated":"2018-03-20 23:40:35.000000000","message":"Now that the root is driving sharding even for shards, the only time that could happen is when we\u0027re collapsing back to just the root... still probably worth being defensive, though.","commit_id":"0c9b3735d4becf57a2d724528a80550589c2e669"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"6a1a451e691011f08594ad7d94c6dcc5a1f6e5bc","unresolved":false,"context_lines":[{"line_number":985,"context_line":"                shard_range.update_state(ShardRange.SHARDING)"},{"line_number":986,"context_line":"                candidates.append(shard_range)"},{"line_number":987,"context_line":"        broker.merge_shard_ranges(candidates)"},{"line_number":988,"context_line":"        return len(candidates)"},{"line_number":989,"context_line":""},{"line_number":990,"context_line":"    def _find_shrinks(self, broker):"},{"line_number":991,"context_line":"        # this should only execute on root containers that have sharded; the"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_b1013d07","line":988,"in_reply_to":"df7087c5_af20fff8","updated":"2018-03-21 09:40:20.000000000","message":"line 981 - only ACTIVE ranges are considered. However, why did I allow shard_ranges to be passed in to the method?? oh right, to bootsrap the root container.","commit_id":"0c9b3735d4becf57a2d724528a80550589c2e669"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"6ac1d1030754f418cf591e9ea4ae345ca1c42142","unresolved":false,"context_lines":[{"line_number":1020,"context_line":"                # donor merging into a single acceptor. Don\u0027t fret - eventually"},{"line_number":1021,"context_line":"                # all the small ranges will be retired."},{"line_number":1022,"context_line":"                continue"},{"line_number":1023,"context_line":"            if (acceptor is not own_shard_range and acceptor.state not in"},{"line_number":1024,"context_line":"                    (ShardRange.ACTIVE, ShardRange.EXPANDING)):"},{"line_number":1025,"context_line":"                # don\u0027t shrink into a range that is not yet ACTIVE or was"},{"line_number":1026,"context_line":"                # selected as a donor on a previous cycle"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_cf9a14c4","line":1023,"range":{"start_line":1023,"start_character":25,"end_line":1023,"end_character":31},"updated":"2018-03-20 22:06:04.000000000","message":"We\u0027ve got fairly good __eq__/__ne__ methods on ShardRanges, yeah? Since we occasionally redefine/refetch own_shard_range, would it be better to use !\u003d instead, just to be defensive?","commit_id":"0c9b3735d4becf57a2d724528a80550589c2e669"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"6a1a451e691011f08594ad7d94c6dcc5a1f6e5bc","unresolved":false,"context_lines":[{"line_number":1020,"context_line":"                # donor merging into a single acceptor. Don\u0027t fret - eventually"},{"line_number":1021,"context_line":"                # all the small ranges will be retired."},{"line_number":1022,"context_line":"                continue"},{"line_number":1023,"context_line":"            if (acceptor is not own_shard_range and acceptor.state not in"},{"line_number":1024,"context_line":"                    (ShardRange.ACTIVE, ShardRange.EXPANDING)):"},{"line_number":1025,"context_line":"                # don\u0027t shrink into a range that is not yet ACTIVE or was"},{"line_number":1026,"context_line":"                # selected as a donor on a previous cycle"}],"source_content_type":"text/x-python","patch_set":5,"id":"df7087c5_ce2d2ca9","line":1023,"range":{"start_line":1023,"start_character":25,"end_line":1023,"end_character":31},"in_reply_to":"df7087c5_cf9a14c4","updated":"2018-03-21 09:40:20.000000000","message":"ShardRange._eq__ only compares lower/upper. IF we ever had another acceptor that spanned entire namespace it would equal the root own shard range. We can have a shard that is entire namespace (the final shard while shrinking) but currently there is no intentional case where we\u0027d be considering it for acceptor. However, it felt safer to use the more stringent test for sameness.","commit_id":"0c9b3735d4becf57a2d724528a80550589c2e669"}]}
