chore(hstore): translate CJK comments to English (#2616)

* trans server-core
This commit is contained in:
V_Galaxy 2024-08-10 15:31:25 +08:00 committed by GitHub
parent c231a6fddb
commit 7df736a77c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 87 additions and 87 deletions

View File

@ -38,7 +38,7 @@ public class EdgesQueryIterator implements Iterator<Query> {
this.sources = sources;
this.labels = labels;
this.directions = directions;
// Traverse NO_LIMIT Query.NO_LIMIT 不同
// Traverse NO_LIMIT and Query.NO_LIMIT are different
this.limit = limit < 0 ? Query.NO_LIMIT : limit;
}

View File

@ -617,10 +617,10 @@ public class Query implements Cloneable {
}
public enum OrderType {
// 批量接口下返回顺序的要求
ORDER_NONE, // 允许无序
ORDER_WITHIN_VERTEX, // 一个点内的边不会被打断单不同点之间为无序
ORDER_STRICT // 保证原始的输入点顺序
// Under batch interface, the requirement for return order
ORDER_NONE, // Allow unordered
ORDER_WITHIN_VERTEX, // Edges within a vertex will not be broken, but there is no order between different vertices.
ORDER_STRICT // Ensure the original input point order
}
public enum Order {

View File

@ -174,7 +174,7 @@ public class BinaryBackendEntry implements BackendEntry {
return false;
}
if (!this.id().equals(other.id())) {
// 兼容从ap查回的数据, vertex id
// Compatible with data retrieved from ap, vertex id
if (!this.id().origin().equals(other.originId())) {
return false;
}

View File

@ -795,7 +795,7 @@ public final class BytesBuffer extends OutputStream {
}
/**
* 解析 olap id
* Analyze olap id
* @param type
* @param isOlap
* @return
@ -811,7 +811,7 @@ public final class BytesBuffer extends OutputStream {
* {PropertyKey}{VertexId}
*/
if (isOlap) {
// read olap property id
// First read olap property id
Id pkId = this.readId();
}
Id id = this.readId();

View File

@ -71,7 +71,7 @@ public class BackendMutation {
}
/**
* The optimized scenes include but are not limited to
* The optimized scenes include but are not limited to:
* 1.If you want to delete an entry, the other mutations previously
* can be ignored.
* 2.As similar to the No.1 item, If you want to insert an entry,

View File

@ -94,7 +94,7 @@ public class SchemaTransactionV2 implements ISchemaTransaction {
}
/**
* 异步任务系列
* Asynchronous Task Series
*/
private static Id asyncRun(HugeGraph graph, SchemaElement schema,
SchemaJob job) {
@ -354,7 +354,7 @@ public class SchemaTransactionV2 implements ISchemaTransaction {
return asyncRun(this.graph(), schema, job);
}
// 通用性 的schema处理函数
// Generality of schema processing functions
@Watched(prefix = "schema")
public void updateSchemaStatus(SchemaElement schema, SchemaStatus status) {
if (!this.existsSchemaId(schema.type(), schema.id())) {
@ -429,7 +429,7 @@ public class SchemaTransactionV2 implements ISchemaTransaction {
// NOTE: Do schema update in the lock block
updateCallback.accept(schema);
}
// 调对应的方法
// Call the corresponding method
switch (schema.type()) {
case PROPERTY_KEY:
this.schemaMetaManager.addPropertyKey(this.graphSpace,
@ -440,14 +440,14 @@ public class SchemaTransactionV2 implements ISchemaTransaction {
this.schemaMetaManager.addVertexLabel(this.graphSpace,
this.graph,
(VertexLabel) schema);
// 点的label发生变化, 清空对应图的点缓存信息
// Point's label changes, clear the corresponding graph's point cache information
MetaManager.instance().notifyGraphVertexCacheClear(this.graphSpace, this.graph);
break;
case EDGE_LABEL:
this.schemaMetaManager.addEdgeLabel(this.graphSpace,
this.graph,
(EdgeLabel) schema);
// 边的label发生变化, 清空对应图的边缓存信息
// Side label changes, clear the corresponding edge cache information of the graph.
MetaManager.instance().notifyGraphEdgeCacheClear(this.graphSpace, this.graph);
break;
case INDEX_LABEL:
@ -575,7 +575,7 @@ public class SchemaTransactionV2 implements ISchemaTransaction {
}
}
// olap 相关的方法
// OLAP related methods
public void createIndexLabelForOlapPk(PropertyKey propertyKey) {
WriteType writeType = propertyKey.writeType();
if (writeType == WriteType.OLTP ||
@ -627,8 +627,8 @@ public class SchemaTransactionV2 implements ISchemaTransaction {
return asyncRun(this.graph(), propertyKey, job);
}
// -- store 相关的方法分为两类1olaptable相关 2id生成策略
// - 1olaptable相关
// -- store related methods, divided into two categories: 1. olap table related 2. ID generation strategy
// - 1. olap table related
public void createOlapPk(Id id) {
this.graphParams().loadGraphStore().createOlapTable(id);
}
@ -645,7 +645,7 @@ public class SchemaTransactionV2 implements ISchemaTransaction {
}
}
// - 2id生成策略
// - 2. ID generation strategy
@Watched(prefix = "schema")
public Id getNextId(HugeType type) {
LOG.debug("SchemaTransaction get next id for {}", type);
@ -698,7 +698,7 @@ public class SchemaTransactionV2 implements ISchemaTransaction {
this.setNextIdLowest(type, id.asLong());
}
// 功能型函数
// Functional functions
public void checkSchemaName(String name) {
String illegalReg = this.graphParams().configuration()
.get(CoreOptions.SCHEMA_ILLEGAL_NAME_REGEX);
@ -729,12 +729,12 @@ public class SchemaTransactionV2 implements ISchemaTransaction {
return this.graphParams().mode();
}
// 获取字段的方法
// Get field method
public HugeGraph graph() {
return this.graphParams.graph();
}
// 重建索引
// Rebuild index
@Watched(prefix = "schema")
public Id rebuildIndex(SchemaElement schema) {
return this.rebuildIndex(schema, ImmutableSet.of());
@ -749,7 +749,7 @@ public class SchemaTransactionV2 implements ISchemaTransaction {
}
/**
* 清除所有的schema信息
* Clear all schema information
*/
public void clear() {
this.schemaMetaManager.clearAllSchema(this.graphSpace, graph);

View File

@ -521,8 +521,8 @@ public class CoreOptions extends OptionHolder {
/**
* The schema name rule:
* 1Not allowed end with spaces
* 2Not allowed start with '~'
* 1. Not allowed end with spaces
* 2. Not allowed start with '~'
*/
public static final ConfigOption<String> SCHEMA_ILLEGAL_NAME_REGEX =
new ConfigOption<>(

View File

@ -198,7 +198,7 @@ public class HugeGraphSONModule extends TinkerPopJacksonModule {
public static void registerGraphSerializers(SimpleModule module) {
/*
* Use customized serializer need to be compatible with V1 and V2
* Graphson, and seems need to implement edge deserializerit is
* Graphson, and seems need to implement edge deserializer, it is
* a little complicated.
*/
module.addSerializer(HugeVertex.class, new HugeVertexSerializer());

View File

@ -250,7 +250,7 @@ public class MetaManager {
}
/**
* 监听vertex label变化, graph vertex cache clear
* Listen for vertex label changes, graph vertex cache clear
*
* @param consumer
* @param <T>
@ -260,7 +260,7 @@ public class MetaManager {
}
/**
* 监听edge label变化, graph edge cache clear
* Listen to edge label changes, graph edge cache clear
*
* @param consumer
* @param <T>
@ -491,7 +491,7 @@ public class MetaManager {
}
/**
* 通知 需要进行 graph vertex cache clear
* Notice Requires graph vertex cache clear
*
* @param graphSpace
* @param graph
@ -501,7 +501,7 @@ public class MetaManager {
}
/**
* 通知 需要进行 graph edge cache clear
* Notice Requires graph edge cache clear
*
* @param graphSpace
* @param graph

View File

@ -108,7 +108,7 @@ public class EtcdDistributedLock {
this.revokeLease(leaseId);
return lockResult;
} catch (TimeoutException e) {
// 获取锁超时
// Acquire lock timeout
LOG.warn("Thread {} timeout to lock {}",
Thread.currentThread().getName(), lockName);
service.shutdown();

View File

@ -101,7 +101,7 @@ public class GraphMetaManager extends AbstractMetaManager {
}
/**
* 通知 点信息 cache clear
* Notice point information cache clear
*
* @param graphSpace
* @param graph
@ -112,7 +112,7 @@ public class GraphMetaManager extends AbstractMetaManager {
}
/**
* 通知 边信息 cache clear
* Notice Edge Information cache clear
*
* @param graphSpace
* @param graph
@ -249,7 +249,7 @@ public class GraphMetaManager extends AbstractMetaManager {
}
/**
* pd监听 vertex label更新的key
* pd listen to vertex label updated key
*
* @return
*/
@ -266,7 +266,7 @@ public class GraphMetaManager extends AbstractMetaManager {
}
/**
* pd监听 edge label更新的key
* pd listen edge label updated key
*
* @return
*/

View File

@ -47,7 +47,7 @@ public class TaskMetaManager extends AbstractMetaManager {
String taskId) {
String key = taskLockKey(graphSpace, graphName, taskId);
// 判断当前任务是否锁定
// Check if the current task is locked
return metaDriver.isLocked(key);
}

View File

@ -94,7 +94,7 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
// LockUtil.lock(this.graph().spaceGraphName(), LockUtil.GRAPH_LOCK);
LockUtil.lock("", LockUtil.GRAPH_LOCK);
try {
// TODO: 使用超级管理员权限查询任务
// TODO: Use super administrator privileges to query tasks.
// TaskManager.useAdmin();
this.cronSchedule();
} catch (Throwable t) {
@ -121,13 +121,13 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
}
public void cronSchedule() {
// 执行周期调度任务
// Perform periodic scheduling tasks
if (!this.graph.started() || this.graph.closed()) {
return;
}
// 处理 NEW 状态的任务
// Handle tasks in NEW status
Iterator<HugeTask<Object>> news = queryTaskWithoutResultByStatus(
TaskStatus.NEW);
@ -136,12 +136,12 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
LOG.info("Try to start task({})@({}/{})", newTask.id(),
this.graphSpace, this.graphName);
if (!tryStartHugeTask(newTask)) {
// 任务提交失败时线程池已打满
// Task submission failed when the thread pool is full.
break;
}
}
// 处理 RUNNING 状态的任务
// Handling tasks in RUNNING state
Iterator<HugeTask<Object>> runnings =
queryTaskWithoutResultByStatus(TaskStatus.RUNNING);
@ -163,7 +163,7 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
}
}
// 处理 FAILED/HANGING 状态的任务
// Handle tasks in FAILED/HANGING state
Iterator<HugeTask<Object>> faileds =
queryTaskWithoutResultByStatus(TaskStatus.FAILED);
@ -178,7 +178,7 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
}
}
// 处理 CANCELLING 状态的任务
// Handling tasks in CANCELLING state
Iterator<HugeTask<Object>> cancellings = queryTaskWithoutResultByStatus(
TaskStatus.CANCELLING);
@ -193,7 +193,7 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
runningTasks.remove(cancellingId);
} else {
// 本地没有执行任务但是当前任务已经无节点在执行
// Local no execution task, but the current task has no nodes executing.
if (!isLockedTask(cancellingId.toString())) {
updateStatusWithLock(cancellingId, TaskStatus.CANCELLING,
TaskStatus.CANCELLED);
@ -201,7 +201,7 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
}
}
// 处理 DELETING 状态的任务
// Handling tasks in DELETING status
Iterator<HugeTask<Object>> deletings = queryTaskWithoutResultByStatus(
TaskStatus.DELETING);
@ -212,12 +212,12 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
initTaskParams(deleting);
deleting.cancel(true);
// 删除存储信息
// Delete storage information
deleteFromDB(deletingId);
runningTasks.remove(deletingId);
} else {
// 本地没有执行任务但是当前任务已经无节点在执行
// Local has no task execution, but the current task has no nodes executing anymore.
if (!isLockedTask(deletingId.toString())) {
deleteFromDB(deletingId);
}
@ -254,14 +254,14 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
initTaskParams(task);
if (task.ephemeralTask()) {
// 处理 ephemeral 任务不需要调度直接执行
// Handle ephemeral tasks, no scheduling needed, execute directly
return this.ephemeralTaskExecutor.submit(task);
}
// 处理 schema 任务
// 处理 gremlin 任务
// 处理 olap 计算任务
// 添加任务到 DB当前任务状态为 NEW
// Process schema task
// Handle gremlin task
// Handle OLAP calculation tasks
// Add task to DB, current task status is NEW
// TODO: save server id for task
this.save(task);
@ -277,8 +277,8 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
}
protected <V> void initTaskParams(HugeTask<V> task) {
// 绑定当前任务执行所需的环境变量
// 在任务反序列化和执行之前均需要调用该方法
// Bind the environment variables required for the current task execution
// Before task deserialization and execution, this method needs to be called.
task.scheduler(this);
TaskCallable<V> callable = task.callable();
callable.task(task);
@ -291,9 +291,9 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
@Override
public <V> void cancel(HugeTask<V> task) {
// 更新状态为 CANCELLING
// Update status to CANCELLING
if (!task.completed()) {
// 任务未完成才可执行状态未 CANCELLING
// Task not completed, can only execute status not CANCELLING
this.updateStatus(task.id(), null, TaskStatus.CANCELLING);
} else {
LOG.info("cancel task({}) error, task has completed", task.id());
@ -306,7 +306,7 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
}
protected <V> HugeTask<V> deleteFromDB(Id id) {
// DB 中删除 Task不检查任务状态
// Delete Task from DB, without checking task status
return this.call(() -> {
Iterator<Vertex> vertices = this.tx().queryTaskInfos(id);
HugeVertex vertex = (HugeVertex) QueryResults.one(vertices);
@ -322,7 +322,7 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
@Override
public <V> HugeTask<V> delete(Id id, boolean force) {
if (!force) {
// 更改状态为 DELETING通过自动调度实现删除操作
// Change status to DELETING, perform the deletion operation through automatic scheduling.
this.updateStatus(id, null, TaskStatus.DELETING);
return null;
} else {
@ -404,7 +404,7 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
if (task.completed()) {
// Wait for task result being set after status is completed
sleep(intervalMs);
// 查询带有结果的任务信息
// Query task information with results
task = this.task(id);
return task;
}
@ -473,7 +473,7 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
initTaskParams(task);
if (prestatus == null || task.status() == prestatus) {
task.overwriteStatus(status);
// 如果状态更新为 FAILED -> NEW则增加重试次数
// If the status is updated to FAILED -> NEW, then increase the retry count.
if (prestatus == TaskStatus.FAILED && status == TaskStatus.NEW) {
task.retry();
}
@ -626,7 +626,7 @@ public class DistributedTaskScheduler extends TaskAndResultScheduler {
runningTasks.put(task.id(), task);
// 任务执行不会抛出异常HugeTask 在执行过程中会捕获异常并存储到 DB
// Task execution will not throw exceptions, HugeTask will catch exceptions during execution and store them in the DB.
task.run();
} catch (Throwable t) {
LOG.warn("exception when execute task", t);

View File

@ -760,7 +760,7 @@ public class HugeTask<V> extends FutureTask<V> {
}
assert task != null;
/*
* This can be enabled for debug to expose schema-clear errors early
* This can be enabled for debug to expose schema-clear errors early,
* but also lead to some negative tests failed,
*/
boolean debugTest = false;

View File

@ -89,7 +89,7 @@ public abstract class TaskAndResultScheduler implements TaskScheduler {
return this.tx().addVertex(vertex);
});
// 保存 result 结果
// Save result outcome
if (rawResult != null) {
HugeTaskResult result =
new HugeTaskResult(HugeTaskResult.genId(task.id()));

View File

@ -111,7 +111,7 @@ public final class TaskManager {
E.checkArgumentNotNull(graph, "The graph can't be null");
LOG.info("Use {} as the scheduler of graph ({})",
graph.schedulerType(), graph.name());
// TODO: 如当前服务绑定到指定的非 DEFAULT 图空间非当前图空间的图不再创建任务调度器 (graph space)
// TODO: If the current service is bound to a specified non-DEFAULT graph space, the graph outside of the current graph space will no longer create task schedulers (graph space)
switch (graph.schedulerType()) {
case "distributed": {
TaskScheduler scheduler =

View File

@ -80,7 +80,7 @@ public class HugeVertexStepByBatch<E extends Element>
@Override
public Iterator<?> lastTimeResults() {
/*
* NOTE: fetch page from this iterator can only get page info of
* NOTE: fetch page from this iterator, can only get page info of
* the lowest level, may lost info of upper levels.
*/
return this.iterator;

View File

@ -27,13 +27,13 @@ public enum HugeTableType implements SerialEnum {
UNKNOWN(0, "UNKNOWN"),
/* Schema types */
VERTEX(1, "V"), // 顶点表
OUT_EDGE(2, "OE"), // 出边表
IN_EDGE(3, "IE"), // 入边表
ALL_INDEX_TABLE(4, "INDEX"), // 索引表
TASK_INFO_TABLE(5, "TASK"), // 任务信息表
OLAP_TABLE(6, "OLAP"), // OLAP
SERVER_INFO_TABLE(7, "SERVER"); // SERVER 信息表
VERTEX(1, "V"), // Vertex table
OUT_EDGE(2, "OE"), // Out-edge table
IN_EDGE(3, "IE"), // In-edge table
ALL_INDEX_TABLE(4, "INDEX"), // Index Table
TASK_INFO_TABLE(5, "TASK"), // Task Information Table
OLAP_TABLE(6, "OLAP"), // OLAP table
SERVER_INFO_TABLE(7, "SERVER"); // Server Information Table
private static final Map<String, HugeTableType> ALL_NAME = new HashMap<>();

View File

@ -396,8 +396,8 @@ public abstract class HstoreStore extends AbstractBackendStore<Session> {
// for (ConditionQuery conditionQuery :
// ConditionQueryFlatten.flatten(cq)) {
// Id label = conditionQuery.condition(HugeKeys.LABEL);
// /* 父类型 + sortKeys g.V("V.id").outE("parentLabel").has
// ("sortKey","value")转成 所有子类型 + sortKeys*/
// /* Parent type + sortKeys: g.V("V.id").outE("parentLabel").has
// ("sortKey","value") converted to all subtypes + sortKeys */
// if ((this.subEls == null ||
// !this.subEls.hasNext()) && label != null &&
// hugeGraph.edgeLabel(label).isFather() &&
@ -563,7 +563,7 @@ public abstract class HstoreStore extends AbstractBackendStore<Session> {
if (this.isGraphStore && !olapPks.isEmpty()) {
List<Iterator<BackendEntry>> iterators = new ArrayList<>();
for (Id pk : olapPks) {
// 构造olap表查询query condition
// Construct OLAP table query query condition
Query q = this.constructOlapQueryCondition(pk, query);
table = this.table(HugeType.OLAP);
iterators.add(table.queryOlap(this.session(HugeType.OLAP), q));
@ -575,10 +575,10 @@ public abstract class HstoreStore extends AbstractBackendStore<Session> {
}
/**
* 重新构造 查询olap表 query
* 由于 olap合并成一张表, 在写入olap数据, key在后面增加了pk
* 所以在此进行查询的时候,需要重新构造pk前缀
* 写入参考 BinarySerializer.writeOlapVertex
* Reconstruct the query OLAP table query
* Due to the olap merged into one table, when writing olap data, the key has a pk added at the end.
* So when making inquiries here, it is necessary to reconstruct the pk prefix.
* Write reference BinarySerializer.writeOlapVertex
*
* @param pk
* @param query

View File

@ -190,7 +190,7 @@ public class HstoreTable extends BackendTable<Session, BackendEntry> {
}
public byte[] getInsertOwner(BackendEntry entry) {
// 为适应 label 索引散列不聚焦在一个分区
// To adapt label index hashing, do not focus on a single partition
if (entry.type().isLabelIndex() && (entry.columns().size() == 1)) {
Iterator<BackendColumn> iterator = entry.columns().iterator();
while (iterator.hasNext()) {
@ -204,7 +204,7 @@ public class HstoreTable extends BackendTable<Session, BackendEntry> {
}
/**
* 返回 Id 所属的点 ID
* Return the owner ID of the Id
*
* @param id
* @return
@ -221,7 +221,7 @@ public class HstoreTable extends BackendTable<Session, BackendEntry> {
}
/**
* 返回 Id 所属的点 ID
* Return the owner ID of the Id
*
* @param id
* @return
@ -425,7 +425,7 @@ public class HstoreTable extends BackendTable<Session, BackendEntry> {
// Query by id
if (query.conditions().isEmpty()) {
assert !query.ids().isEmpty();
// 单个 id 查询 get 接口查询
// Single id query uses the get interface to query
if (query.ids().size() == 1) {
return this.getById(session, query.ids().iterator().next());
}
@ -503,7 +503,7 @@ public class HstoreTable extends BackendTable<Session, BackendEntry> {
byte[] ownerKeyTo = this.ownerByQueryDelegate.apply(query.resultType(),
query.prefix());
byte[] keyFrom = query.start().asBytes();
// 前缀分页查询中start 为最初的位置因为在不同的分区 都是从 start 位置开始查询
// In the prefix pagination query, start is the initial position. Because in different partitions, the query starts from the start position.
if (query.paging()) {
keyFrom = query.prefix().asBytes();
}

View File

@ -49,7 +49,7 @@ public class HstoreTables {
}
/**
* task信息存储表
* task information storage table
*/
public static class TaskInfo extends HstoreTable {
@ -131,7 +131,7 @@ public class HstoreTables {
}
/**
* 主要用于 range类型的index处理
* Mainly used for range-type index processing
*
* @param session
* @param query
@ -199,7 +199,7 @@ public class HstoreTables {
public static final String TABLE = HugeTableType.OLAP_TABLE.string();
public OlapTable(String database) {
// 由原先多个ap_{pk_id} 合并成一个ap表
// Originally multiple ap_{pk_id} merged into one ap table
super(database, TABLE);
}

View File

@ -5221,7 +5221,7 @@ public class EdgeCoreTest extends BaseCoreTest {
query.scan(String.valueOf(Long.MIN_VALUE),
String.valueOf(Long.MAX_VALUE));
} else {
// QUESTIONThe query method may not be well adapted
// QUESTION: The query method may not be well adapted
query.scan(BackendTable.ShardSplitter.START,
BackendTable.ShardSplitter.END);
}