Skip to content

Commit 2eb70b1

Browse files
authored
ci: add typo ci check and fix typos (#4375)
### Motivation Introduce typos ci to avoid typos. See https://lists.apache.org/thread/04hqqcnkfc5189zsxj0s5wm37t2x7bky Signed-off-by: ZhangJian He <[email protected]>
1 parent 45e4328 commit 2eb70b1

File tree

84 files changed

+222
-158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+222
-158
lines changed

.github/workflows/bk-ci.yml

+8
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,14 @@ jobs:
483483
if: cancelled()
484484
run: ./dev/ci-tool print_thread_dumps
485485

486+
typo-check:
487+
name: Typo Check
488+
runs-on: ubuntu-latest
489+
steps:
490+
- uses: actions/checkout@v4
491+
- name: Check typos
492+
uses: crate-ci/typos@master
493+
486494
owasp-dependency-check:
487495
name: OWASP Dependency Check
488496
runs-on: ubuntu-latest

.typos.toml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
[default.extend-words]
21+
# abbr
22+
"ba" = "ba"
23+
"bve" = "bve"
24+
"cace" = "cace"
25+
"cann" = "cann"
26+
"dbe" = "dbe"
27+
"entrys" = "entrys"
28+
"fo" = "fo"
29+
"ine" = "ine"
30+
"isse" = "isse"
31+
"mor" = "mor"
32+
"nwe" = "nwe"
33+
"nd" = "nd"
34+
"nin" = "nin"
35+
"oce" = "oce"
36+
"ot" = "ot"
37+
"ser" = "ser"
38+
"shouldnot" = "shouldnot"
39+
"tio" = "tio"
40+
"ue" = "ue"
41+
# keep for comptability
42+
"deleteable" = "deleteable"
43+
"infinit" = "infinit"
44+
"explict" = "explict"
45+
"uninitalize" = "uninitalize"
46+
# keyword fp
47+
"guage" = "guage"
48+
"passin" = "passin"
49+
"testng" = "testng"
50+
"vertx" = "vertx"
51+
"verticle" = "verticle"
52+
53+
[files]
54+
extend-exclude = [
55+
"bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/TestLedgerMetadataSerDe.java",
56+
]

bookkeeper-common/src/main/java/org/apache/bookkeeper/common/util/Retries.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static <ReturnT> CompletableFuture<ReturnT> run(
7575
* @param task a task to execute.
7676
* @param scheduler scheduler to schedule the task and complete the futures.
7777
* @param key the submit key for the scheduler.
78-
* @param <ReturnT> the return tye.
78+
* @param <ReturnT> the return type.
7979
* @return future represents the result of the task with retries.
8080
*/
8181
public static <ReturnT> CompletableFuture<ReturnT> run(

bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ int runCmd(CommandLine cmdLine) throws Exception {
323323
}
324324

325325
/**
326-
* Intializes new cluster by creating required znodes for the cluster. If
326+
* Initializes new cluster by creating required znodes for the cluster. If
327327
* ledgersrootpath is already existing then it will error out. If for any
328328
* reason it errors out while creating znodes for the cluster, then before
329329
* running initnewcluster again, try nuking existing cluster by running
@@ -704,7 +704,7 @@ int runCmd(CommandLine cmdLine) throws Exception {
704704

705705
ReadLedgerCommand cmd = new ReadLedgerCommand(entryFormatter, ledgerIdFormatter);
706706
ReadLedgerCommand.ReadLedgerFlags flags = new ReadLedgerCommand.ReadLedgerFlags();
707-
flags.bookieAddresss(bookieAddress);
707+
flags.bookieAddress(bookieAddress);
708708
flags.firstEntryId(firstEntry);
709709
flags.forceRecovery(forceRecovery);
710710
flags.lastEntryId(lastEntry);

bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogManagerForEntryLogPerLedger.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class EntryLogsPerLedgerCounter {
152152
* 'expiry duration' and 'maximumSize' will be set to
153153
* entryLogPerLedgerCounterLimitsMultFactor times of
154154
* 'ledgerIdEntryLogMap' cache limits. This is needed because entries
155-
* from 'ledgerIdEntryLogMap' can be removed from cache becasue of
155+
* from 'ledgerIdEntryLogMap' can be removed from cache because of
156156
* accesstime expiry or cache size limits, but to know the actual number
157157
* of entrylogs per ledger, we should maintain this count for long time.
158158
*/

bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLoggerAllocator.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ BufferedLogChannel createNewLogForCompaction(File dirForNextEntryLog) throws IOE
137137
}
138138
}
139139

140-
void setWritingLogId(long lodId) {
141-
this.writingLogId = lodId;
140+
void setWritingLogId(long logId) {
141+
this.writingLogId = logId;
142142
}
143143

144144
void setWritingCompactingLogId(long logId) {

bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/InterleavedLedgerStorage.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ public void onRotateEntryLog() {
569569
// for interleaved ledger storage, we request a checkpoint when rotating a entry log file.
570570
// the checkpoint represent the point that all the entries added before this point are already
571571
// in ledger storage and ready to be synced to disk.
572-
// TODO: we could consider remove checkpointSource and checkpointSouce#newCheckpoint
572+
// TODO: we could consider remove checkpointSource and checkpointSource#newCheckpoint
573573
// later if we provide kind of LSN (Log/Journal Squeuence Number)
574574
// mechanism when adding entry. {@link https://github.com/apache/bookkeeper/issues/279}
575575
Checkpoint checkpoint = checkpointSource.newCheckpoint();

bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerDirsManager.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -200,20 +200,20 @@ public List<File> getWritableLedgerDirsForNewLog() throws NoWritableLedgerDirExc
200200

201201
List<File> getDirsAboveUsableThresholdSize(long thresholdSize, boolean loggingNoWritable)
202202
throws NoWritableLedgerDirException {
203-
List<File> fullLedgerDirsToAccomodate = new ArrayList<File>();
203+
List<File> fullLedgerDirsToAccommodate = new ArrayList<File>();
204204
for (File dir: this.ledgerDirectories) {
205205
// Pick dirs which can accommodate little more than thresholdSize
206206
if (dir.getUsableSpace() > thresholdSize) {
207-
fullLedgerDirsToAccomodate.add(dir);
207+
fullLedgerDirsToAccommodate.add(dir);
208208
}
209209
}
210210

211-
if (!fullLedgerDirsToAccomodate.isEmpty()) {
211+
if (!fullLedgerDirsToAccommodate.isEmpty()) {
212212
if (loggingNoWritable) {
213213
LOG.info("No writable ledger dirs below diskUsageThreshold. "
214-
+ "But Dirs that can accommodate {} are: {}", thresholdSize, fullLedgerDirsToAccomodate);
214+
+ "But Dirs that can accommodate {} are: {}", thresholdSize, fullLedgerDirsToAccommodate);
215215
}
216-
return fullLedgerDirsToAccomodate;
216+
return fullLedgerDirsToAccommodate;
217217
}
218218

219219
// We will reach here when we find no ledgerDir which has atleast

bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/LedgerDirsMonitor.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ private void check(final LedgerDirsManager ldm) {
124124
}
125125
}
126126

127-
List<File> fullfilledDirs = new ArrayList<File>(ldm.getFullFilledLedgerDirs());
127+
List<File> fulfilledDirs = new ArrayList<File>(ldm.getFullFilledLedgerDirs());
128128
boolean makeWritable = ldm.hasWritableLedgerDirs();
129129

130130
// When bookie is in READONLY mode, i.e there are no writableLedgerDirs:
131-
// - Update fullfilledDirs disk usage.
131+
// - Update fulfilledDirs disk usage.
132132
// - If the total disk usage is below DiskLowWaterMarkUsageThreshold
133-
// add fullfilledDirs back to writableLedgerDirs list if their usage is < conf.getDiskUsageThreshold.
133+
// add fulfilledDirs back to writableLedgerDirs list if their usage is < conf.getDiskUsageThreshold.
134134
try {
135135
if (!makeWritable) {
136136
float totalDiskUsage = diskChecker.getTotalDiskUsage(ldm.getAllLedgerDirs());
@@ -144,7 +144,7 @@ private void check(final LedgerDirsManager ldm) {
144144
}
145145
}
146146
// Update all full-filled disk space usage
147-
for (File dir : fullfilledDirs) {
147+
for (File dir : fulfilledDirs) {
148148
try {
149149
diskUsages.put(dir, diskChecker.checkDir(dir));
150150
if (makeWritable) {
@@ -254,7 +254,7 @@ private void checkDirs(final LedgerDirsManager ldm)
254254

255255
private void validateThreshold(float diskSpaceThreshold, float diskSpaceLwmThreshold) {
256256
if (diskSpaceThreshold <= 0 || diskSpaceThreshold >= 1 || diskSpaceLwmThreshold - diskSpaceThreshold > 1e-6) {
257-
throw new IllegalArgumentException("Disk space threashold: "
257+
throw new IllegalArgumentException("Disk space threshold: "
258258
+ diskSpaceThreshold + " and lwm threshold: " + diskSpaceLwmThreshold
259259
+ " are not valid. Should be > 0 and < 1 and diskSpaceThreshold >= diskSpaceLwmThreshold");
260260
}

bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/ReadCache.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
*
4242
* <p>Uses the specified amount of memory and pairs it with a hashmap.
4343
*
44-
* <p>The memory is splitted in multiple segments that are used in a
44+
* <p>The memory is split in multiple segments that are used in a
4545
* ring-buffer fashion. When the read cache is full, the oldest segment
4646
* is cleared and rotated to make space for new entries to be added to
4747
* the read cache.

bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ public MetadataClientDriver getMetadataClientDriver() {
706706
* cheap to compute but does not protect against byzantine bookies (i.e., a
707707
* bookie might report fake bytes and a matching CRC32). The MAC code is more
708708
* expensive to compute, but is protected by a password, i.e., a bookie can't
709-
* report fake bytes with a mathching MAC unless it knows the password.
709+
* report fake bytes with a matching MAC unless it knows the password.
710710
* The CRC32C, which use SSE processor instruction, has better performance than CRC32.
711711
* Legacy DigestType for backward compatibility. If we want to add new DigestType,
712712
* we should add it in here, client.api.DigestType and DigestType in DataFormats.proto.

bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeperAdmin.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,7 @@ public Boolean apply(MetadataBookieDriver driver) {
12971297
}
12981298

12991299
/**
1300-
* Intializes new cluster by creating required znodes for the cluster. If
1300+
* Initializes new cluster by creating required znodes for the cluster. If
13011301
* ledgersrootpath is already existing then it will error out.
13021302
*
13031303
* @param conf
@@ -1569,7 +1569,7 @@ public void triggerAudit()
15691569
* Triggers AuditTask by resetting lostBookieRecoveryDelay and then make
15701570
* sure the ledgers stored in the given decommissioning bookie are properly
15711571
* replicated and they are not underreplicated because of the given bookie.
1572-
* This method waits untill there are no underreplicatedledgers because of this
1572+
* This method waits until there are no underreplicatedledgers because of this
15731573
* bookie. If the given Bookie is not shutdown yet, then it will throw
15741574
* BKIllegalOpException.
15751575
*
@@ -1612,7 +1612,7 @@ public void decommissionBookie(BookieId bookieAddress)
16121612
Set<Long> ledgersStoredInThisBookie = bookieToLedgersMap.get(bookieAddress.toString());
16131613
if ((ledgersStoredInThisBookie != null) && (!ledgersStoredInThisBookie.isEmpty())) {
16141614
/*
1615-
* wait untill all the ledgers are replicated to other
1615+
* wait until all the ledgers are replicated to other
16161616
* bookies by making sure that these ledgers metadata don't
16171617
* contain this bookie as part of their ensemble.
16181618
*/

bookkeeper-server/src/main/java/org/apache/bookkeeper/client/DistributionSchedule.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.apache.bookkeeper.net.BookieId;
2323

2424
/**
25-
* This interface determins how entries are distributed among bookies.
25+
* This interface determines how entries are distributed among bookies.
2626
*
2727
* <p>Every entry gets replicated to some number of replicas. The first replica for
2828
* an entry is given a replicaIndex of 0, and so on. To distribute write load,

bookkeeper-server/src/main/java/org/apache/bookkeeper/client/EnsemblePlacementPolicy.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ default void updateBookieInfo(Map<BookieId, BookieInfo> bookieInfoMap) {
369369
*
370370
* <p>The default implementation will pick a bookie randomly from the ensemble.
371371
* Other placement policies will be able to do better decisions based on
372-
* additional informations (eg: rack or region awareness).
372+
* additional information (eg: rack or region awareness).
373373
*
374374
* @param metadata
375375
* the {@link LedgerMetadata} object

bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerFragmentReplicator.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ void replicate(final LedgerHandle lh, final LedgerFragment lf,
233233
final Set<BookieId> targetBookieAddresses,
234234
final BiConsumer<Long, Long> onReadEntryFailureCallback)
235235
throws InterruptedException {
236-
Set<LedgerFragment> partionedFragments = splitIntoSubFragments(lh, lf,
236+
Set<LedgerFragment> partitionedFragments = splitIntoSubFragments(lh, lf,
237237
bkc.getConf().getRereplicationEntryBatchSize());
238238
LOG.info("Replicating fragment {} in {} sub fragments.",
239-
lf, partionedFragments.size());
240-
replicateNextBatch(lh, partionedFragments.iterator(),
239+
lf, partitionedFragments.size());
240+
replicateNextBatch(lh, partitionedFragments.iterator(),
241241
ledgerFragmentMcb, targetBookieAddresses, onReadEntryFailureCallback);
242242
}
243243

@@ -559,7 +559,7 @@ private void updateAverageEntrySize(int toSendSize) {
559559
/**
560560
* Callback for recovery of a single ledger fragment. Once the fragment has
561561
* had all entries replicated, update the ensemble in zookeeper. Once
562-
* finished propogate callback up to ledgerFragmentsMcb which should be a
562+
* finished propagate callback up to ledgerFragmentsMcb which should be a
563563
* multicallback responsible for all fragments in a single ledger
564564
*/
565565
static class SingleFragmentCallback implements AsyncCallback.VoidCallback {

bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerHandle.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ public void readComplete(int rc, LedgerHandle lh, Enumeration<LedgerEntry> seq,
785785
* Read a sequence of entries asynchronously, allowing to read after the LastAddConfirmed range.
786786
* <br>This is the same of
787787
* {@link #asyncReadEntries(long, long, ReadCallback, Object) }
788-
* but it lets the client read without checking the local value of LastAddConfirmed, so that it is possibile to
788+
* but it lets the client read without checking the local value of LastAddConfirmed, so that it is possible to
789789
* read entries for which the writer has not received the acknowledge yet. <br>
790790
* For entries which are within the range 0..LastAddConfirmed BookKeeper guarantees that the writer has successfully
791791
* received the acknowledge.<br>
@@ -1009,7 +1009,7 @@ private CompletableFuture<LedgerEntries> batchReadEntriesInternalAsync(long star
10091009
* Read a sequence of entries asynchronously, allowing to read after the LastAddConfirmed range.
10101010
* <br>This is the same of
10111011
* {@link #asyncReadEntries(long, long, ReadCallback, Object) }
1012-
* but it lets the client read without checking the local value of LastAddConfirmed, so that it is possibile to
1012+
* but it lets the client read without checking the local value of LastAddConfirmed, so that it is possible to
10131013
* read entries for which the writer has not received the acknowledge yet. <br>
10141014
* For entries which are within the range 0..LastAddConfirmed BookKeeper guarantees that the writer has successfully
10151015
* received the acknowledge.<br>

bookkeeper-server/src/main/java/org/apache/bookkeeper/client/WeightedRandomSelectionImpl.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class WeightedRandomSelectionImpl<T> implements WeightedRandomSelection<T> {
3737
Double randomMax;
3838
int maxProbabilityMultiplier;
3939
Map<T, WeightedObject> map;
40-
TreeMap<Double, T> cummulativeMap = new TreeMap<Double, T>();
40+
TreeMap<Double, T> cumulativeMap = new TreeMap<Double, T>();
4141
ReadWriteLock rwLock = new ReentrantReadWriteLock(true);
4242

4343
WeightedRandomSelectionImpl() {
@@ -120,10 +120,10 @@ public int compare(WeightedObject o1, WeightedObject o2) {
120120
// The probability of picking a bookie randomly is defaultPickProbability
121121
// but we change that priority by looking at the weight that each bookie
122122
// carries.
123-
TreeMap<Double, T> tmpCummulativeMap = new TreeMap<Double, T>();
123+
TreeMap<Double, T> tmpCumulativeMap = new TreeMap<Double, T>();
124124
Double key = 0.0;
125125
for (Map.Entry<T, Double> e : weightMap.entrySet()) {
126-
tmpCummulativeMap.put(key, e.getKey());
126+
tmpCumulativeMap.put(key, e.getKey());
127127
if (LOG.isDebugEnabled()) {
128128
LOG.debug("Key: {} Value: {} AssignedKey: {} AssignedWeight: {}",
129129
e.getKey(), e.getValue(), key, e.getValue());
@@ -134,7 +134,7 @@ public int compare(WeightedObject o1, WeightedObject o2) {
134134
rwLock.writeLock().lock();
135135
try {
136136
this.map = map;
137-
cummulativeMap = tmpCummulativeMap;
137+
cumulativeMap = tmpCumulativeMap;
138138
randomMax = key;
139139
} finally {
140140
rwLock.writeLock().unlock();
@@ -148,8 +148,8 @@ public T getNextRandom() {
148148
// pick a random number between 0 and randMax
149149
Double randomNum = randomMax * Math.random();
150150
// find the nearest key in the map corresponding to the randomNum
151-
Double key = cummulativeMap.floorKey(randomNum);
152-
return cummulativeMap.get(key);
151+
Double key = cumulativeMap.floorKey(randomNum);
152+
return cumulativeMap.get(key);
153153
} finally {
154154
rwLock.readLock().unlock();
155155
}

bookkeeper-server/src/main/java/org/apache/bookkeeper/client/api/OpenBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public interface OpenBuilder extends OpBuilder<ReadHandle> {
5353
OpenBuilder withRecovery(boolean recovery);
5454

5555
/**
56-
* Sets the password to be used to open the ledger. It defauls to an empty password
56+
* Sets the password to be used to open the ledger. It defaults to an empty password
5757
*
5858
* @param password the password to unlock the ledger
5959
*

bookkeeper-server/src/main/java/org/apache/bookkeeper/client/api/ReadHandle.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ default LedgerEntries batchRead(long startEntry, int maxCount, long maxSize)
9595
* Read a sequence of entries asynchronously, allowing to read after the LastAddConfirmed range.
9696
* <br>This is the same of
9797
* {@link #read(long, long) }
98-
* but it lets the client read without checking the local value of LastAddConfirmed, so that it is possibile to
98+
* but it lets the client read without checking the local value of LastAddConfirmed, so that it is possible to
9999
* read entries for which the writer has not received the acknowledge yet. <br>
100100
* For entries which are within the range 0..LastAddConfirmed BookKeeper guarantees that the writer has successfully
101101
* received the acknowledge.<br>

bookkeeper-server/src/main/java/org/apache/bookkeeper/client/api/WriteAdvHandle.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import org.apache.bookkeeper.common.concurrent.FutureUtils;
3030

3131
/**
32-
* Provide write access to a ledger. Using WriteAdvHandler the writer MUST explictly set an entryId. Beware that the
32+
* Provide write access to a ledger. Using WriteAdvHandler the writer MUST explicitly set an entryId. Beware that the
3333
* write for a given entryId will be acknowledged if and only if all entries up to entryId - 1 have been acknowledged
3434
* too (expected from entryId 0)
3535
*

0 commit comments

Comments
 (0)