Skip to content

Commit f0df7ec

Browse files
authored
Merge pull request #364 from percona/pxb-3454
PXB-3454 [DOCS] - add an index 8.0
2 parents afe2a51 + aca1574 commit f0df7ec

File tree

3 files changed

+274
-7
lines changed

3 files changed

+274
-7
lines changed

docs/index-contents.md

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Index
2+
3+
- [About Percona XtraBackup](about-xtrabackup.md)
4+
- [Accelerate the backup process](accelerate-backup-process.md)
5+
- [Analyze table statistics](analyze-table-statistics.md)
6+
- [Work with AppArmor](work-with-apparmor.md)
7+
- [Backup example](example-full-incr.md)
8+
- [Backup process overview](backup-overview.md)
9+
- [Backup strategy and backup policy](backup-strategy.md)
10+
- [Work with binary logs](working-with-binary-logs.md)
11+
- [Binary tarball file names available](binary-tarball-names.md)
12+
- [Clean up](quickstart-exit.md)
13+
- [Compile and install Percona XtraBackup 8.0 from source](compile-xtrabackup.md)
14+
- [Configure xtrabackup](configure-xtrabackup.md)
15+
- [Connection and privileges needed](privileges.md)
16+
- [Copyright and licensing information](copyright-and-licensing-information.md)
17+
- [Create a compressed backup](create-compressed-backup.md)
18+
- [Create a full backup](create-full-backup.md)
19+
- [Create a partial backup](create-partial-backup.md)
20+
- [Create an incremental backup](create-incremental-backup.md)
21+
- [Create an individual partitions backup](create-individual-partition-backup.md)
22+
- [Decompress and prepare a backup](prepare-compressed-backup.md)
23+
- [Dictionary cache](dictionary-cache.md)
24+
- [Differences between a logical backup and Percona XtraBackup](differences.md)
25+
- [Encrypt backups](encrypt-backups.md)
26+
- [Encrypted InnoDB tablespace backups](encrypted-innodb-tablespace-backups.md)
27+
- [Error Message: Found tables with row versions due to INSTANT ADD/DROP columns](error-message-instant.md)
28+
- [Exponential backoff](xbcloud-exbackoff.md)
29+
- [FIFO data sink](xbcloud-binary-fifo-datasink.md)
30+
- [Files in the DEB package built for Percona XtraBackup 8.0](apt-files.md)
31+
- [Files in the RPM package built for Percona XtraBackup 8.0](yum-files.md)
32+
- [FLUSH TABLES WITH READ LOCK option](flush-tables-with-read-lock.md)
33+
- [Frequently asked questions](faq.md)
34+
- [Get help from Percona](get-help.md)
35+
- [Glossary](glossary.md)
36+
- [How Percona XtraBackup works](how-xtrabackup-works.md)
37+
- [How to create a new (or repair a broken) GTID-based replica](create-gtid-replica.md)
38+
- [How to set up a replica for replication in 6 simple steps with Percona XtraBackup](set-up-replication.md)
39+
- [Improved log statements](log-enhancements.md)
40+
- [Index of files created by Percona XtraBackup](xtrabackup-files.md)
41+
- [InnoDB redo log archiving](redo-log-archiving.md)
42+
- [Install Percona XtraBackup 8.0 from a binary tarball](binary-tarball.md)
43+
- [Install Percona XtraBackup 8.0 overview](installation.md)
44+
- [Install Percona XtraBackup on Debian-based systems](apt-repo.md)
45+
- [Install Percona XtraBackup on Red Hat-based systems](yum-repo.md)
46+
- [Install with DEB packages](apt-download-deb.md)
47+
- [Install with RPM packages](yum-download-rpm.md)
48+
- [lock-ddl-per-table option improvements](lock-options.md)
49+
- [LRU dump backup](lru-dump-backup.md)
50+
- [Make backups in replication environments](make-backup-in-replication-env.md)
51+
- [Next steps](quickstart-next-steps.md)
52+
- [Overview](quickstart-overview.md)
53+
- [Percona Product Download Instructions](download-instructions.md)
54+
- [Percona Toolkit version checking](toolkit-version-check.md)
55+
- [Percona XtraBackup - Documentation](index.md)
56+
- [Percona XtraBackup 8.0 release notes index](release-notes.md)
57+
- [Percona XtraBackup binaries overview](binaries-overview.md)
58+
- [Percona XtraBackup Version Compatibility and Server Version Checks](server-backup-version-comparison.md)
59+
- [Permissions needed](permissions.md)
60+
- [Pin packages in Debian-based systems](apt-pinning.md)
61+
- [Point-in-time recovery](point-in-time-recovery.md)
62+
- [Prepare a full backup](prepare-full-backup.md)
63+
- [Prepare a partial backup](prepare-partial-backup.md)
64+
- [Prepare an incremental backup](prepare-incremental-backup.md)
65+
- [Prepare an individual partitions backup](prepare-individual-partitions-backup.md)
66+
- [Restore a backup](restore-a-backup.md)
67+
- [Restore a partial backup](restore-partial-backup.md)
68+
- [Restore individual tables](restore-individual-tables.md)
69+
- [Restore the backup](quickstart-restore-backup.md)
70+
- [Restore the partition from the backup](restore-individual-partitions.md)
71+
- [Run Percona XtraBackup 8.0 in a Docker container](docker.md)
72+
- [Work with SELinux](work-with-selinux.md)
73+
- [Smart memory estimation](smart-memory-estimation.md)
74+
- [Start a Docker container and take a backup](quickstart-docker.md)
75+
- [Store backup history on the server](store-backup-history.md)
76+
- [Supported versions](supported-versions.md)
77+
- [Take a streaming backup](take-streaming-backup.md)
78+
- [Take an incremental backup using page tracking](page-tracking.md)
79+
- [Throttling backups](throttling-backups.md)
80+
- [Topic index](topic-index.md)
81+
- [Trademark policy](trademark-policy.md)
82+
- [Understand version numbers](xtrabackup-version-numbers.md)
83+
- [Uninstall Percona XtraBackup 8.0 on Debian-based systems](apt-uninstall-xtrabackup.md)
84+
- [Uninstall Percona XtraBackup 8.0 on Red Hat-based systems](yum-uninstall-xtrabackup.md)
85+
- [update-curl-utility](update-curl-utility.md)
86+
- [Use the xbcloud binary with Amazon S3](xbcloud-s3.md)
87+
- [Use the xbcloud binary with an IAM instance profile](xbcloud-iam-profile.md)
88+
- [Use the xbcloud binary with Google Cloud Storage](xbcloud-gcs.md)
89+
- [Use the xbcloud binary with Microsoft Azure Cloud Storage](xbcloud-azure.md)
90+
- [Use the xbcloud binary with MinIO](xbcloud-minio.md)
91+
- [Use the xbcloud binary with Swift](xbcloud-swift.md)
92+
- [Verify backups with replication and pt-checksum](verify-backup.md)
93+
- [The xbcloud binary overview](xbcloud-binary-overview.md)
94+
- [The xbcloud command-line options](xbcloud-options.md)
95+
- [The xbcrypt binary overview](xbcrypt-binary-overview.md)
96+
- [The xbcrypt command-line options](xbcrypt-options.md)
97+
- [The xbstream binary overview](xbstream-binary-overview.md)
98+
- [The xbstream command-line options](xbstream-options.md)
99+
- [The xtrabackup binary overview](xtrabackup-binary-overview.md)
100+
- [The xtrabackup command-line options](xtrabackup-option-reference.md)
101+
- [xtrabackup exit codes](xtrabackup-exit-codes.md)
102+
- [xtrabackup implementation details](xtrabackup-implementation-details.md)

generate_index.py

+155
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
#!/usr/bin/env python3
2+
3+
"""
4+
generate_index.py - Generate an index of Markdown files in a directory.
5+
6+
Instructions on how to run the script:
7+
8+
python3 generate_index.py
9+
10+
Run this command in the root directory of your project.
11+
12+
This script traverses the 'docs/' directory up to a maximum depth and generates an 'index-contents.md' file listing the Markdown files found. It sorts the files based on the display name, ignoring specified prefixes ('The ', 'Work with ') when sorting. Specified directories are excluded from the index, except that 'release-notes.md' from the 'release-notes' directory is included. The '404.md' file is ignored.
13+
14+
"""
15+
16+
import os
17+
18+
def strip_prefixes(s):
19+
prefixes = ('The ', 'Work with ')
20+
s_lower = s.lower()
21+
for prefix in prefixes:
22+
if s_lower.startswith(prefix.lower()):
23+
return s[len(prefix):]
24+
return s
25+
26+
# Define the directory containing your Markdown files
27+
docs_dir = os.path.join(os.getcwd(), 'docs')
28+
29+
# Path to the index-contents.md file
30+
index_file_path = os.path.join(docs_dir, 'index-contents.md')
31+
32+
# Delete 'index-contents.md' if it exists
33+
if os.path.exists(index_file_path):
34+
os.remove(index_file_path)
35+
print(f"Deleted existing index file: {index_file_path}")
36+
37+
# Prepare the content for index-contents.md
38+
index_content = '# Index\n\n'
39+
40+
# Set the maximum depth (starting from 0)
41+
max_depth = 5
42+
43+
# Directories to exclude from traversal
44+
exclude_dirs = {'_static', 'assets', 'css', 'fonts', 'js', 'release-notes', 'release-notes/8.0'}
45+
46+
# Files to exclude
47+
exclude_files = {'404.md', 'index-contents.md'}
48+
49+
# Calculate the length of the base path to measure depth
50+
base_path_length = len(docs_dir.rstrip(os.sep).split(os.sep))
51+
52+
# Initialize a variable to track the previous directory path
53+
previous_dir = ''
54+
55+
# Walk through the docs directory
56+
for root, dirs, files in os.walk(docs_dir):
57+
# Exclude specified directories from traversal, but keep 'release-notes' to include 'release-notes.md'
58+
dirs[:] = [d for d in dirs if d not in exclude_dirs]
59+
60+
# Calculate the current depth
61+
current_depth = len(root.rstrip(os.sep).split(os.sep)) - base_path_length
62+
63+
# Limit the traversal to the maximum depth
64+
if current_depth >= max_depth:
65+
dirs.clear()
66+
continue
67+
68+
# Sort the directories alphabetically
69+
dirs.sort()
70+
71+
# Exclude non-Markdown files and specified files
72+
files = [f for f in files if f.endswith('.md') and f not in exclude_files]
73+
74+
# Get the relative directory path from docs_dir
75+
relative_dir = os.path.relpath(root, docs_dir)
76+
relative_dir = relative_dir.replace(os.sep, '/')
77+
78+
# Only add directory headings when the directory changes
79+
if relative_dir != previous_dir:
80+
# Add directories as headers except for the root 'docs' directory
81+
if relative_dir != '.':
82+
indent_level = relative_dir.count('/')
83+
indent = ' ' * indent_level
84+
85+
# Modify directory display name
86+
dir_display_name_parts = relative_dir.split('/')
87+
dir_display_name_parts = [
88+
'Release notes' if part.lower() == 'release-notes' else part
89+
for part in dir_display_name_parts
90+
]
91+
dir_display_name = '/'.join(dir_display_name_parts)
92+
93+
# Remove bold formatting from directory names
94+
index_content += f'{indent}- {dir_display_name}/\n'
95+
previous_dir = relative_dir
96+
97+
# Initialize a list to hold file entries with display names
98+
file_entries = []
99+
100+
# Process files to extract display names
101+
for file in files:
102+
# Exclude '404.md' in any location
103+
if file == '404.md':
104+
continue
105+
106+
filepath = os.path.join(root, file)
107+
relative_path = os.path.relpath(filepath, docs_dir)
108+
# Convert backslashes to slashes for cross-platform compatibility
109+
relative_path = relative_path.replace(os.sep, '/')
110+
111+
directories_in_path = os.path.dirname(relative_path).split('/')
112+
113+
if 'release-notes' in directories_in_path:
114+
# Include only 'release-notes.md' from 'release-notes' directory
115+
if file != 'release-notes.md':
116+
continue
117+
else:
118+
# Skip files in excluded directories
119+
if any(ex_dir in directories_in_path for ex_dir in exclude_dirs):
120+
continue
121+
122+
# Extract the display name from the first level 1 heading or filename
123+
display_name = ''
124+
try:
125+
with open(filepath, 'r', encoding='utf-8') as md_file:
126+
for line in md_file:
127+
if line.strip().startswith('# '):
128+
display_name = line.strip()[2:].strip()
129+
break
130+
except Exception as e:
131+
print(f"Error reading file {filepath}: {e}")
132+
continue
133+
134+
if not display_name:
135+
display_name = os.path.splitext(os.path.basename(file))[0]
136+
137+
# For sorting, remove leading prefixes
138+
sort_key = strip_prefixes(display_name).strip().lower()
139+
# Append to the file_entries list
140+
file_entries.append((sort_key, display_name, relative_path))
141+
142+
# Sort the file entries based on the adjusted display name (sort_key)
143+
file_entries.sort()
144+
145+
# Indentation for files within directories
146+
for _, display_name, relative_path in file_entries:
147+
indent_level = relative_path.count('/') - 1
148+
indent = ' ' * indent_level
149+
index_content += f'{indent} - [{display_name}]({relative_path})\n'
150+
151+
# Write the index-contents.md file in the 'docs' directory
152+
with open(index_file_path, 'w', encoding='utf-8') as index_file:
153+
index_file.write(index_content)
154+
155+
print(f"Index generated at {index_file_path}")

mkdocs-base.yml

+17-7
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,17 @@ nav:
195195
- how-xtrabackup-works.md
196196
- server-backup-version-comparison.md
197197
- differences.md
198-
- xtrabackup-version-numbers.md
198+
199199
- backup-strategy.md
200200
- example-full-incr.md
201201
- Features:
202202
- Backup features:
203203
- lru-dump-backup.md
204204
- throttling-backups.md
205205
- store-backup-history.md
206+
- take-streaming-backup.md
207+
- accelerate-backup-process.md
208+
206209
- Prepare features:
207210
- dictionary-cache.md
208211
- Restore features:
@@ -215,23 +218,26 @@ nav:
215218
- redo-log-archiving.md
216219
- smart-memory-estimation.md
217220
- working-with-binary-logs.md
221+
- analyze-table-statistics.md
222+
- xbcloud features:
223+
- xbcloud-binary-fifo-datasink.md
224+
- xbcloud-exbackoff.md
225+
218226
- Binaries:
219227
- Overview: binaries-overview.md
220228
- The xtrabackup binary:
221229
- xtrabackup-binary-overview.md
222230
- xtrabackup-implementation-details.md
223231
- xtrabackup-option-reference.md
224232
- configure-xtrabackup.md
225-
- analyze-table-statistics.md
233+
226234
- The xbcrypt binary:
227235
- xbcrypt-binary-overview.md
228236
- xbcrypt-options.md
229237
- The xbstream binary:
230238
- xbstream-binary-overview.md
231239
- xbstream-options.md
232-
- take-streaming-backup.md
233-
- accelerate-backup-process.md
234-
- encrypt-backups.md
240+
235241
- The xbcloud binary:
236242
- xbcloud-binary-overview.md
237243
- xbcloud-options.md
@@ -244,8 +250,7 @@ nav:
244250
- xbcloud-minio.md
245251

246252
- update-curl-utility.md
247-
- xbcloud-binary-fifo-datasink.md
248-
- xbcloud-exbackoff.md
253+
249254
- Install:
250255
- installation.md
251256
- Before you start:
@@ -286,6 +291,9 @@ nav:
286291
- Take a compressed backup:
287292
- create-compressed-backup.md
288293
- prepare-compressed-backup.md
294+
- Take an encrypted backup:
295+
- encrypt-backups.md
296+
289297
- Take a partial backup:
290298
- create-partial-backup.md
291299
- prepare-partial-backup.md
@@ -307,10 +315,12 @@ nav:
307315
- Reference:
308316
- topic-index.md
309317
- xtrabackup-files.md
318+
- xtrabackup-version-numbers.md
310319
- faq.md
311320
- glossary.md
312321
- supported-versions.md
313322
- toolkit-version-check.md
314323
- trademark-policy.md
315324
- copyright-and-licensing-information.md
325+
- Topic Index: index-contents.md
316326

0 commit comments

Comments
 (0)