2016-06-10 12 views
0

ich auf meinem Rechner Aero-Spike-Server v 3.8.3 installiert habe, und ich versuchte, einen Index mit dem folgenden Befehl in aql zu erstellen:Frühlings-data-Aero-Spike Inkompatibilität mit aql erstellten Indizes

aql> CREATE INDEX indexA ON namespace.setA(binA) STRING 

Hier ist das Ergebnis von aql> show indexes Befehl

+----------------+--------+------------+---------+-------+------------+-------+------------+------------+ 
| ns    | bin | indextype | set  | state | indexname | path | sync_state | type  | 
+----------------+--------+------------+---------+-------+------------+-------+------------+------------+ 
| "namespace" | "binA" | "NONE"  | "setA" | "RW" | "indexA" | "BinB | "synced" | "STRING" | 
+----------------+--------+------------+---------+-------+------------+-------+------------+------------+ 

spring-data-aerospike erwarten den Index mit dem folgenden bins

+----------------+-----------------+--------+----------+-------+-----------+------------+--------------+ 
| ns    | bins   | set | num_bins | state | indexname | sync_state | type   | 
+----------------+-----------------+--------+----------+-------+-----------+------------+--------------+ 
| "user_profile" | "last_activity" | "west" | 1  | "WO" | "ix1"  | "synced" | "INT SIGNED" | 
+----------------+-----------------+--------+----------+-------+-----------+------------+-------------- 
konstruiert werden

Die beiden Formate sind in der Dokumentation here und here erwähnt eine Inkompatibilität in der Indexerstellung

Es gibt und sollte ich die spring-data-aerospike oder reparieren die Indizes beheben die erwartete Ausgabe in spring-data-aerospike

com/aerospike/helper/model/Index.java Linie 79

entsprechen
/* 
* Copyright 2012-2015 Aerospike, Inc. 
* 
* Portions may be licensed to Aerospike, Inc. under one or more contributor 
* license agreements. 
* 
* Licensed under the Apache License, Version 2.0 (the "License"); you may not 
* use this file except in compliance with the License. You may obtain a copy of 
* the License at http://www.apache.org/licenses/LICENSE-2.0 
* 
* Unless required by applicable law or agreed to in writing, software 
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
* License for the specific language governing permissions and limitations under 
* the License. 
*/ 
package com.aerospike.helper.model; 

import java.util.ArrayList; 
import java.util.HashMap; 
import java.util.List; 
import java.util.Map; 
import java.util.Set; 

import com.aerospike.client.query.IndexType; 
/** 
* This class represents a Secondary Index 
* created in the cluster. 
* 
* @author peter 
* 
*/ 
public class Index { 

    protected Map<String, String> values; 
    public Index(String info) { 
     setIndexInfo(info); 

    } 
    public String getName() { 
     return values.get("indexname"); 

    } 



    public List<NameValuePair> getValues(){ 
     List<NameValuePair> result = new ArrayList<NameValuePair>(); 
     Set<String> keys = this.values.keySet(); 
     for (String key : keys){ 
      NameValuePair nvp = new NameValuePair(this, key, this.values.get(key)); 
      result.add(nvp); 
     } 
     return result; 
    } 

    public void setIndexInfo(String info){ 
     //ns=phobos_sindex:set=longevity:indexname=str_100_idx:num_bins=1:bins=str_100_bin:type=TEXT:sync_state=synced:state=RW; 
     if (!info.isEmpty()){ 
      String[] parts = info.split(":"); 
      if (values == null){ 
       values = new HashMap<String, String>(); 
      } 
      for (String part : parts){ 
       kvPut(part, this.values); 
      } 
     } 
    } 
    private void kvPut(String kv, Map<String, String> map){ 
     String[] kvParts = kv.split("="); 
     map.put(kvParts[0], kvParts[1]); 
    }; 

    @Override 
    public String toString() { 
     return this.getName(); 
    } 
    public String getBin() { 
     return values.get("bins"); 
    } 
    public IndexType getType(){ 
     String indexTypeString = values.get("type"); 
     if (indexTypeString.equalsIgnoreCase("TEXT")) 
      return IndexType.STRING; 
     else 
      return IndexType.NUMERIC; 
    } 
} 

Antwort

1

Befestigen Sie die Feder-data-Aero-Spike als Aero-Spike-Server geändert sein Verhalten seit 48f1ae5.

Der Code, der als Reaktion auf 'show Indizes' auf dem Server (in as/src/base/secondary_index.c) ist:

/* 
* Client API to list all the indexes in a namespace, returns list of imd with 
* index information, Caller should free it up 
*/ 
int 
as_sindex_list_str(as_namespace *ns, cf_dyn_buf *db) 
{ 
...... 

Sie können in den link die Änderung überprüfen.

+1

Erledigt und mit Repo verschmolzen –

+0

cool! gute Arbeit! –