aliyun / aliyun-tablestore-nodejs-sdk

Aliyun TableStore(原OTS) SDK for Node.js
Apache License 2.0
88 stars 33 forks source link

attributeColumns 名字使用中文报错 buffer is full #27

Open haohao667788 opened 5 years ago

haohao667788 commented 5 years ago

错误堆栈: { Error: The buffer is full at constructor.writeRawByte (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/protocol/plain_buffer_stream.js:149:19) at constructor.writeTag (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/protocol/plain_buffer_coded_stream.js:287:27) at constructor.writeColumn (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/protocol/plain_buffer_coded_stream.js:445:14) at constructor.writeColumns (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/protocol/plain_buffer_coded_stream.js:519:40) at Object.serializeForPutRow (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/protocol/plian_buffer_builder.js:209:41) at Object.encodeBatchWriteRow [as batchWriteRow] (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/protocol/encoder.js:324:72) at Object.encode (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/protocol/encoder.js:13:32) at Request.buildContent (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/client.js:35:38) at Request.callListeners (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/sequential_executor.js:113:20) at Request.callListeners (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/sequential_executor.js:114:16) at Request.callListeners (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/sequential_executor.js:114:16) at Request.emit (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/sequential_executor.js:81:10) at Request.emit (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/request.js:189:14) at Request.transition (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/request.js:57:10) at AcceptorStateMachine.runTo (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/request.js:24:12) at Request.runTo (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/request.js:175:15) at Request.send (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/request.js:165:10) at /Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/client.js:127:17 at new Promise () at Client.makeRequest (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/client.js:126:14) at Client.batchWriteRow (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/node_modules/_tablestore@4.3.2@tablestore/lib/client.js:240:17) at RuntimeInvocationModel.batchWriteRow (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/src/lib/runtime-model/runtime.model.ts:754:24) at RuntimeInvocationModel.createInvocation (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/src/lib/runtime-model/runtime.model.ts:189:16) at Executor.startInvocation (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/src/lib/runtime-core/executor.ts:55:39) at group.flows.map (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/src/lib/runtime-core/system-connectors/foreach.ts:128:28) at Array.map () at Foreach.startSubInvocation (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/src/lib/runtime-core/system-connectors/foreach.ts:122:31) at Foreach.selectNextInvocationGroup (/Users/ghao/Work/aliyun/console/logic-composer/logic-composer-runtime-service/src/lib/runtime-core/system-connectors/foreach.ts:111:19) retryable: false }

原因: plain_buffer_builder.js / computeColumnSize 中计算 size 时,对于 columnName 使用 length 计算,导致非英文字母会失效

computeColumnSize: function (columnName, columnValue, timestamp) {
        var size = 1;
        size += 1 + TableStore.plainBufferConsts.LITTLE_ENDIAN_32_SIZE;
        size += columnName.length;
        if (columnValue !== null) {
            size += this.computeColumnValueSize(columnValue);
        }
        if (timestamp !== undefined) {
            size += 1 + TableStore.plainBufferConsts.LITTLE_ENDIAN_64_SIZE;
        }
        size += 2;
        return size;
    }

期望的结果: 修复对非英文的支持

wangtantan-zz commented 5 years ago

5.0.2已修复,目前已可以支持中文的columnName