ComputeSplitsBySize işlemini çağırarak bir veri tablosunu yaklaşık olarak aynı boyutta mantıksal bölümlere ayırın. Yanıt, bölümler arasındaki ayrım noktalarını ve her bölümün bulunduğu sunucuları içerir. Bu işlem genellikle hesaplama motorları için eşzamanlılık planları gibi çalıştırma planlarını belirlemek amacıyla kullanılır.
Daha fazla bilgi için bkz. ComputeSplitPointsBySize.
Ön koşullar
İstemciyi başlatmış olmanız gerekir. Daha fazla bilgi için bkz. Tablestore istemcisini başlatma.
Bir veri tablosu oluşturmuş ve içine veri yazmış olmanız gerekir. Daha fazla bilgi için bkz. Veri tablosu oluşturma.
API işlemi
/**
* Logically split data in a table into several splits whose sizes are close to the specified size, and return the split points between splits and prompt about hosts in which the splits reside.
* In most cases, this operation is used to determine execution plans such as concurrency plans for compute engines.
* @api
* @param [] $request The request parameters.
* @return [] The response.
* @throws OTSClientException The exception that is thrown when a parameter error occurs or the Tablestore server returns a verification error.
* @throws OTSServerException The exception that is thrown when the Tablestore server returns an error.
*/
public function computeSplitPointsBySize(array $request)
Parametreler
İstek bilgileri
İstek parametreleri
|
|
|
|
|
|
|
|
|
İstek sözdizimi
$result = $client->ComputeSplitsBySize([
'table_name' => '<string>', // Required. The name of the data table.
'split_size' => <integer> // Required. The approximate size of each split.
]);
Yanıt bilgileri
Yanıt parametreleri
Parameter | Description |
consumed | Bu işlemin tükettiği kapasite birimleri (CU). capacity_unit, tüketilen okuma ve yazma CU'larını içerir:
|
primary_key_schema | Tablo oluşturma sırasında tanımlanan şema ile eşleşen veri tablosunun birincil anahtar şeması. |
splits | Bölümler arasındaki ayrım noktaları. Her bölüm aşağıdaki alanları içerir:
|
Yanıt sözdizimi
[
'consumed' => [
'capacity_unit' => [
'read' => <integer>,
'write' => <integer>
]
],
'primary_key_schema' => [
['<string>', <PrimaryKeyType>],
['<string>', <PrimaryKeyType>, <PrimaryKeyOption>]
]
'splits' => [
[
'lower_bound' => [
['<string>', <PrimaryKeyValue>, <PrimaryKeyType>],
['<string>', <PrimaryKeyValue>, <PrimaryKeyType>]
],
'upper_bound' => [
['<string>', <PrimaryKeyValue>, <PrimaryKeyType>],
['<string>', <PrimaryKeyValue>, <PrimaryKeyType>]
],
'location' => '<string>'
],
// ...
]
]
Örnekler
Aşağıdaki örnekte, bir veri tablosu yaklaşık 100 MB'lık (split_size = 1) mantıksal bölümlere ayrılır ve ardından her bir bölümün konumu ile birincil anahtar aralığı yazdırılır.
$result = $client->ComputeSplitsBySize([
'table_name' => 'MyTable',
'split_size' => 1
]);
foreach($result['splits'] as $split) {
print_r($split['location']);
print_r($split['lower_bound']);
print_r($split['upper_bound']);
}