Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
r2db
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Noblogs
r2db
Commits
2172eed4
Commit
2172eed4
authored
4 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Fix the map generators to use the $r2db_hash_map global
parent
a1d81530
No related branches found
No related tags found
No related merge requests found
Pipeline
#12484
passed
4 years ago
Stage: release
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
nginx-map/wp-nginx-map-json.php
+2
-2
2 additions, 2 deletions
nginx-map/wp-nginx-map-json.php
nginx-map/wp-nginx-map.php
+2
-2
2 additions, 2 deletions
nginx-map/wp-nginx-map.php
with
4 additions
and
4 deletions
nginx-map/wp-nginx-map-json.php
+
2
−
2
View file @
2172eed4
...
...
@@ -25,14 +25,14 @@ function backend_to_shard_id($backend) {
// Print the blog -> shard_id map.
function
generate_shard_map
(
$blogs
)
{
global
$wpdb
;
$wpdb_hash
=
&
$wpdb
->
hash_map
;
global
$r2db_
hash_map
;
$shard_map
=
array
();
foreach
(
$blogs
as
$blog
)
{
$blog_id
=
$blog
->
blog_id
;
if
(
$blog_id
==
1
)
continue
;
$backend_id
=
$
wp
db_hash
->
lookup
(
$blog_id
);
$backend_id
=
$
r2
db_hash
_map
->
lookup
(
$blog_id
);
$shard_id
=
backend_to_shard_id
(
$backend_id
);
$shard_map
[
$blog
->
domain
]
=
$shard_id
;
}
...
...
This diff is collapsed.
Click to expand it.
nginx-map/wp-nginx-map.php
+
2
−
2
View file @
2172eed4
...
...
@@ -38,8 +38,8 @@ function backend_to_http_endpoint($backend) {
// Print the blog -> backend map.
function
generate_backend_map
(
$blogs
)
{
global
$wpdb
;
global
$r2db_hash_map
;
global
$noblogs_master
;
$wpdb_hash
=
&
$wpdb
->
hash_map
;
printline
(
'map $http_host $backend_noblogs {'
);
printline
(
' default http://'
.
$noblogs_master
.
':'
.
NOBLOGS_PORT
.
';'
);
...
...
@@ -47,7 +47,7 @@ function generate_backend_map($blogs) {
$blog_id
=
$blog
->
blog_id
;
if
(
$blog_id
==
1
)
continue
;
$backend_id
=
$
wp
db_hash
->
lookup
(
$blog_id
);
$backend_id
=
$
r2
db_hash
_map
->
lookup
(
$blog_id
);
$backend_http
=
backend_to_http_endpoint
(
$backend_id
);
printline
(
' '
.
$blog
->
domain
.
' http://'
.
$backend_http
.
';'
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment