Skip to content

Commit e0d6411

Browse files
authored
Add IT for BanyanDB schema install and update. (#12879)
1 parent a3b563f commit e0d6411

File tree

2 files changed

+339
-6
lines changed
  • oap-server/server-storage-plugin/storage-banyandb-plugin/src

2 files changed

+339
-6
lines changed

oap-server/server-storage-plugin/storage-banyandb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/banyandb/BanyanDBIndexInstaller.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
@Slf4j
5353
public class BanyanDBIndexInstaller extends ModelInstaller {
5454
// BanyanDB group setting aligned with the OAP settings
55-
private static final Set<String/*group name*/> GROUP_ALIGNED = new HashSet<>();
56-
private static final Map<String/*group name*/, Map<String/*rule name*/, IndexRule>> GROUP_INDEX_RULES = new HashMap<>();
55+
private final Set<String/*group name*/> groupAligned = new HashSet<>();
56+
private final Map<String/*group name*/, Map<String/*rule name*/, IndexRule>> groupIndexRules = new HashMap<>();
5757
private final BanyanDBStorageConfig config;
5858

5959
public BanyanDBIndexInstaller(Client client, ModuleManager moduleManager, BanyanDBStorageConfig config) {
@@ -239,7 +239,7 @@ private boolean checkResourceExistence(MetadataRegistry.SchemaMetadata metadata,
239239
throw new IllegalStateException("unknown metadata kind: " + metadata.getKind());
240240
}
241241
if (!RunningMode.isNoInitMode()) {
242-
if (!GROUP_ALIGNED.contains(metadata.getGroup())) {
242+
if (!groupAligned.contains(metadata.getGroup())) {
243243
// create the group if not exist
244244
if (!resourceExist.hasGroup()) {
245245
try {
@@ -262,7 +262,7 @@ private boolean checkResourceExistence(MetadataRegistry.SchemaMetadata metadata,
262262
}
263263
}
264264
// mark the group as aligned
265-
GROUP_ALIGNED.add(metadata.getGroup());
265+
groupAligned.add(metadata.getGroup());
266266
}
267267
}
268268
return resourceExist.hasResource();
@@ -317,7 +317,7 @@ private void checkIndexRuleConflicts(String modelName, IndexRule indexRule, Inde
317317
* Otherwise, return false and mark the index rule as processed.
318318
*/
319319
private boolean checkIndexRuleProcessed(String modelName, IndexRule indexRule) {
320-
Map<String, IndexRule> rules = GROUP_INDEX_RULES.computeIfAbsent(
320+
Map<String, IndexRule> rules = groupIndexRules.computeIfAbsent(
321321
indexRule.getMetadata().getGroup(), k -> new HashMap<>());
322322
IndexRule existRule = rules.get(indexRule.getMetadata().getName());
323323
if (existRule != null) {
@@ -457,7 +457,6 @@ private void checkIndexRules(String modelName, List<IndexRule> indexRules, Banya
457457

458458
/**
459459
* Check if the index rule binding exists and update it if necessary.
460-
* If the old index rule is not in the index rule binding, delete it.
461460
*/
462461
private void checkIndexRuleBinding(List<IndexRule> indexRules,
463462
String group,

0 commit comments

Comments
 (0)